IRC_NewDev
he 2024-09-20 14:59:45 +08:00
commit ae0f601727
595 changed files with 15232 additions and 19609 deletions

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Application.Services.BusinessFilter namespace IRaCIS.Core.Application.Service.BusinessFilter
{ {
/// <summary> /// <summary>
/// 统一返回前端数据包装之前在控制器包装现在修改为动态Api 在ResultFilter这里包装减少重复冗余代码 /// 统一返回前端数据包装之前在控制器包装现在修改为动态Api 在ResultFilter这里包装减少重复冗余代码

View File

@ -7,7 +7,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Application.Services; using IRaCIS.Core.Application.Service;
using AutoMapper; using AutoMapper;
using IRaCIS.Core.SCP.Service; using IRaCIS.Core.SCP.Service;

View File

@ -8,7 +8,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Sts20150401" Version="1.1.4" /> <PackageReference Include="AlibabaCloud.SDK.Sts20150401" Version="1.1.4" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" /> <PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
<PackageReference Include="AWSSDK.S3" Version="3.7.402.7" /> <PackageReference Include="AWSSDK.S3" Version="3.7.402.7" />

View File

@ -1,5 +1,5 @@
using AutoMapper; using AutoMapper;
using IRaCIS.Application.Services.BusinessFilter; using IRaCIS.Core.Application.Service.BusinessFilter;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;

View File

@ -14,7 +14,7 @@ using System.Text;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using System.Threading.Tasks; using System.Threading.Tasks;
using IRaCIS.Application.Services; using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;

View File

@ -7,7 +7,7 @@ using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using System.Threading.Tasks; using System.Threading.Tasks;
using IRaCIS.Application.Services; using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Application.Service.Inspection.DTO; using IRaCIS.Core.Application.Service.Inspection.DTO;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;

View File

@ -29,7 +29,7 @@
<param name="doctorId"></param> <param name="doctorId"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,ZiggyCreatures.Caching.Fusion.IFusionCache,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Application.Contracts.IReadingImageTaskService,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},IRaCIS.Application.Services.IMailVerificationService)"> <member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,ZiggyCreatures.Caching.Fusion.IFusionCache,IRaCIS.Core.Application.Service.IUserService,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Application.Contracts.IReadingImageTaskService,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},IRaCIS.Core.Application.Service.IMailVerificationService)">
<summary> 系统用户登录接口[New] </summary> <summary> 系统用户登录接口[New] </summary>
</member> </member>
<member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.AddOrUpdateTrialInspection(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Application.Contracts.TrialCommand})"> <member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.AddOrUpdateTrialInspection(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Application.Contracts.TrialCommand})">
@ -41,7 +41,7 @@
<param name="param"></param> <param name="param"></param>
<returns>新记录Id</returns> <returns>新记录Id</returns>
</member> </member>
<member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.WorkLoadAddOrUpdate(IRaCIS.Application.Services.IDoctorWorkloadService,IRaCIS.Application.Contracts.WorkloadCommand)"> <member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.WorkLoadAddOrUpdate(IRaCIS.Core.Application.Service.IDoctorWorkloadService,IRaCIS.Application.Contracts.WorkloadCommand)">
<summary> <summary>
添加或更新工作量[AUTH] 添加或更新工作量[AUTH]
</summary> </summary>

View File

@ -20,7 +20,7 @@ using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Filter;
using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.HttpOverrides;
using IRaCIS.Application.Services.BackGroundJob; using IRaCIS.Core.Application.Service.BackGroundJob;
using LogDashboard; using LogDashboard;
using FellowOakDicom.Network; using FellowOakDicom.Network;
using IRaCIS.Core.Application.Service.ImageAndDoc; using IRaCIS.Core.Application.Service.ImageAndDoc;

View File

@ -1,7 +1,7 @@
using Hangfire; using Hangfire;
using Hangfire.Dashboard; using Hangfire.Dashboard;
using Hangfire.Dashboard.BasicAuthorization; using Hangfire.Dashboard.BasicAuthorization;
using IRaCIS.Application.Services.BackGroundJob; using IRaCIS.Core.Application.Service.BackGroundJob;
using IRaCIS.Core.API.Filter; using IRaCIS.Core.API.Filter;
using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Helper;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;

View File

@ -9,7 +9,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Application.Services; using IRaCIS.Core.Application.Service;
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Interfaces;
using AutoMapper; using AutoMapper;

View File

@ -31,9 +31,9 @@ namespace IRaCIS.Core.Application.Auth
Id = user.Id, Id = user.Id,
FullName = user.UserName, FullName = user.UserName,
RealName = user.RealName, RealName = user.RealName,
UserTypeEnum=user.UserTypeEnum, UserTypeEnum = user.UserTypeEnum,
UserTypeId=user.UserTypeId, UserTypeId = user.UserTypeId,
IsTestUser=user.IsTestUser, IsTestUser = user.IsTestUser,
Code = user.Code, Code = user.Code,
PermissionStr = user.PermissionStr, PermissionStr = user.PermissionStr,

View File

@ -1,10 +1,4 @@
using System; namespace IRaCIS.Core.Application.Auth
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Auth
{ {
@ -13,7 +7,7 @@ namespace IRaCIS.Core.Application.Auth
public const string CRC = "CRC"; public const string CRC = "CRC";
public const string PM = "PM"; public const string PM = "PM";

View File

@ -1,6 +1,5 @@
using System.Collections.Generic; using Microsoft.IdentityModel.Tokens;
using System.Text; using System.Text;
using Microsoft.IdentityModel.Tokens;
namespace IRaCIS.Core.Application.Auth namespace IRaCIS.Core.Application.Auth
{ {

View File

@ -1,7 +1,7 @@
using System.IdentityModel.Tokens.Jwt; using IRaCIS.Core.Domain.Share;
using System.Security.Claims;
using IRaCIS.Core.Domain.Share;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
namespace IRaCIS.Core.Application.Auth namespace IRaCIS.Core.Application.Auth
{ {

View File

@ -1,16 +1,10 @@
using Hangfire; using Hangfire;
using Hangfire.Storage; using Hangfire.Storage;
using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using SharpCompress.Common;
using ZiggyCreatures.Caching.Fusion;
namespace IRaCIS.Application.Services.BackGroundJob namespace IRaCIS.Core.Application.Service.BackGroundJob
{ {
public interface IIRaCISHangfireJob public interface IIRaCISHangfireJob

View File

@ -1,11 +1,10 @@
using IRaCIS.Core.Infra.EFCore; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
namespace IRaCIS.Core.Application.BackGroundJob namespace IRaCIS.Core.Application.BackGroundJob
{ {
public interface IObtainTaskAutoCancelJob public interface IObtainTaskAutoCancelJob
{ {
Task CancelQCObtaion(Guid subjectVisitId,DateTime startTime); Task CancelQCObtaion(Guid subjectVisitId, DateTime startTime);
} }
public class ObtainTaskAutoCancelJob : IObtainTaskAutoCancelJob public class ObtainTaskAutoCancelJob : IObtainTaskAutoCancelJob
@ -13,7 +12,7 @@ namespace IRaCIS.Core.Application.BackGroundJob
private readonly IRepository<SubjectVisit> _subjectVisitRepository; private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly ILogger<ObtainTaskAutoCancelJob> _logger; private readonly ILogger<ObtainTaskAutoCancelJob> _logger;
public ObtainTaskAutoCancelJob(IRepository<SubjectVisit> subjectVisitRepository, ILogger<ObtainTaskAutoCancelJob> logger) public ObtainTaskAutoCancelJob(IRepository<SubjectVisit> subjectVisitRepository, ILogger<ObtainTaskAutoCancelJob> logger)
{ {
_subjectVisitRepository = subjectVisitRepository; _subjectVisitRepository = subjectVisitRepository;
_logger = logger; _logger = logger;
@ -30,7 +29,7 @@ namespace IRaCIS.Core.Application.BackGroundJob
var success = await _subjectVisitRepository.SaveChangesAsync(); var success = await _subjectVisitRepository.SaveChangesAsync();
_logger.LogWarning($"任务建立时间:{startTime} 取消时间:{DateTime.Now} 取消 受试者访视:{ subjectVisitId }success:{success}"); _logger.LogWarning($"任务建立时间:{startTime} 取消时间:{DateTime.Now} 取消 受试者访视:{subjectVisitId}success:{success}");
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -1,17 +1,16 @@
using AutoMapper; using AutoMapper;
using IRaCIS.Application.Services.BusinessFilter; using IRaCIS.Core.Application.Service.BusinessFilter;
using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Panda.DynamicWebApi; using Panda.DynamicWebApi;
using Panda.DynamicWebApi.Attributes; using Panda.DynamicWebApi.Attributes;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Mvc;
using ZiggyCreatures.Caching.Fusion; using ZiggyCreatures.Caching.Fusion;
namespace IRaCIS.Core.Application namespace IRaCIS.Core.Application.Service
{ {
#pragma warning disable CS8618 #pragma warning disable CS8618

View File

@ -1,13 +1,9 @@
using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Paddings; using Org.BouncyCastle.Crypto.Paddings;
using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Crypto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using Org.BouncyCastle.Crypto.Modes;
namespace IRaCIS.Core.Application.BusinessFilter; namespace IRaCIS.Core.Application.BusinessFilter;

View File

@ -3,11 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.BusinessFilter; namespace IRaCIS.Core.Application.BusinessFilter;

View File

@ -1,13 +1,8 @@
using DocumentFormat.OpenXml.InkML; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.BusinessFilter; namespace IRaCIS.Core.Application.BusinessFilter;

View File

@ -1,14 +1,10 @@
using System; using Org.BouncyCastle.Crypto;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Encodings; using Org.BouncyCastle.Crypto.Encodings;
using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Generators; using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.OpenSsl; using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security; using Org.BouncyCastle.Security;
using System.Text;
namespace IRaCIS.Core.Application.BusinessFilter; namespace IRaCIS.Core.Application.BusinessFilter;

View File

@ -1,50 +1,43 @@
using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.BusinessFilter namespace IRaCIS.Core.Application.BusinessFilter;
/// <summary>
/// 不生效,不知道为啥
/// </summary>
public class GlobalExceptionHandler : IExceptionHandler
{ {
private readonly ILogger<GlobalExceptionHandler> _logger;
/// <summary> public GlobalExceptionHandler(ILogger<GlobalExceptionHandler> logger)
/// 不生效,不知道为啥 {
/// </summary> this._logger = logger;
public class GlobalExceptionHandler : IExceptionHandler }
public ValueTask<bool> TryHandleAsync(
HttpContext httpContext,
Exception exception,
CancellationToken cancellationToken)
{ {
private readonly ILogger<GlobalExceptionHandler> _logger;
public GlobalExceptionHandler(ILogger<GlobalExceptionHandler> logger)
{
this._logger = logger;
}
public ValueTask<bool> TryHandleAsync(
HttpContext httpContext,
Exception exception,
CancellationToken cancellationToken)
{
httpContext.Response.ContentType = "application/json"; httpContext.Response.ContentType = "application/json";
var ex = exception; var ex = exception;
var errorInfo = $"Exception: {ex.Message}[{ex.StackTrace}]" + (ex.InnerException != null ? $" InnerException: {ex.InnerException.Message}[{ex.InnerException.StackTrace}]" : ""); var errorInfo = $"Exception: {ex.Message}[{ex.StackTrace}]" + (ex.InnerException != null ? $" InnerException: {ex.InnerException.Message}[{ex.InnerException.StackTrace}]" : "");
httpContext.Response.WriteAsJsonAsync(ResponseOutput.NotOk($"{ex?.Message}")); httpContext.Response.WriteAsJsonAsync(ResponseOutput.NotOk($"{ex?.Message}"));
_logger.LogError(errorInfo); _logger.LogError(errorInfo);
// return true to signal that this exception is handled // return true to signal that this exception is handled
return ValueTask.FromResult(false); return ValueTask.FromResult(false);
}
} }
} }

View File

@ -1,13 +1,11 @@
using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using ZiggyCreatures.Caching.Fusion; using ZiggyCreatures.Caching.Fusion;
namespace IRaCIS.Core.Application.Filter; namespace IRaCIS.Core.Application.Filter;
@ -25,7 +23,7 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig; private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig;
public LimitUserRequestAuthorization(IFusionCache fusionCache, IUserInfo userInfo, IStringLocalizer localizer ,IOptionsMonitor<ServiceVerifyConfigOption> verifyConfig) public LimitUserRequestAuthorization(IFusionCache fusionCache, IUserInfo userInfo, IStringLocalizer localizer, IOptionsMonitor<ServiceVerifyConfigOption> verifyConfig)
{ {
_fusionCache = fusionCache; _fusionCache = fusionCache;
_userInfo = userInfo; _userInfo = userInfo;
@ -55,7 +53,7 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
{ {
context.HttpContext.Response.ContentType = "application/json"; context.HttpContext.Response.ContentType = "application/json";
context.HttpContext.Response.StatusCode = StatusCodes.Status200OK; context.HttpContext.Response.StatusCode = StatusCodes.Status200OK;
//---当前请求未从Header/Url取到用户Token,请联系开发者 //---当前请求未从Header/Url取到用户Token,请联系开发者
//await context.HttpContext.Response.WriteAsync(JsonConvert.SerializeObject(ResponseOutput.NotOk(_localizer["LimitUser_AuthTokenMissing"]))); //await context.HttpContext.Response.WriteAsync(JsonConvert.SerializeObject(ResponseOutput.NotOk(_localizer["LimitUser_AuthTokenMissing"])));
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["LimitUser_AuthTokenMissing"])); context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["LimitUser_AuthTokenMissing"]));

View File

@ -1,37 +1,34 @@
using IRaCIS.Core.Infrastructure.Extention; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Filter namespace IRaCIS.Core.Application.Filter;
public class ModelActionFilter : ActionFilterAttribute, IActionFilter
{ {
public IStringLocalizer _localizer;
public ModelActionFilter(IStringLocalizer localizer)
public class ModelActionFilter : ActionFilterAttribute, IActionFilter
{ {
public IStringLocalizer _localizer; _localizer = localizer;
public ModelActionFilter(IStringLocalizer localizer)
{
_localizer = localizer;
}
public override void OnActionExecuting(ActionExecutingContext context)
{
if (!context.ModelState.IsValid)
{
var validationErrors = context.ModelState
.Keys
.SelectMany(k => context.ModelState[k]!.Errors)
.Select(e => e.ErrorMessage)
.ToArray();
//---提供给接口的参数无效。
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["ModelAction_InvalidAPIParameter"] + JsonConvert.SerializeObject( validationErrors)));
}
}
} }
public override void OnActionExecuting(ActionExecutingContext context)
{
if (!context.ModelState.IsValid)
{
var validationErrors = context.ModelState
.Keys
.SelectMany(k => context.ModelState[k]!.Errors)
.Select(e => e.ErrorMessage)
.ToArray();
//---提供给接口的参数无效。
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["ModelAction_InvalidAPIParameter"] + JsonConvert.SerializeObject(validationErrors)));
}
}
} }

View File

@ -1,28 +1,26 @@
using System;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace IRaCIS.Core.Application.Filter namespace IRaCIS.Core.Application.Filter;
#region snippet_DisableFormValueModelBindingAttribute
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter
{ {
#region snippet_DisableFormValueModelBindingAttribute public void OnResourceExecuting(ResourceExecutingContext context)
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class DisableFormValueModelBindingAttribute : Attribute, IResourceFilter
{ {
public void OnResourceExecuting(ResourceExecutingContext context)
{
var factories = context.ValueProviderFactories; var factories = context.ValueProviderFactories;
//factories.RemoveType<FormValueProviderFactory>(); //factories.RemoveType<FormValueProviderFactory>();
factories.RemoveType<FormFileValueProviderFactory>(); factories.RemoveType<FormFileValueProviderFactory>();
factories.RemoveType<JQueryFormValueProviderFactory>(); factories.RemoveType<JQueryFormValueProviderFactory>();
context.HttpContext.Request.EnableBuffering(); context.HttpContext.Request.EnableBuffering();
} }
public void OnResourceExecuted(ResourceExecutedContext context) public void OnResourceExecuted(ResourceExecutedContext context)
{ {
}
} }
#endregion
} }
#endregion

View File

@ -1,77 +1,75 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace IRaCIS.Core.Application.Filter namespace IRaCIS.Core.Application.Filter;
public class ProjectExceptionFilter : Attribute, IExceptionFilter
{ {
public class ProjectExceptionFilter : Attribute, IExceptionFilter private readonly ILogger<ProjectExceptionFilter> _logger;
public IStringLocalizer _localizer;
public ProjectExceptionFilter(IStringLocalizer localizer, ILogger<ProjectExceptionFilter> logger)
{ {
private readonly ILogger<ProjectExceptionFilter> _logger; _logger = logger;
_localizer = localizer;
}
public void OnException(ExceptionContext context)
{
//context.ExceptionHandled;//记录当前这个异常是否已经被处理过了
public IStringLocalizer _localizer; if (!context.ExceptionHandled)
public ProjectExceptionFilter(IStringLocalizer localizer, ILogger<ProjectExceptionFilter> logger)
{ {
_logger = logger; if (context.Exception.GetType().Name == "DbUpdateConcurrencyException")
_localizer = localizer;
}
public void OnException(ExceptionContext context)
{
//context.ExceptionHandled;//记录当前这个异常是否已经被处理过了
if (!context.ExceptionHandled)
{ {
if (context.Exception.GetType().Name == "DbUpdateConcurrencyException") //---并发更新,当前不允许该操作
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["ProjectException_ConcurrentUpdateNotAllowed"] + context.Exception.Message));
}
if (context.Exception.GetType() == typeof(BusinessValidationFailedException))
{
var error = context.Exception as BusinessValidationFailedException;
var info = string.Empty;
if (!string.IsNullOrWhiteSpace(error!.LocalizedKey) && StaticData.Log_Locoalize_Dic.ContainsKey(error!.LocalizedKey))
{ {
//---并发更新,当前不允许该操作 info = $"[{error!.LocalizedKey}]:{StaticData.Log_Locoalize_Dic[error!.LocalizedKey]}";
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["ProjectException_ConcurrentUpdateNotAllowed"] + context.Exception.Message));
} }
if (context.Exception.GetType() == typeof(BusinessValidationFailedException))
{
var error = context.Exception as BusinessValidationFailedException;
var info = string.Empty; context.Result = new JsonResult(ResponseOutput.NotOk(context.Exception.Message, "", error!.Code, localizedInfo: info));
if (!string.IsNullOrWhiteSpace(error!.LocalizedKey) && StaticData.Log_Locoalize_Dic.ContainsKey(error!.LocalizedKey))
{
info = $"[{error!.LocalizedKey}]:{StaticData.Log_Locoalize_Dic[error!.LocalizedKey]}";
}
context.Result = new JsonResult(ResponseOutput.NotOk(context.Exception.Message, "", error!.Code, localizedInfo: info)); //warning 级别记录
//_logger.LogWarning($"[{error!.LocalizedKey}]:{StaticData.Log_Locoalize_Dic[error!.LocalizedKey]}");
}
//warning 级别记录 else if (context.Exception.GetType() == typeof(QueryBusinessObjectNotExistException))
//_logger.LogWarning($"[{error!.LocalizedKey}]:{StaticData.Log_Locoalize_Dic[error!.LocalizedKey]}"); {
} context.Result = new JsonResult(ResponseOutput.NotOk(context.Exception.Message, ApiResponseCodeEnum.DataNotExist));
else if (context.Exception.GetType() == typeof(QueryBusinessObjectNotExistException))
{
context.Result = new JsonResult(ResponseOutput.NotOk(context.Exception.Message, ApiResponseCodeEnum.DataNotExist));
}
else
{
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["Project_ExceptionContactDeveloper"] + (context.Exception.InnerException is null ? (context.Exception.Message /*+ context.Exception.StackTrace*/)
: (context.Exception.InnerException?.Message /*+ context.Exception.InnerException?.StackTrace*/)), ApiResponseCodeEnum.ProgramException));
_logger.LogError(context.Exception.InnerException is null ? (context.Exception.Message + context.Exception.StackTrace) : (context.Exception.InnerException?.Message + context.Exception.InnerException?.StackTrace));
}
context.ExceptionHandled = true;//标记当前异常已经被处理过了
//throw new Exception("test-result-exceptioin");
} }
else else
{ {
//继续 context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["Project_ExceptionContactDeveloper"] + (context.Exception.InnerException is null ? (context.Exception.Message /*+ context.Exception.StackTrace*/)
: (context.Exception.InnerException?.Message /*+ context.Exception.InnerException?.StackTrace*/)), ApiResponseCodeEnum.ProgramException));
_logger.LogError(context.Exception.InnerException is null ? (context.Exception.Message + context.Exception.StackTrace) : (context.Exception.InnerException?.Message + context.Exception.InnerException?.StackTrace));
} }
context.ExceptionHandled = true;//标记当前异常已经被处理过了
//throw new Exception("test-result-exceptioin");
}
else
{
//继续
} }
} }
} }

View File

@ -8,80 +8,124 @@ using System.Text.RegularExpressions;
using ZiggyCreatures.Caching.Fusion; using ZiggyCreatures.Caching.Fusion;
using static IRaCIS.Core.Domain.Share.StaticData; using static IRaCIS.Core.Domain.Share.StaticData;
namespace IRaCIS.Core.Application.Filter namespace IRaCIS.Core.Application.Filter;
/// <summary>
/// 主要为了 处理项目结束 锁库,不允许操作
/// </summary>
public class TrialResourceFilter : Attribute, IAsyncResourceFilter
{ {
/// <summary> private readonly IUserInfo _userInfo;
/// 主要为了 处理项目结束 锁库,不允许操作 private readonly IFusionCache _fusionCache;
/// </summary> public IStringLocalizer _localizer;
public class TrialResourceFilter : Attribute, IAsyncResourceFilter private readonly IRepository<Trial> _trialRepository;
private readonly List<string> _trialOptList = new List<string>();
public TrialResourceFilter(IFusionCache fusionCache, IRepository<Trial> trialRepository, IStringLocalizer localizer, IUserInfo userInfo, string trialOpt = null, string trialOpt2 = null, string trialOpt3 = null)
{ {
private readonly IUserInfo _userInfo; _fusionCache = fusionCache;
private readonly IFusionCache _fusionCache; _userInfo = userInfo;
public IStringLocalizer _localizer; _localizer = localizer;
private readonly IRepository<Trial> _trialRepository; _trialRepository = trialRepository;
private readonly List<string> _trialOptList = new List<string>();
if (!string.IsNullOrWhiteSpace(trialOpt)) _trialOptList.Add(trialOpt.Trim());
if (!string.IsNullOrWhiteSpace(trialOpt2)) _trialOptList.Add(trialOpt2.Trim());
if (!string.IsNullOrWhiteSpace(trialOpt3)) _trialOptList.Add(trialOpt3.Trim());
public TrialResourceFilter(IFusionCache fusionCache, IRepository<Trial> trialRepository, IStringLocalizer localizer, IUserInfo userInfo, string trialOpt = null, string trialOpt2 = null, string trialOpt3 = null) }
//优先选择异步的方法
public async Task OnResourceExecutionAsync(ResourceExecutingContext context, ResourceExecutionDelegate next)
{
// var typeFilter = context.ActionDescriptor.EndpointMetadata.Where(t => t.GetType() == typeof(TypeFilterAttribute)).Select(t => (TypeFilterAttribute)t).ToList().FirstOrDefault();
//var _trialOptList= typeFilter.Arguments.Select(t => t.ToString()).ToList();
#region 处理新的用户类型,不能操作项目相关接口
// 后期列举出具体的类型,其他任何用户类型,都不允许操作
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA && _userInfo.RequestUrl.ToLower() != "TrialDocument/userConfirm".ToLower())
{ {
_fusionCache = fusionCache; //---对不起,您的账户没有操作权限。
_userInfo = userInfo; context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_NoAccessPermission"]));
_localizer = localizer;
_trialRepository = trialRepository;
if (!string.IsNullOrWhiteSpace(trialOpt)) _trialOptList.Add(trialOpt.Trim());
if (!string.IsNullOrWhiteSpace(trialOpt2)) _trialOptList.Add(trialOpt2.Trim());
if (!string.IsNullOrWhiteSpace(trialOpt3)) _trialOptList.Add(trialOpt3.Trim());
return;
} }
//优先选择异步的方法 #endregion
public async Task OnResourceExecutionAsync(ResourceExecutingContext context, ResourceExecutionDelegate next)
//TrialId 传递的途径多种可能在path 可能在body 可能在数组中也可能在对象中可能就在url
var trialIdStr = string.Empty;
if (!string.IsNullOrWhiteSpace(context.HttpContext.Request.Query["trialId"]))
{ {
// var typeFilter = context.ActionDescriptor.EndpointMetadata.Where(t => t.GetType() == typeof(TypeFilterAttribute)).Select(t => (TypeFilterAttribute)t).ToList().FirstOrDefault(); trialIdStr = context.HttpContext.Request.Query["trialId"];
//var _trialOptList= typeFilter.Arguments.Select(t => t.ToString()).ToList(); }
#region 处理新的用户类型,不能操作项目相关接口 //先尝试从path中取TrialId
else if (context.RouteData.Values.Keys.Any(t => t.Contains("trialId")))
{
var index = context.RouteData.Values.Keys.ToList().IndexOf("trialId");
trialIdStr = context.RouteData.Values.Values.ToList()[index] as string;
}
else if (context.HttpContext.Request.Headers["Referer"].ToString().Contains("trialId"))
{
var headerStr = context.HttpContext.Request.Headers["Referer"].ToString();
// 后期列举出具体的类型,其他任何用户类型,都不允许操作 var trialIdIndex = headerStr.IndexOf("trialId");
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA && _userInfo.RequestUrl.ToLower() != "TrialDocument/userConfirm".ToLower())
var matchResult = Regex.Match(headerStr.Substring(trialIdIndex), @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
if (matchResult.Success)
{ {
//---对不起,您的账户没有操作权限。 trialIdStr = matchResult.Value;
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_NoAccessPermission"])); }
else
return; {
//---正则取请求Refer 中trialId 失败,请联系开发人员核查
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_ReferTrialIdFailed"]));
} }
#endregion }
else
{
#region body 中取数据
//设置可以多次读
context.HttpContext.Request.EnableBuffering();
var reader = new StreamReader(context.HttpContext.Request.Body);
var contentFromBody = await reader.ReadToEndAsync();
//读取后,流的位置还原
context.HttpContext.Request.Body.Seek(0, SeekOrigin.Begin);
//context.HttpContext.Request.Body.Position = 0;
//找到参数位置在字符串中的索引
var trialIdIndex = contentFromBody.IndexOf("\"TrialId\"", StringComparison.OrdinalIgnoreCase);
//TrialId 传递的途径多种可能在path 可能在body 可能在数组中也可能在对象中可能就在url if (trialIdIndex > -1)
var trialIdStr = string.Empty;
if (!string.IsNullOrWhiteSpace(context.HttpContext.Request.Query["trialId"]))
{ {
trialIdStr = context.HttpContext.Request.Query["trialId"]; // (?<="trialId" *: *").*?(?=",)
}
//先尝试从path中取TrialId //使用正则 [0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}
else if (context.RouteData.Values.Keys.Any(t => t.Contains("trialId")))
{
var index = context.RouteData.Values.Keys.ToList().IndexOf("trialId");
trialIdStr = context.RouteData.Values.Values.ToList()[index] as string;
}
else if (context.HttpContext.Request.Headers["Referer"].ToString().Contains("trialId"))
{
var headerStr = context.HttpContext.Request.Headers["Referer"].ToString();
var trialIdIndex = headerStr.IndexOf("trialId"); var matchResult = Regex.Match(contentFromBody.Substring(trialIdIndex), @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
var matchResult = Regex.Match(headerStr.Substring(trialIdIndex), @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
if (matchResult.Success) if (matchResult.Success)
{ {
//有可能匹配错误 "trialId":"","documentId":"b8180000-3e2c-0016-9fe0-08da33f96236" 从缓存里面验证下
trialIdStr = matchResult.Value; trialIdStr = matchResult.Value;
var trialStatusStr = await _fusionCache.GetOrSetAsync(CacheKeys.Trial(trialIdStr), _ => CacheHelper.GetTrialStatusAsync(Guid.Parse(trialIdStr), _trialRepository), TimeSpan.FromDays(7));
if (string.IsNullOrWhiteSpace(trialStatusStr))
{
//数据库 检查该项目Id不对
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_ReferTrialIdFailed"]));
}
} }
else else
{ {
@ -89,93 +133,48 @@ namespace IRaCIS.Core.Application.Filter
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_ReferTrialIdFailed"])); context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_ReferTrialIdFailed"]));
} }
} //使用字符串取 如果是swagger 可能有时取的不对 因为空格的原因
else //trialIdStr = contentFromBody.Substring(trialIdIndex + "TrialId".Length + 4, 3
{
#region body 中取数据
//设置可以多次读
context.HttpContext.Request.EnableBuffering();
var reader = new StreamReader(context.HttpContext.Request.Body);
var contentFromBody = await reader.ReadToEndAsync();
//读取后,流的位置还原
context.HttpContext.Request.Body.Seek(0, SeekOrigin.Begin);
//context.HttpContext.Request.Body.Position = 0;
//找到参数位置在字符串中的索引
var trialIdIndex = contentFromBody.IndexOf("\"TrialId\"", StringComparison.OrdinalIgnoreCase);
if (trialIdIndex > -1)
{
// (?<="trialId" *: *").*?(?=",)
//使用正则 [0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}
var matchResult = Regex.Match(contentFromBody.Substring(trialIdIndex), @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
if (matchResult.Success)
{
//有可能匹配错误 "trialId":"","documentId":"b8180000-3e2c-0016-9fe0-08da33f96236" 从缓存里面验证下
trialIdStr = matchResult.Value;
var trialStatusStr = await _fusionCache.GetOrSetAsync(CacheKeys.Trial(trialIdStr), _ => CacheHelper.GetTrialStatusAsync(Guid.Parse(trialIdStr), _trialRepository), TimeSpan.FromDays(7));
if (string.IsNullOrWhiteSpace(trialStatusStr))
{
//数据库 检查该项目Id不对
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_ReferTrialIdFailed"]));
}
}
else
{
//---正则取请求Refer 中trialId 失败,请联系开发人员核查
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_ReferTrialIdFailed"]));
}
//使用字符串取 如果是swagger 可能有时取的不对 因为空格的原因
//trialIdStr = contentFromBody.Substring(trialIdIndex + "TrialId".Length + 4, 3
}
#endregion
} }
//通过path 或者body 找到trialId 了 #endregion
if (!string.IsNullOrWhiteSpace(trialIdStr)) }
//通过path 或者body 找到trialId 了
if (!string.IsNullOrWhiteSpace(trialIdStr))
{
var trialStatusStr = await _fusionCache.GetOrSetAsync(CacheKeys.Trial(trialIdStr), _ => CacheHelper.GetTrialStatusAsync(Guid.Parse(trialIdStr), _trialRepository), TimeSpan.FromDays(7));
// 这里是统一拦截 项目有关的操作允许情况(特殊的地方比如项目配置有的在多种状态初始化ongoing都可以操作有的仅仅在Initializing还有 项目添加和更新,不走这里,特殊处理,不然在这里显得很乱,判断是哪个接口)
if (trialStatusStr == StaticData.TrialState.TrialOngoing || _trialOptList.Any(t => t == TrialOpt.BeforeOngoingCantOpt))
{ {
var trialStatusStr = await _fusionCache.GetOrSetAsync(CacheKeys.Trial(trialIdStr), _ => CacheHelper.GetTrialStatusAsync(Guid.Parse(trialIdStr), _trialRepository), TimeSpan.FromDays(7));
// 这里是统一拦截 项目有关的操作允许情况(特殊的地方比如项目配置有的在多种状态初始化ongoing都可以操作有的仅仅在Initializing还有 项目添加和更新,不走这里,特殊处理,不然在这里显得很乱,判断是哪个接口)
if (trialStatusStr == StaticData.TrialState.TrialOngoing || _trialOptList.Any(t => t == TrialOpt.BeforeOngoingCantOpt))
{
await next.Invoke();
}
// 项目停止、或者完成 不允许操作
else
{
//---本次请求被配置规则拦截:项目状态处于进行中时,才允许操作,若此处逻辑有误,请联系开发人员修改
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_InterceptedProjectStatusRule"]));
}
}
//添加项目 签名系统文档的时候 不做拦截 但是更新项目 签名项目文档的时候需要拦截
else if (_trialOptList.Any(t => t == TrialOpt.AddOrUpdateTrial || t == TrialOpt.SignSystemDocNoTrialId))
{
await next.Invoke(); await next.Invoke();
}
}
// 项目停止、或者完成 不允许操作
else else
{ {
//如果项目相关接口没有传递trialId 会来到这里,提醒,以便修改 //---本次请求被配置规则拦截:项目状态处于进行中时,才允许操作,若此处逻辑有误,请联系开发人员修改
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_InterceptedProjectStatusRule"]));
//---该接口参数中,没有传递项目编号,请核对。
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_MissingProjectNumber"]));
} }
} }
//添加项目 签名系统文档的时候 不做拦截 但是更新项目 签名项目文档的时候需要拦截
else if (_trialOptList.Any(t => t == TrialOpt.AddOrUpdateTrial || t == TrialOpt.SignSystemDocNoTrialId))
{
await next.Invoke();
}
else
{
//如果项目相关接口没有传递trialId 会来到这里,提醒,以便修改
//---该接口参数中,没有传递项目编号,请核对。
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["TrialResource_MissingProjectNumber"]));
}
} }
} }

View File

@ -1,123 +1,122 @@
using Microsoft.AspNetCore.Mvc.Filters; using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace IRaCIS.Application.Services.BusinessFilter namespace IRaCIS.Core.Application.Service.BusinessFilter;
/// <summary>
/// 统一返回前端数据包装之前在控制器包装现在修改为动态Api 在ResultFilter这里包装减少重复冗余代码
/// by zhouhang 2021.09.12 周末
/// </summary>
public class UnifiedApiResultFilter : Attribute, IAsyncResultFilter
{ {
/// <summary> private readonly ILogger _logger;
/// 统一返回前端数据包装之前在控制器包装现在修改为动态Api 在ResultFilter这里包装减少重复冗余代码
/// by zhouhang 2021.09.12 周末 public UnifiedApiResultFilter(ILogger<UnifiedApiResultFilter> logger)
/// </summary>
public class UnifiedApiResultFilter : Attribute, IAsyncResultFilter
{ {
private readonly ILogger _logger; _logger = logger;
}
public UnifiedApiResultFilter(ILogger<UnifiedApiResultFilter> logger) /// <summary>
/// 异步版本
/// </summary>
/// <param name="context"></param>
/// <param name="next"></param>
/// <returns></returns>
public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
{
if (context.Result is ObjectResult objectResult)
{ {
_logger = logger; var statusCode = objectResult.StatusCode ?? context.HttpContext.Response.StatusCode;
}
/// <summary> //是200 并且没有包装 那么包装结果
/// 异步版本 if (statusCode == 200 && !(objectResult.Value is IResponseOutput))
/// </summary>
/// <param name="context"></param>
/// <param name="next"></param>
/// <returns></returns>
public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
{
if (context.Result is ObjectResult objectResult)
{ {
var statusCode = objectResult.StatusCode ?? context.HttpContext.Response.StatusCode;
//是200 并且没有包装 那么包装结果 var type = objectResult.Value?.GetType();
if (statusCode == 200 && !(objectResult.Value is IResponseOutput))
if (type != null && type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(ValueTuple<,>) || type.GetGenericTypeDefinition() == typeof(Tuple<,>)))
{ {
var type = objectResult.Value?.GetType(); //报错
//var tuple = (object, object))objectResult.Value;
//var (val1, val2) = ((dynamic, dynamic))objectResult.Value;
if (type != null && type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(ValueTuple<,>) || type.GetGenericTypeDefinition() == typeof(Tuple<,>))) //var apiResponse = ResponseOutput.Ok(val1, val2);
{
//OK
//报错 var tuple = (dynamic)objectResult.Value;
//var tuple = (object, object))objectResult.Value; var apiResponse = ResponseOutput.Ok(tuple!.Item1, tuple!.Item2);
//var (val1, val2) = ((dynamic, dynamic))objectResult.Value;
//var apiResponse = ResponseOutput.Ok(val1, val2);
//OK
var tuple = (dynamic)objectResult.Value;
var apiResponse = ResponseOutput.Ok(tuple!.Item1, tuple!.Item2);
objectResult.Value = apiResponse;
objectResult.DeclaredType = apiResponse.GetType();
}
else
{
var apiResponse = ResponseOutput.Ok(objectResult.Value);
objectResult.Value = apiResponse;
objectResult.DeclaredType = apiResponse.GetType();
}
objectResult.Value = apiResponse;
objectResult.DeclaredType = apiResponse.GetType();
} }
//如果是200 是IResponseOutput 记录下日志 else
else if (statusCode == 200 && (objectResult.Value is IResponseOutput))
{ {
var result = objectResult.Value as IResponseOutput; var apiResponse = ResponseOutput.Ok(objectResult.Value);
if (!string.IsNullOrWhiteSpace(result.LocalizedInfo))
{
//统一在这里记录国际化的日志信息
_logger.LogWarning($"{result.LocalizedInfo}");
}
}
else if (statusCode != 200 && !(objectResult.Value is IResponseOutput))
{
//---程序错误,请联系开发人员。
var apiResponse = ResponseOutput.NotOk(StaticData.International("UnifiedAPI_ProgramError"));
objectResult.Value = apiResponse; objectResult.Value = apiResponse;
objectResult.DeclaredType = apiResponse.GetType(); objectResult.DeclaredType = apiResponse.GetType();
} }
} }
//如果是200 是IResponseOutput 记录下日志
await next.Invoke(); else if (statusCode == 200 && (objectResult.Value is IResponseOutput))
}
public static bool IsTupleType(Type type, bool checkBaseTypes = false)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
if (type == typeof(Tuple))
return true;
while (type != null)
{ {
if (type.IsGenericType) var result = objectResult.Value as IResponseOutput;
if (!string.IsNullOrWhiteSpace(result.LocalizedInfo))
{ {
var genType = type.GetGenericTypeDefinition(); //统一在这里记录国际化的日志信息
if (genType == typeof(Tuple<>) _logger.LogWarning($"{result.LocalizedInfo}");
|| genType == typeof(Tuple<,>)
|| genType == typeof(Tuple<,>))
return true;
} }
if (!checkBaseTypes)
break;
type = type.BaseType;
} }
return false; else if (statusCode != 200 && !(objectResult.Value is IResponseOutput))
{
//---程序错误,请联系开发人员。
var apiResponse = ResponseOutput.NotOk(StaticData.International("UnifiedAPI_ProgramError"));
objectResult.Value = apiResponse;
objectResult.DeclaredType = apiResponse.GetType();
}
} }
await next.Invoke();
}
public static bool IsTupleType(Type type, bool checkBaseTypes = false)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
if (type == typeof(Tuple))
return true;
while (type != null)
{
if (type.IsGenericType)
{
var genType = type.GetGenericTypeDefinition();
if (genType == typeof(Tuple<>)
|| genType == typeof(Tuple<,>)
|| genType == typeof(Tuple<,>))
return true;
}
if (!checkBaseTypes)
break;
type = type.BaseType;
}
return false;
} }
} }

View File

@ -0,0 +1,11 @@
global using AutoMapper.QueryableExtensions;
global using IRaCIS.Core.Application.Service;
global using IRaCIS.Core.Domain.Models;
global using IRaCIS.Core.Infra.EFCore;
global using IRaCIS.Core.Infrastructure.Extention;
global using Microsoft.EntityFrameworkCore;
global using System.Linq.Expressions;

View File

@ -1,9 +1,4 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper namespace IRaCIS.Core.Application.Helper
{ {
@ -19,9 +14,9 @@ namespace IRaCIS.Core.Application.Helper
//是否翻译依赖其他属性 //是否翻译依赖其他属性
public bool IsTranslateDenpendOtherProperty =>!string.IsNullOrWhiteSpace(DependPropertyName); public bool IsTranslateDenpendOtherProperty => !string.IsNullOrWhiteSpace(DependPropertyName);
public string DependPropertyName { get; set; }=string.Empty; public string DependPropertyName { get; set; } = string.Empty;
public string DependPropertyValueStr { get; set; } = string.Empty; public string DependPropertyValueStr { get; set; } = string.Empty;
@ -33,7 +28,7 @@ namespace IRaCIS.Core.Application.Helper
} }
//针对不同的标准 翻译的字典不一样 //针对不同的标准 翻译的字典不一样
public DictionaryTranslateAttribute(string dicParentCode, CriterionType criterionType ) public DictionaryTranslateAttribute(string dicParentCode, CriterionType criterionType)
{ {
DicParentCode = dicParentCode; DicParentCode = dicParentCode;
@ -42,7 +37,7 @@ namespace IRaCIS.Core.Application.Helper
//针对业务某个属性的值 不一样 用的翻译字典不一样 //针对业务某个属性的值 不一样 用的翻译字典不一样
public DictionaryTranslateAttribute(string dicParentCode,string dependPropertyName, string dependPropertyValueStr) public DictionaryTranslateAttribute(string dicParentCode, string dependPropertyName, string dependPropertyValueStr)
{ {
DicParentCode = dicParentCode; DicParentCode = dicParentCode;

View File

@ -1,77 +1,69 @@
using IRaCIS.Core.Domain.Models; namespace IRaCIS.Core.Application.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper
public static class CacheKeys
{ {
//项目缓存
public static string Trial(string trialIdStr) => $"TrialId:{trialIdStr}";
public static class CacheKeys //检查编号递增锁
public static string TrialStudyMaxCode(Guid trialId) => $"TrialStudyMaxCode:{trialId}";
public static string TrialStudyUidUploading(Guid trialId, string studyUid) => $"TrialStudyUid:{trialId}_{studyUid}";
//CRC上传影像提交锁key
public static string TrialStudyUidDBLock(Guid trialId, string studyUid) => $"TrialStudyUidDBLock:{trialId}_{studyUid}";
public static string TrialTaskStudyUidUploading(Guid trialId, Guid visiTaskId, string studyUid) => $"TrialStudyUid:{trialId}_{visiTaskId}_{studyUid}";
//影像后处理上传提交锁key
public static string TrialTaskStudyUidDBLock(Guid trialId, Guid visiTaskId, string studyUid) => $"TrialTaskStudyUidDBLock:{trialId}_{visiTaskId}_{studyUid}";
//系统匿名化
public static string SystemAnonymization => $"SystemAnonymization";
//前端国际化
public static string FrontInternational => $"FrontInternationalList";
//登录挤账号
public static string UserToken(Guid userId) => $"UserToken:{userId}";
//超时没请求接口自动退出
public static string UserAutoLoginOut(Guid userId) => $"UserAutoLoginOut:{userId}";
/// <summary>
/// 跳过阅片
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static string SkipReadingCacheKey(Guid userId) => $"{userId}SkipReadingCache";
/// <summary>
/// 开始阅片时间
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static string StartReadingTimeKey(Guid userId) => $"{userId}StartReadingTime";
/// <summary>
/// 开始休息时间
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static string StartRestTime(Guid userId) => $"{userId}StartRestTime";
}
public static class CacheHelper
{
public static async Task<string?> GetTrialStatusAsync(Guid trialId, IRepository<Trial> _trialRepository)
{ {
//项目缓存 var statusStr = await _trialRepository.Where(t => t.Id == trialId, ignoreQueryFilters: true).Select(t => t.TrialStatusStr).FirstOrDefaultAsync();
public static string Trial(string trialIdStr) => $"TrialId:{trialIdStr}";
//检查编号递增锁
public static string TrialStudyMaxCode(Guid trialId) => $"TrialStudyMaxCode:{trialId}";
public static string TrialStudyUidUploading(Guid trialId, string studyUid) => $"TrialStudyUid:{trialId}_{studyUid}";
//CRC上传影像提交锁key
public static string TrialStudyUidDBLock(Guid trialId, string studyUid) => $"TrialStudyUidDBLock:{trialId}_{studyUid}";
public static string TrialTaskStudyUidUploading(Guid trialId, Guid visiTaskId, string studyUid) => $"TrialStudyUid:{trialId}_{visiTaskId}_{studyUid}";
//影像后处理上传提交锁key
public static string TrialTaskStudyUidDBLock(Guid trialId, Guid visiTaskId, string studyUid) => $"TrialTaskStudyUidDBLock:{trialId}_{visiTaskId}_{studyUid}";
//系统匿名化
public static string SystemAnonymization => $"SystemAnonymization";
//前端国际化
public static string FrontInternational => $"FrontInternationalList";
//登录挤账号
public static string UserToken(Guid userId) => $"UserToken:{userId}";
//超时没请求接口自动退出
public static string UserAutoLoginOut(Guid userId) => $"UserAutoLoginOut:{userId}";
/// <summary>
/// 跳过阅片
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static string SkipReadingCacheKey(Guid userId) => $"{userId}SkipReadingCache";
/// <summary>
/// 开始阅片时间
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static string StartReadingTimeKey(Guid userId) => $"{userId}StartReadingTime";
/// <summary>
/// 开始休息时间
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public static string StartRestTime(Guid userId) => $"{userId}StartRestTime";
return statusStr;
} }
public static class CacheHelper public static async Task<List<SystemAnonymization>> GetSystemAnonymizationListAsync(IRepository<SystemAnonymization> _systemAnonymizationRepository)
{ {
public static async Task<string?> GetTrialStatusAsync(Guid trialId, IRepository<Trial> _trialRepository) var list = await _systemAnonymizationRepository.Where(t => t.IsEnable).ToListAsync();
{
var statusStr = await _trialRepository.Where(t => t.Id == trialId, ignoreQueryFilters: true).Select(t => t.TrialStatusStr).FirstOrDefaultAsync();
return statusStr; return list;
}
public static async Task<List<SystemAnonymization>> GetSystemAnonymizationListAsync(IRepository<SystemAnonymization> _systemAnonymizationRepository)
{
var list = await _systemAnonymizationRepository.Where(t => t.IsEnable).ToListAsync();
return list;
}
} }
} }

View File

@ -1,7 +1,4 @@
using DocumentFormat.OpenXml.Drawing.Diagrams; using IRaCIS.Application.Contracts;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Wordprocessing;
using IRaCIS.Application.Contracts;
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Interfaces;
using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson; using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson;
using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Helper;
@ -10,14 +7,9 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs; using MiniExcelLibs;
using MiniExcelLibs.OpenXml; using MiniExcelLibs.OpenXml;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.HSSF.UserModel;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using System.Collections; using System.Collections;
using System.ComponentModel;
using System.Globalization; using System.Globalization;
using System.IO;
namespace IRaCIS.Core.Application.Service; namespace IRaCIS.Core.Application.Service;
@ -68,7 +60,7 @@ public static class ExcelExportHelper
{ {
if (DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) if (DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result))
{ {
itemDic[itemValuePair.Key] = ExportExcelConverterDate.DateTimeInternationalToString(result ); itemDic[itemValuePair.Key] = ExportExcelConverterDate.DateTimeInternationalToString(result);
} }
} }

View File

@ -1,39 +1,33 @@
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper namespace IRaCIS.Core.Application.Helper;
public class FileConvertHelper
{ {
public class FileConvertHelper
static public void ConvertWordToPdf(string inputWordFilePath, string outputPdfDir)
{ {
// 设置 libreoffice 命令行参数
string arguments = $"--headless --invisible --convert-to pdf \"{inputWordFilePath}\" --outdir \"{outputPdfDir}\"";
// 启动 libreoffice 进程
static public void ConvertWordToPdf(string inputWordFilePath, string outputPdfDir) using (Process process = new Process())
{ {
// 设置 libreoffice 命令行参数 process.StartInfo.FileName = "libreoffice";
string arguments = $"--headless --invisible --convert-to pdf \"{inputWordFilePath}\" --outdir \"{outputPdfDir}\""; process.StartInfo.Arguments = arguments;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
// 启动 libreoffice 进程 process.Start();
using (Process process = new Process())
{
process.StartInfo.FileName = "libreoffice";
process.StartInfo.Arguments = arguments;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start(); // 等待进程结束
process.WaitForExit();
// 等待进程结束
process.WaitForExit();
}
} }
} }
} }

View File

@ -1,12 +1,7 @@
 using IRaCIS.Core.Domain.Share;
using Aliyun.OSS;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Configuration;
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -16,7 +11,7 @@ public static class FileStoreHelper
{ {
//处理文件名 压缩包,或者目录类的 会带上相对路径 //处理文件名 压缩包,或者目录类的 会带上相对路径
public static (string TrustedFileNameForFileStorage, string RealName) GetStoreFileName(string fileName,bool isChangeToPdfFormat=false) public static (string TrustedFileNameForFileStorage, string RealName) GetStoreFileName(string fileName, bool isChangeToPdfFormat = false)
{ {
//带目录层级,需要后端处理前端的路径 //带目录层级,需要后端处理前端的路径
@ -41,14 +36,14 @@ public static class FileStoreHelper
var trustedFileNameForFileStorage = string.Empty; var trustedFileNameForFileStorage = string.Empty;
if (isChangeToPdfFormat==false) if (isChangeToPdfFormat == false)
{ {
trustedFileNameForFileStorage= Guid.NewGuid().ToString() + fileName; trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileName;
} }
else else
{ {
trustedFileNameForFileStorage=Guid.NewGuid().ToString() + Path.GetFileNameWithoutExtension(fileName) + ".pdf"; trustedFileNameForFileStorage = Guid.NewGuid().ToString() + Path.GetFileNameWithoutExtension(fileName) + ".pdf";
} }
return (trustedFileNameForFileStorage, fileName); return (trustedFileNameForFileStorage, fileName);
@ -136,10 +131,10 @@ public static class FileStoreHelper
{ {
var doc = await _commonDocumentRepository.FirstOrDefaultAsync(t => t.Code == code); var doc = await _commonDocumentRepository.FirstOrDefaultAsync(t => t.Code == code);
var isEn_US = CultureInfo.CurrentCulture.Name!= StaticData.CultureInfo.zh_CN; var isEn_US = CultureInfo.CurrentCulture.Name != StaticData.CultureInfo.zh_CN;
if (doc == null) if (doc == null)
{ {
//---数据库没有找到对应的数据模板文件,请联系系统运维人员。 //---数据库没有找到对应的数据模板文件,请联系系统运维人员。
throw new BusinessValidationFailedException(StaticData.International("FileStore_TemplateFileNotFound")); throw new BusinessValidationFailedException(StaticData.International("FileStore_TemplateFileNotFound"));
} }
@ -147,11 +142,11 @@ public static class FileStoreHelper
if (!System.IO.File.Exists(filePath)) if (!System.IO.File.Exists(filePath))
{ {
//---数据模板文件存储路径上未找对应文件,请联系系统运维人员。 //---数据模板文件存储路径上未找对应文件,请联系系统运维人员。
throw new BusinessValidationFailedException(StaticData.International("FileStore_TemplateFileStoragePathInvalid")); throw new BusinessValidationFailedException(StaticData.International("FileStore_TemplateFileStoragePathInvalid"));
} }
return (filePath, isEn_US? doc.Name.Trim('/'): doc.NameCN.Trim('/')); return (filePath, isEn_US ? doc.Name.Trim('/') : doc.NameCN.Trim('/'));
} }
@ -202,7 +197,7 @@ public static class FileStoreHelper
// 获取 入组确认 PD 进展发送邮件Word|PDF 存放路径 // 获取 入组确认 PD 进展发送邮件Word|PDF 存放路径
public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid trialSiteId, Guid subjectId,bool isChangeToPdfFormat=false) public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid trialSiteId, Guid subjectId, bool isChangeToPdfFormat = false)
{ {
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
@ -221,19 +216,19 @@ public static class FileStoreHelper
} }
public static string GetSubjectVisitDicomFolderPhysicalPath(IWebHostEnvironment _hostEnvironment,Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId) public static string GetSubjectVisitDicomFolderPhysicalPath(IWebHostEnvironment _hostEnvironment, Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId)
{ {
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
return Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteId.ToString(), subjectId.ToString(), subjectVisitId.ToString(), StaticData.Folder.DicomFolder); return Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteId.ToString(), subjectId.ToString(), subjectVisitId.ToString(), StaticData.Folder.DicomFolder);
} }
public static (string PhysicalPath, string RelativePath) GetDicomInstanceFilePath(IWebHostEnvironment _hostEnvironment, Guid trialId, Guid subjectId, Guid subjectVisitId, Guid studyId, Guid instanceId) public static (string PhysicalPath, string RelativePath) GetDicomInstanceFilePath(IWebHostEnvironment _hostEnvironment, Guid trialId, Guid subjectId, Guid subjectVisitId, Guid studyId, Guid instanceId)
{ {
#region 切换存储前 #region 切换存储前
//var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); //var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
#endregion #endregion
var rootPath = Path.Combine(FileStoreHelper.GetBestStoreDisk(_hostEnvironment), StaticData.Folder.IRaCISDataFolder) ; var rootPath = Path.Combine(FileStoreHelper.GetBestStoreDisk(_hostEnvironment), StaticData.Folder.IRaCISDataFolder);
@ -246,7 +241,7 @@ public static class FileStoreHelper
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
} }
var physicalPath = Path.Combine(path, instanceId.ToString() ); var physicalPath = Path.Combine(path, instanceId.ToString());
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}"; var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}";
@ -260,7 +255,7 @@ public static class FileStoreHelper
public static string GetBestStoreDisk(IWebHostEnvironment _hostEnvironment) public static string GetBestStoreDisk(IWebHostEnvironment _hostEnvironment)
{ {
var json = File.ReadAllText( Path.Combine(_hostEnvironment.ContentRootPath, "appsettings.json")); var json = File.ReadAllText(Path.Combine(_hostEnvironment.ContentRootPath, "appsettings.json"));
JObject jsonObject = (JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load })).IfNullThrowException(); JObject jsonObject = (JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load })).IfNullThrowException();
@ -274,7 +269,7 @@ public static class FileStoreHelper
{ {
//---解析Json文件配置出现问题 //---解析Json文件配置出现问题
throw new BusinessValidationFailedException(StaticData.International("SysMon_JsonConfig") + e.Message); throw new BusinessValidationFailedException(StaticData.International("SysMon_JsonConfig") + e.Message);
} }
//默认存储的路径 //默认存储的路径

View File

@ -1,15 +1,5 @@
using Hangfire; using Hangfire;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper namespace IRaCIS.Core.Application.Helper
{ {
@ -65,7 +55,7 @@ namespace IRaCIS.Core.Application.Helper
} }
public static void AddOrUpdateTrialCronJob (string jobId, Guid trialId, EmailBusinessScenario businessScenario, string emailCron) public static void AddOrUpdateTrialCronJob(string jobId, Guid trialId, EmailBusinessScenario businessScenario, string emailCron)
{ {
switch (businessScenario) switch (businessScenario)

View File

@ -1,111 +1,105 @@
using RestSharp; using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper namespace IRaCIS.Core.Application.Helper;
#region 对接模型
public class HolidayCalendar
{ {
public string Name { get; set; }
#region 对接模型 public string Version { get; set; }
public class HolidayCalendar public string Generated { get; set; }
{ public string Timezone { get; set; }
public string Name { get; set; } public string Author { get; set; }
public string Version { get; set; } public string URL { get; set; }
public string Generated { get; set; } public Dictionary<string, List<HolidayYear>> Years { get; set; }
public string Timezone { get; set; } }
public string Author { get; set; }
public string URL { get; set; } public class HolidayYear
public Dictionary<string, List<HolidayYear>> Years { get; set; } {
} public string Name { get; set; }
public DateTime StartDate { get; set; }
public class HolidayYear public DateTime EndDate { get; set; }
{ public int Duration { get; set; }
public string Name { get; set; } public List<DateTime> CompDays { get; set; }
public DateTime StartDate { get; set; } public string URL { get; set; }
public DateTime EndDate { get; set; } public string Memo { get; set; }
public int Duration { get; set; } }
public List<DateTime> CompDays { get; set; } #endregion
public string URL { get; set; }
public string Memo { get; set; }
}
#endregion
public class HolidayHelper
{
/// <summary>
/// github 链接https://github.com/lanceliao/china-holiday-calender?tab=readme-ov-file 
public class HolidayHelper /// 接口请求参考文档https://www.koudingke.cn/docs/zh-Hans/net-lib-docs/latest/RestSharp/Usage/Usage
{ /// </summary>
/// <summary> private static RestClient _client => new RestClient("https://www.shuyz.com/githubfiles/china-holiday-calender/master/holidayAPI.json");
/// github 链接https://github.com/lanceliao/china-holiday-calender?tab=readme-ov-file 
/// 接口请求参考文档https://www.koudingke.cn/docs/zh-Hans/net-lib-docs/latest/RestSharp/Usage/Usage private static HolidayCalendar _holidayCalendar { get; set; }
/// </summary>
private static RestClient _client => new RestClient("https://www.shuyz.com/githubfiles/china-holiday-calender/master/holidayAPI.json");
private static List<DateTime> _holidays = new List<DateTime>();
private static HolidayCalendar _holidayCalendar { get; set; } private static List<DateTime> _compensatedWorkdays = new List<DateTime>();
static HolidayHelper()
private static List<DateTime> _holidays = new List<DateTime>(); {
private static List<DateTime> _compensatedWorkdays = new List<DateTime>(); _holidayCalendar = _client.Get<HolidayCalendar>(new RestRequest()) ?? new HolidayCalendar();
static HolidayHelper() foreach (var year in _holidayCalendar.Years.Values.SelectMany(x => x))
{ {
_holidayCalendar = _client.Get<HolidayCalendar>(new RestRequest()) ?? new HolidayCalendar(); // 添加节假日到假日集合
for (DateTime date = year.StartDate; date <= year.EndDate; date = date.AddDays(1))
foreach (var year in _holidayCalendar.Years.Values.SelectMany(x => x)) {
{ _holidays.Add(date);
// 添加节假日到假日集合 }
for (DateTime date = year.StartDate; date <= year.EndDate; date = date.AddDays(1))
{ // 添加补班日到补班日集合
_holidays.Add(date); foreach (var compDay in year.CompDays)
} {
_compensatedWorkdays.Add(compDay);
// 添加补班日到补班日集合 }
foreach (var compDay in year.CompDays) }
{
_compensatedWorkdays.Add(compDay); }
}
} public static TimeSpan GetChinaWorkTimeSpan(DateTime startDate, DateTime endDate)
{
} if (startDate > endDate)
{
public static TimeSpan GetChinaWorkTimeSpan(DateTime startDate, DateTime endDate) throw new ArgumentException("结束日期必须大于或等于开始日期");
{ }
if (startDate > endDate)
{ var diffTimeSpan = endDate - startDate;
throw new ArgumentException("结束日期必须大于或等于开始日期");
} // 初始化工作日数为0
int workdays = 0;
var diffTimeSpan = endDate - startDate;
// 找出在给定日期范围内的假期和补班日
// 初始化工作日数为0 var filteredHolidays = _holidays.Where(d => d >= startDate && d <= endDate).ToList();
int workdays = 0; var filteredCompensatedWorkdays = _compensatedWorkdays.Where(d => d >= startDate && d <= endDate).ToList();
// 找出在给定日期范围内的假期和补班日 // 遍历日期范围,计算工作日 注意 这里是小于
var filteredHolidays = _holidays.Where(d => d >= startDate && d <= endDate).ToList(); for (DateTime date = startDate.Date; date < endDate.Date; date = date.AddDays(1))
var filteredCompensatedWorkdays = _compensatedWorkdays.Where(d => d >= startDate && d <= endDate).ToList(); {
// 判断是否为工作日
// 遍历日期范围,计算工作日 注意 这里是小于 bool isWeekend = date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
for (DateTime date = startDate.Date; date < endDate.Date; date = date.AddDays(1)) bool isHoliday = filteredHolidays.Contains(date);
{ bool isCompensatedWorkday = filteredCompensatedWorkdays.Contains(date);
// 判断是否为工作日
bool isWeekend = date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday; // 如果是补班日,或是平日(非假期,非周末),则算作工作日
bool isHoliday = filteredHolidays.Contains(date); if (isCompensatedWorkday || (!isWeekend && !isHoliday))
bool isCompensatedWorkday = filteredCompensatedWorkdays.Contains(date); {
workdays++;
// 如果是补班日,或是平日(非假期,非周末),则算作工作日 }
if (isCompensatedWorkday || (!isWeekend && !isHoliday)) }
{
workdays++; return new TimeSpan(workdays, diffTimeSpan.Hours, diffTimeSpan.Minutes, diffTimeSpan.Seconds);
}
}
}
return new TimeSpan(workdays, diffTimeSpan.Hours, diffTimeSpan.Minutes, diffTimeSpan.Seconds);
}
}
} }

View File

@ -1,85 +1,77 @@
using NPOI.SS.Formula.Functions; namespace IRaCIS.Core.Application.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper public static class IRCEmailPasswordHelper
{ {
public static class IRCEmailPasswordHelper private static readonly Random Random = new Random();
//显示位数3分之2的位数向上取整
//取哪几个个值:最后一位和前面几位
//其他3个***。
//比如hlj23@126.com
//为hlj***3@126.com
//he@126.com
//为h*** e@126.com
public static string MaskEmail(string email)
{ {
private static readonly Random Random = new Random();
//显示位数3分之2的位数向上取整 // 找到 "@" 符号的位置
//取哪几个个值:最后一位和前面几位 int atIndex = email.IndexOf('@');
//其他3个***。
//比如hlj23@126.com
//为hlj***3@126.com
//he@126.com string visiblePartBefore = email.Substring(0, atIndex);
//为h*** e@126.com
public static string MaskEmail(string email) string afterAt = email.Substring(atIndex + 1);
int visibleLength = (int)Math.Ceiling((double)visiblePartBefore.Length * 2 / 3);
// 替换中间两位字符为星号
string hiddenPartBeforeAt = visiblePartBefore.Substring(0, visibleLength - 1) + "***" + visiblePartBefore.Last();
// 组合隐藏和可见部分
string hiddenEmail = hiddenPartBeforeAt + "@" + afterAt;
return hiddenEmail;
}
/// <summary>
/// 密码必须包含18 32 个字符2至少1个数字3) 至少1个大写字母4至少1个小写字母5至少1个特殊字符 (~!-@#$%^&*_+?)
/// </summary>
/// <returns></returns>
public static string GenerateRandomPassword(int length)
{
// 必须包含的字符组
const string numbers = "0123456789";
const string upperCaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string lowerCaseLetters = "abcdefghijklmnopqrstuvwxyz";
const string specialCharacters = "~!-@#$%^&*_+?";
// 随机选择至少一个字符
char[] requiredCharacters =
{ {
numbers[Random.Next(numbers.Length)],
upperCaseLetters[Random.Next(upperCaseLetters.Length)],
lowerCaseLetters[Random.Next(lowerCaseLetters.Length)],
specialCharacters[Random.Next(specialCharacters.Length)]
};
// 找到 "@" 符号的位置 // 构建剩余的字符集,用于填充密码的其余部分
int atIndex = email.IndexOf('@'); string allCharacters = numbers + upperCaseLetters + lowerCaseLetters + specialCharacters;
string visiblePartBefore = email.Substring(0, atIndex); // 确保密码长度满足用户要求
char[] password = new char[length];
string afterAt = email.Substring(atIndex + 1); // 将必须包含的字符放入密码中
requiredCharacters.CopyTo(password, 0);
int visibleLength = (int)Math.Ceiling((double)visiblePartBefore.Length * 2 / 3); // 填充剩余的字符
for (int i = requiredCharacters.Length; i < length; i++)
// 替换中间两位字符为星号 {
string hiddenPartBeforeAt = visiblePartBefore.Substring(0, visibleLength - 1) + "***" + visiblePartBefore.Last(); password[i] = allCharacters[Random.Next(allCharacters.Length)];
// 组合隐藏和可见部分
string hiddenEmail = hiddenPartBeforeAt + "@" + afterAt;
return hiddenEmail;
} }
/// <summary> // 随机打乱密码字符顺序
/// 密码必须包含18 32 个字符2至少1个数字3) 至少1个大写字母4至少1个小写字母5至少1个特殊字符 (~!-@#$%^&*_+?) return new string(password.OrderBy(_ => Random.Next()).ToArray());
/// </summary>
/// <returns></returns>
public static string GenerateRandomPassword(int length)
{
// 必须包含的字符组
const string numbers = "0123456789";
const string upperCaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string lowerCaseLetters = "abcdefghijklmnopqrstuvwxyz";
const string specialCharacters = "~!-@#$%^&*_+?";
// 随机选择至少一个字符
char[] requiredCharacters =
{
numbers[Random.Next(numbers.Length)],
upperCaseLetters[Random.Next(upperCaseLetters.Length)],
lowerCaseLetters[Random.Next(lowerCaseLetters.Length)],
specialCharacters[Random.Next(specialCharacters.Length)]
};
// 构建剩余的字符集,用于填充密码的其余部分
string allCharacters = numbers + upperCaseLetters + lowerCaseLetters + specialCharacters;
// 确保密码长度满足用户要求
char[] password = new char[length];
// 将必须包含的字符放入密码中
requiredCharacters.CopyTo(password, 0);
// 填充剩余的字符
for (int i = requiredCharacters.Length; i < length; i++)
{
password[i] = allCharacters[Random.Next(allCharacters.Length)];
}
// 随机打乱密码字符顺序
return new string(password.OrderBy(_ => Random.Next()).ToArray());
}
} }
} }

View File

@ -1,10 +1,8 @@
 
using FellowOakDicom.Imaging; using FellowOakDicom.Imaging;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp; using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing;
using System.Security.Cryptography;
using System.Text;
namespace IRaCIS.Core.Application.Helper; namespace IRaCIS.Core.Application.Helper;

View File

@ -4,211 +4,204 @@ using IRaCIS.Core.Infrastructure;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static IRaCIS.Core.Application.Service.Common.SystemMonitor;
namespace IRaCIS.Core.Application.Helper namespace IRaCIS.Core.Application.Helper;
public static class InternationalizationHelper
{ {
public static class InternationalizationHelper public static string JsonFileFolder = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources);
public static FileSystemWatcher FileSystemWatcher_US { get; set; }
public static FileSystemWatcher FileSystemWatcher_CN { get; set; }
private static void VerifyFolder()
{ {
public static string JsonFileFolder = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources); if (!Directory.Exists(JsonFileFolder) ||
!Directory.GetFiles(JsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)))
public static FileSystemWatcher FileSystemWatcher_US { get; set; }
public static FileSystemWatcher FileSystemWatcher_CN { get; set; }
private static void VerifyFolder()
{ {
if (!Directory.Exists(JsonFileFolder) || throw new BusinessValidationFailedException("国际化Json文件目录有误");
!Directory.GetFiles(JsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)))
{
throw new BusinessValidationFailedException("国际化Json文件目录有误");
}
} }
}
public static async Task BatchAddJsonKeyValueAsync(List<BatchAddInternationalizationDto> batchAddDtos) public static async Task BatchAddJsonKeyValueAsync(List<BatchAddInternationalizationDto> batchAddDtos)
{
VerifyFolder();
var usJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json);
var cnJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
//更新json 文件 同时更新内存缓存的数据
foreach (var filePath in new string[] { usJsonPath, cnJsonPath })
{ {
VerifyFolder(); var json = await File.ReadAllTextAsync(filePath);
var usJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json); JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
var cnJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
// 添加或更新指定的键值对
//更新json 文件 同时更新内存缓存的数据 if (filePath.Contains(StaticData.En_US_Json))
foreach (var filePath in new string[] { usJsonPath, cnJsonPath })
{ {
var json = await File.ReadAllTextAsync(filePath); foreach (var item in batchAddDtos)
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// 添加或更新指定的键值对
if (filePath.Contains(StaticData.En_US_Json))
{ {
foreach (var item in batchAddDtos) jsonObject[item.Code] = item.Value;
{
jsonObject[item.Code] = item.Value;
StaticData.En_US_Dic[item.Code] = item.Value; StaticData.En_US_Dic[item.Code] = item.Value;
//日志记录该信息方便自己人看, 返回给客户的是配置的
StaticData.Log_Locoalize_Dic[item.Code] = item.Description;
}
}
else
{
foreach (var item in batchAddDtos)
{
jsonObject[item.Code] = item.Value;
StaticData.Zh_CN_Dic[item.Code] = item.Value;
}
}
await File.WriteAllTextAsync(filePath, jsonObject.ToString());
}
}
public static async Task AddOrUpdateJsonKeyValueAsync(string key, string value, string valueCN,string description)
{
VerifyFolder();
var usJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json);
var cnJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
//更新json 文件 同时更新内存缓存的数据
foreach (var filePath in new string[] { usJsonPath, cnJsonPath })
{
var json = await File.ReadAllTextAsync(filePath);
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// 添加或更新指定的键值对
if (filePath.Contains(StaticData.En_US_Json))
{
jsonObject[key] = value;
StaticData.En_US_Dic[key] = value;
//日志记录该信息方便自己人看, 返回给客户的是配置的 //日志记录该信息方便自己人看, 返回给客户的是配置的
StaticData.Log_Locoalize_Dic[key] = description; StaticData.Log_Locoalize_Dic[item.Code] = item.Description;
} }
else }
else
{
foreach (var item in batchAddDtos)
{ {
jsonObject[key] = valueCN; jsonObject[item.Code] = item.Value;
StaticData.Zh_CN_Dic[key] = valueCN; StaticData.Zh_CN_Dic[item.Code] = item.Value;
} }
await File.WriteAllTextAsync(filePath, jsonObject.ToString());
} }
await File.WriteAllTextAsync(filePath, jsonObject.ToString());
} }
}
public static async Task AddOrUpdateJsonKeyValueAsync(string key, string value, string valueCN, string description)
{
VerifyFolder();
var usJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json);
var cnJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
public static async Task InitInternationlizationDataAndWatchJsonFileAsync(IRepository<Internationalization> _internationalizationRepository) //更新json 文件 同时更新内存缓存的数据
foreach (var filePath in new string[] { usJsonPath, cnJsonPath })
{ {
//查询数据库的数据 var json = await File.ReadAllTextAsync(filePath);
var toJsonList = await _internationalizationRepository.Where(t => t.InternationalizationType == 1).Select(t => new
JObject jsonObject = JObject.Parse(json, new JsonLoadSettings() { CommentHandling = CommentHandling.Load });
// 添加或更新指定的键值对
if (filePath.Contains(StaticData.En_US_Json))
{ {
t.Code, jsonObject[key] = value;
t.Value,
t.ValueCN,
t.Description
}).ToListAsync();
//组织成json 文件 StaticData.En_US_Dic[key] = value;
var usJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json);
var cnJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
//本地静态文件国际化需要
foreach (var tojsonItem in toJsonList)
{
StaticData.En_US_Dic[tojsonItem.Code] = tojsonItem.Value;
StaticData.Zh_CN_Dic[tojsonItem.Code] = tojsonItem.ValueCN;
//日志记录该信息方便自己人看, 返回给客户的是配置的 //日志记录该信息方便自己人看, 返回给客户的是配置的
StaticData.Log_Locoalize_Dic[tojsonItem.Code] = tojsonItem.Description; StaticData.Log_Locoalize_Dic[key] = description;
} }
else
File.WriteAllText(usJsonPath, JsonConvert.SerializeObject(StaticData.En_US_Dic));
File.WriteAllText(cnJsonPath, JsonConvert.SerializeObject(StaticData.Zh_CN_Dic));
//监测Json文件变更 实时刷新数据
if (!File.Exists(usJsonPath) || !File.Exists(cnJsonPath))
{ {
throw new BusinessValidationFailedException(StaticData.International("IRaCISCHangfireJob_FileNotFound")); jsonObject[key] = valueCN;
StaticData.Zh_CN_Dic[key] = valueCN;
} }
// //监测Json文件变更 实时刷新数据 await File.WriteAllTextAsync(filePath, jsonObject.ToString());
FileSystemWatcher_US = new FileSystemWatcher
{
Path = Path.GetDirectoryName(usJsonPath)!,
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size,
Filter = Path.GetFileName(usJsonPath),
EnableRaisingEvents = true,
};
// 添加文件更改事件的处理程序
FileSystemWatcher_US.Changed += (sender, e) => LoadJsonFile(StaticData.Folder.Resources + "\\" + StaticData.En_US_Json);
FileSystemWatcher_CN = new FileSystemWatcher
{
Path = Path.GetDirectoryName(cnJsonPath)!,
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size,
Filter = Path.GetFileName(cnJsonPath),
EnableRaisingEvents = true,
};
FileSystemWatcher_CN.Changed += (sender, e) => LoadJsonFile(StaticData.Folder.Resources + "\\" + StaticData.Zh_CN_Json);
} }
private static void LoadJsonFile(string filePath)
{
Console.WriteLine("刷新json内存数据");
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(filePath, false, false);
IConfigurationRoot enConfiguration = builder.Build();
foreach (IConfigurationSection section in enConfiguration.GetChildren())
{
if (filePath.Contains(StaticData.En_US_Json))
{
StaticData.En_US_Dic[section.Key] = section.Value;
}
else
{
StaticData.Zh_CN_Dic[section.Key] = section.Value;
}
}
}
} }
public static async Task InitInternationlizationDataAndWatchJsonFileAsync(IRepository<Internationalization> _internationalizationRepository)
{
//查询数据库的数据
var toJsonList = await _internationalizationRepository.Where(t => t.InternationalizationType == 1).Select(t => new
{
t.Code,
t.Value,
t.ValueCN,
t.Description
}).ToListAsync();
//组织成json 文件
var usJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json);
var cnJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json);
//本地静态文件国际化需要
foreach (var tojsonItem in toJsonList)
{
StaticData.En_US_Dic[tojsonItem.Code] = tojsonItem.Value;
StaticData.Zh_CN_Dic[tojsonItem.Code] = tojsonItem.ValueCN;
//日志记录该信息方便自己人看, 返回给客户的是配置的
StaticData.Log_Locoalize_Dic[tojsonItem.Code] = tojsonItem.Description;
}
File.WriteAllText(usJsonPath, JsonConvert.SerializeObject(StaticData.En_US_Dic));
File.WriteAllText(cnJsonPath, JsonConvert.SerializeObject(StaticData.Zh_CN_Dic));
//监测Json文件变更 实时刷新数据
if (!File.Exists(usJsonPath) || !File.Exists(cnJsonPath))
{
throw new BusinessValidationFailedException(StaticData.International("IRaCISCHangfireJob_FileNotFound"));
}
// //监测Json文件变更 实时刷新数据
FileSystemWatcher_US = new FileSystemWatcher
{
Path = Path.GetDirectoryName(usJsonPath)!,
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size,
Filter = Path.GetFileName(usJsonPath),
EnableRaisingEvents = true,
};
// 添加文件更改事件的处理程序
FileSystemWatcher_US.Changed += (sender, e) => LoadJsonFile(StaticData.Folder.Resources + "\\" + StaticData.En_US_Json);
FileSystemWatcher_CN = new FileSystemWatcher
{
Path = Path.GetDirectoryName(cnJsonPath)!,
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size,
Filter = Path.GetFileName(cnJsonPath),
EnableRaisingEvents = true,
};
FileSystemWatcher_CN.Changed += (sender, e) => LoadJsonFile(StaticData.Folder.Resources + "\\" + StaticData.Zh_CN_Json);
}
private static void LoadJsonFile(string filePath)
{
Console.WriteLine("刷新json内存数据");
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(filePath, false, false);
IConfigurationRoot enConfiguration = builder.Build();
foreach (IConfigurationSection section in enConfiguration.GetChildren())
{
if (filePath.Contains(StaticData.En_US_Json))
{
StaticData.En_US_Dic[section.Key] = section.Value;
}
else
{
StaticData.Zh_CN_Dic[section.Key] = section.Value;
}
}
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,7 @@
using DocumentFormat.OpenXml.Spreadsheet; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Domain.Share;
using MailKit; using MailKit;
using MailKit.Security; using MailKit.Security;
using MimeKit; using MimeKit;
using NPOI.HPSF;
namespace IRaCIS.Core.Application.Helper; namespace IRaCIS.Core.Application.Helper;
@ -44,7 +42,7 @@ public static class SendEmailHelper
{ {
//---邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员 //---邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员
throw new Exception(StaticData.International("SendEmail_SendFail"),new Exception(ex.Message)); throw new Exception(StaticData.International("SendEmail_SendFail"), new Exception(ex.Message));
} }

View File

@ -1,101 +1,95 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using NPOI.XWPF.UserModel; using NPOI.XWPF.UserModel;
using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xceed.Document.NET; using Xceed.Document.NET;
using Xceed.Words.NET; using Xceed.Words.NET;
namespace IRaCIS.Core.Application.Helper namespace IRaCIS.Core.Application.Helper;
/// <summary>
/// 利用DocX 库 处理word国际化模板
/// </summary>
public static class WordTempleteHelper
{ {
/// <summary> public static void DocX_GetInternationalTempleteStream(string filePath, Stream memoryStream)
/// 利用DocX 库 处理word国际化模板
/// </summary>
public static class WordTempleteHelper
{ {
public static void DocX_GetInternationalTempleteStream(string filePath, Stream memoryStream)
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
using (DocX document = DocX.Load(filePath))
{ {
// 查找书签
var bookmarkEn_Start = document.Bookmarks.FirstOrDefault(b => b.Name == StaticData.CultureInfo.en_US_bookMark);
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US; if (bookmarkEn_Start != null)
using (DocX document = DocX.Load(filePath))
{ {
// 查找书签 // 获取书签的起始位置
var bookmarkEn_Start = document.Bookmarks.FirstOrDefault(b => b.Name == StaticData.CultureInfo.en_US_bookMark); //int bookmarkCNStartPos = bookmarkCn_Start.Paragraph.StartIndex;
if (bookmarkEn_Start != null) var bookmarkENStartPos = bookmarkEn_Start.Paragraph.StartIndex;
// 创建一个要删除段落的列表
List<Paragraph> paragraphsToRemove = new List<Paragraph>();
foreach (var item in document.Paragraphs)
{ {
// 获取书签的起始位置 //中文模板在前,英文在后,英文模板,就删除英文之前的,中文模板就删除英文之后的
//int bookmarkCNStartPos = bookmarkCn_Start.Paragraph.StartIndex;
var bookmarkENStartPos = bookmarkEn_Start.Paragraph.StartIndex; if (isEn_US ? item.EndIndex < bookmarkENStartPos : item.StartIndex >= bookmarkENStartPos)
// 创建一个要删除段落的列表
List<Paragraph> paragraphsToRemove = new List<Paragraph>();
foreach (var item in document.Paragraphs)
{ {
//中文模板在前,英文在后,英文模板,就删除英文之前的,中文模板就删除英文之后的 paragraphsToRemove.Add(item);
if (isEn_US ? item.EndIndex < bookmarkENStartPos : item.StartIndex >= bookmarkENStartPos)
{
paragraphsToRemove.Add(item);
}
} }
foreach (var paragraph in paragraphsToRemove)
{
document.RemoveParagraph(paragraph);
}
} }
// 保存修改 foreach (var paragraph in paragraphsToRemove)
document.SaveAs(memoryStream);
}
}
public static void Npoi_GetInternationalTempleteStream(string filePath, Stream memoryStream)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
XWPFDocument doc = new XWPFDocument(fs);
// 查找包含指定书签的段落及其索引
var bookmarkParagraph = doc.Paragraphs
.FirstOrDefault(p => p.GetCTP().GetBookmarkStartList().Any(b => b.name == StaticData.CultureInfo.en_US_bookMark));
if (bookmarkParagraph != null)
{ {
int bookmarkIndex = doc.Paragraphs.IndexOf(bookmarkParagraph); document.RemoveParagraph(paragraph);
if (isEn_US)
{
// 从书签所在段落开始,删除之前的所有段落
for (int i = bookmarkIndex - 1; i >= 0; i--)
{
doc.RemoveBodyElement(i);
}
}
else
{
// 删除书签之后的所有段落
for (int i = doc.Paragraphs.Count - 1; i >= bookmarkIndex; i--)
{
doc.RemoveBodyElement(i);
}
}
} }
doc.Write(memoryStream);
}
}
}
// 保存修改
document.SaveAs(memoryStream);
}
} }
public static void Npoi_GetInternationalTempleteStream(string filePath, Stream memoryStream)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
XWPFDocument doc = new XWPFDocument(fs);
// 查找包含指定书签的段落及其索引
var bookmarkParagraph = doc.Paragraphs
.FirstOrDefault(p => p.GetCTP().GetBookmarkStartList().Any(b => b.name == StaticData.CultureInfo.en_US_bookMark));
if (bookmarkParagraph != null)
{
int bookmarkIndex = doc.Paragraphs.IndexOf(bookmarkParagraph);
if (isEn_US)
{
// 从书签所在段落开始,删除之前的所有段落
for (int i = bookmarkIndex - 1; i >= 0; i--)
{
doc.RemoveBodyElement(i);
}
}
else
{
// 删除书签之后的所有段落
for (int i = doc.Paragraphs.Count - 1; i >= bookmarkIndex; i--)
{
doc.RemoveBodyElement(i);
}
}
}
doc.Write(memoryStream);
}
}
} }

View File

@ -19,21 +19,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Using Include="IRaCIS.Core.Application;" />
<Using Include="AutoMapper.QueryableExtensions;" />
<Using Include="Microsoft.EntityFrameworkCore;" />
<Using Include="IRaCIS.Core.Domain.Models;" />
<Using Include="IRaCIS.Core.Infrastructure.Extention;" />
<Using Include="IRaCIS.Core.Infra.EFCore;" />
<!-- Global using -->
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="WebAppConfig.cs" /> <Compile Remove="WebAppConfig.cs" />
</ItemGroup> </ItemGroup>

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,5 @@
using MiniExcelLibs.Attributes; using MiniExcelLibs.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.MassTransit.Command namespace IRaCIS.Core.Application.MassTransit.Command
{ {

View File

@ -5,12 +5,7 @@ using IRaCIS.Core.Domain.Share;
using MassTransit; using MassTransit;
using Microsoft.Extensions.Localization; using Microsoft.Extensions.Localization;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.MassTransit.Consumer namespace IRaCIS.Core.Application.MassTransit.Consumer
{ {

View File

@ -3,12 +3,10 @@
// 生成时间 2022-06-07 13:16:33 // 生成时间 2022-06-07 13:16:33
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using IRaCIS.Application.Contracts; using IRaCIS.Application.Contracts;
using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
@ -112,7 +110,8 @@ namespace IRaCIS.Core.Application.ViewModel
public List<CriterionReadingCategory> CriterionCategoryList => public List<CriterionReadingCategory> CriterionCategoryList =>
TrialReadingCriterionList.Select(t => TrialReadingCriterionList.Select(t =>
new CriterionReadingCategory() { new CriterionReadingCategory()
{
EnrollId = EnrollId, EnrollId = EnrollId,
TrialReadingCriterionId = t.TrialReadingCriterionId, TrialReadingCriterionId = t.TrialReadingCriterionId,
ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList() ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList()
@ -120,10 +119,10 @@ namespace IRaCIS.Core.Application.ViewModel
//CriterionReadingCategoryList.Count == 0 ? TrialReadingCriterionList.Select(t => new CriterionReadingCategory() { EnrollId = EnrollId, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList() : //CriterionReadingCategoryList.Count == 0 ? TrialReadingCriterionList.Select(t => new CriterionReadingCategory() { EnrollId = EnrollId, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList() :
// CriterionReadingCategoryList // CriterionReadingCategoryList
//.GroupBy(t => new { t.TrialReadingCriterionId, t.EnrollId }) //.GroupBy(t => new { t.TrialReadingCriterionId, t.EnrollId })
//.Select(g => new CriterionReadingCategory() { EnrollId = g.Key.EnrollId, TrialReadingCriterionId = g.Key.TrialReadingCriterionId, ReadingCategorys = g.Select(t => t.ReadingCategory).OrderBy(t=>t).ToList() }).ToList(); //.Select(g => new CriterionReadingCategory() { EnrollId = g.Key.EnrollId, TrialReadingCriterionId = g.Key.TrialReadingCriterionId, ReadingCategorys = g.Select(t => t.ReadingCategory).OrderBy(t=>t).ToList() }).ToList();
} }

View File

@ -3,9 +3,7 @@
// 生成时间 2022-07-01 15:33:01 // 生成时间 2022-07-01 15:33:01
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -81,7 +79,7 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid DoctorUserId { get; set; } public Guid DoctorUserId { get; set; }
} }
public class ConsistentConfirmGenerateCommand: SelfConsistentSimpleQuery public class ConsistentConfirmGenerateCommand : SelfConsistentSimpleQuery
{ {
@ -104,7 +102,7 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsAutoAllocateGenerateTask { get; set; } public bool IsAutoAllocateGenerateTask { get; set; }
} }
public class DoctorSelfConsistentSubjectView: ConsistentCommonView public class DoctorSelfConsistentSubjectView : ConsistentCommonView
{ {
public string FirstGlobalVisitName { get; set; } = string.Empty; public string FirstGlobalVisitName { get; set; } = string.Empty;
public string? BlindSubjectCode { get; set; } public string? BlindSubjectCode { get; set; }
@ -130,14 +128,14 @@ namespace IRaCIS.Core.Application.ViewModel
public int? ValidVisitCount { get; set; } public int? ValidVisitCount { get; set; }
} }
public class DoctorGroupConsistentSubjectView: ConsistentCommonView public class DoctorGroupConsistentSubjectView : ConsistentCommonView
{ {
public List<VisitTaskGroupSimpleDTO> SubjectTaskVisitList => VisitTaskList.GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Select(g => g.First()).OrderBy(t=>t.VisitTaskNum).ToList(); public List<VisitTaskGroupSimpleDTO> SubjectTaskVisitList => VisitTaskList.GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Select(g => g.First()).OrderBy(t => t.VisitTaskNum).ToList();
public List<VisitTaskGroupSimpleDTO> VisitTaskList { get; set; } = new List<VisitTaskGroupSimpleDTO>(); public List<VisitTaskGroupSimpleDTO> VisitTaskList { get; set; } = new List<VisitTaskGroupSimpleDTO>();
public List<UserSimpleInfo> DoctorUserList { get; set; }=new List<UserSimpleInfo>(); public List<UserSimpleInfo> DoctorUserList { get; set; } = new List<UserSimpleInfo>();
} }
public class VisitTaskGroupSimpleDTO public class VisitTaskGroupSimpleDTO
@ -175,7 +173,7 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsClinicalDataSign { get; set; } public bool IsClinicalDataSign { get; set; }
} }
public class VisitTaskSimpleDTO :VisitTaskGroupSimpleDTO public class VisitTaskSimpleDTO : VisitTaskGroupSimpleDTO
{ {
public Guid? Id { get; set; } public Guid? Id { get; set; }
@ -289,7 +287,7 @@ namespace IRaCIS.Core.Application.ViewModel
public class GetConsistentRuleOut public class GetConsistentRuleOut
{ {
public TaskConsistentRuleBasic? ConsistentRuleBasic { get; set; } public TaskConsistentRuleBasic? ConsistentRuleBasic { get; set; }
/// <summary> /// <summary>
/// 任务展示访视 读片任务显示是否顺序 /// 任务展示访视 读片任务显示是否顺序
/// </summary> /// </summary>
@ -316,7 +314,7 @@ namespace IRaCIS.Core.Application.ViewModel
public string VirtualSiteCode { get; set; } public string VirtualSiteCode { get; set; }
} }
public class UpdateTrialSiteCodeCommandView: UpdateTrialSiteCodeCommand public class UpdateTrialSiteCodeCommandView : UpdateTrialSiteCodeCommand
{ {
public DateTime Creatime { get; set; } public DateTime Creatime { get; set; }
} }

View File

@ -3,11 +3,8 @@
// 生成时间 2022-06-29 13:36:46 // 生成时间 2022-06-29 13:36:46
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {

View File

@ -3,9 +3,7 @@
// 生成时间 2022-06-29 10:59:50 // 生成时间 2022-06-29 10:59:50
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
@ -69,7 +67,7 @@ namespace IRaCIS.Core.Application.ViewModel
{ {
if (!ReadingDurationTimeSpan.HasValue) if (!ReadingDurationTimeSpan.HasValue)
return ""; return "";
else return string.Format("{0}h:{1}m:{2}s", (SignTime - FirstReadingTime)?.Hours, (SignTime - FirstReadingTime)?.Minutes, (SignTime - FirstReadingTime)?.Seconds) else return string.Format("{0}h:{1}m:{2}s", (SignTime - FirstReadingTime)?.Hours, (SignTime - FirstReadingTime)?.Minutes, (SignTime - FirstReadingTime)?.Seconds)
/*string.Format("{0}分钟", (ReadingDurationTimeSpan)?.TotalMinutes)*/; /*string.Format("{0}分钟", (ReadingDurationTimeSpan)?.TotalMinutes)*/;
} }
} }
@ -102,18 +100,18 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid? SubjectId { get; set; } public Guid? SubjectId { get; set; }
public Guid? MedicalManagerUserId { get; set; } public Guid? MedicalManagerUserId { get; set; }
public DateTime? BeginSignTime { get; set; } public DateTime? BeginSignTime { get; set; }
public AuditAdvice? AuditAdviceEnum { get; set; } public AuditAdvice? AuditAdviceEnum { get; set; }
public DateTime? EndSignTime { get; set; } public DateTime? EndSignTime { get; set; }
public bool IsGetBeRead { get; set; } = false; public bool IsGetBeRead { get; set; } = false;
public bool IsGetNextMedicalReviewTask { get; set; } = false; public bool IsGetNextMedicalReviewTask { get; set; } = false;
public string SubjectCode { get; set; } = String.Empty; public string SubjectCode { get; set; } = String.Empty;
public string TrialSiteCode { get; set; } = String.Empty; public string TrialSiteCode { get; set; } = String.Empty;
public string TaskName { get; set; } = String.Empty; public string TaskName { get; set; } = String.Empty;
@ -133,7 +131,7 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid? TrialReadingCriterionId { get; set; } public Guid? TrialReadingCriterionId { get; set; }
public MedicalReviewDoctorUserIdea? DoctorUserIdeaEnum { get; set; } public MedicalReviewDoctorUserIdea? DoctorUserIdeaEnum { get; set; }
public Arm? ArmEnum { get; set; } public Arm? ArmEnum { get; set; }

View File

@ -3,11 +3,9 @@
// 生成时间 2022-06-07 14:10:54 // 生成时间 2022-06-07 14:10:54
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
@ -163,7 +161,7 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsCanEditUrgentState { get; set; } public bool IsCanEditUrgentState { get; set; }
public DateTime? FirstReadingTime { get;set; } public DateTime? FirstReadingTime { get; set; }
public string ReadingDuration public string ReadingDuration
{ {
@ -224,7 +222,7 @@ namespace IRaCIS.Core.Application.ViewModel
public int ConsistentClinicalDataCount { get; set; } = 0; public int ConsistentClinicalDataCount { get; set; } = 0;
public bool IsReReadingOrBackInfluenceAnalysis { get; set; } public bool IsReReadingOrBackInfluenceAnalysis { get; set; }
} }
@ -318,7 +316,7 @@ namespace IRaCIS.Core.Application.ViewModel
if (this.SuggesteFinishedTime != null) if (this.SuggesteFinishedTime != null)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var timeSpan = SuggesteFinishedTime.Value- date; var timeSpan = SuggesteFinishedTime.Value - date;
if (timeSpan.TotalDays <= 2) if (timeSpan.TotalDays <= 2)
{ {
return 1; return 1;
@ -339,12 +337,12 @@ namespace IRaCIS.Core.Application.ViewModel
} }
} }
public int UrgentCount { get; set; } public int UrgentCount { get; set; }
public List<IRUnreadTaskView> UnReadCanReadTaskList { get; set; } = new List<IRUnreadTaskView>(); public List<IRUnreadTaskView> UnReadCanReadTaskList { get; set; } = new List<IRUnreadTaskView>();
public List<IRUnreadTaskView> UnReadTaskList { get; set; } = new List<IRUnreadTaskView>(); public List<IRUnreadTaskView> UnReadTaskList { get; set; } = new List<IRUnreadTaskView>();
} }
public class IRUnreadTaskView public class IRUnreadTaskView
@ -391,13 +389,13 @@ namespace IRaCIS.Core.Application.ViewModel
} }
public class GetReadingIQueryableInDto:PageInput public class GetReadingIQueryableInDto : PageInput
{ {
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
public Guid? SubjectId { get; set; } public Guid? SubjectId { get; set; }
public Guid TrialReadingCriterionId { get; set; } public Guid TrialReadingCriterionId { get; set; }
public string? SubjectCode { get; set; } = null; public string? SubjectCode { get; set; } = null;
@ -409,7 +407,7 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
public Guid? TrialSiteId { get; set; } public Guid? TrialSiteId { get; set; }
public Guid? SubjectId { get; set; } public Guid? SubjectId { get; set; }
@ -435,7 +433,7 @@ namespace IRaCIS.Core.Application.ViewModel
public DateTime? BeginSignTime { get; set; } public DateTime? BeginSignTime { get; set; }
public DateTime? EndSignTime { get; set; } public DateTime? EndSignTime { get; set; }
public DateTime? BeginRequestReReadingTime { get; set; } public DateTime? BeginRequestReReadingTime { get; set; }
public DateTime? EndRequestReReadingTime { get; set; } public DateTime? EndRequestReReadingTime { get; set; }
@ -553,7 +551,7 @@ namespace IRaCIS.Core.Application.ViewModel
public int? SubjectAllocateState { get; set; } public int? SubjectAllocateState { get; set; }
public List<Arm> ArmList { get; set; }=new List<Arm>() { }; public List<Arm> ArmList { get; set; } = new List<Arm>() { };
[NotDefault] [NotDefault]
public Guid TrialReadingCriterionId { get; set; } public Guid TrialReadingCriterionId { get; set; }

View File

@ -7,18 +7,18 @@
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces namespace IRaCIS.Core.Application.Interfaces
{ {
/// <summary> /// <summary>
/// ITaskAllocationRuleService /// ITaskAllocationRuleService
/// </summary> /// </summary>
public interface ITaskAllocationRuleService public interface ITaskAllocationRuleService
{ {
//Task<List<TaskAllocationRuleView>> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule); //Task<List<TaskAllocationRuleView>> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule);
Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule); Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule);
Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId); Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId);
} }

View File

@ -7,18 +7,18 @@
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces namespace IRaCIS.Core.Application.Interfaces
{ {
/// <summary> /// <summary>
/// ITaskConsistentRuleService /// ITaskConsistentRuleService
/// </summary> /// </summary>
public interface ITaskConsistentRuleService public interface ITaskConsistentRuleService
{ {
//Task<List<TaskConsistentRuleView>> GetTaskConsistentRuleList(TaskConsistentRuleQuery inQuery); //Task<List<TaskConsistentRuleView>> GetTaskConsistentRuleList(TaskConsistentRuleQuery inQuery);
Task<IResponseOutput> AddOrUpdateTaskConsistentRule(TaskConsistentRuleAddOrEdit addOrEditTaskConsistentRule); Task<IResponseOutput> AddOrUpdateTaskConsistentRule(TaskConsistentRuleAddOrEdit addOrEditTaskConsistentRule);
Task<IResponseOutput> DeleteTaskConsistentRule(Guid taskConsistentRuleId); Task<IResponseOutput> DeleteTaskConsistentRule(Guid taskConsistentRuleId);
} }

View File

@ -18,6 +18,6 @@ namespace IRaCIS.Core.Application.Service
Task AddConvertedTask(Guid taskId); Task AddConvertedTask(Guid taskId);
Task BaseCritrionGenerateVisitTask(Guid trialId, Guid confirmedTrialReadingCriterionId,bool? isManualSelectVisit=null,List<Guid>? subjectVisitIdList=null); Task BaseCritrionGenerateVisitTask(Guid trialId, Guid confirmedTrialReadingCriterionId, bool? isManualSelectVisit = null, List<Guid>? subjectVisitIdList = null);
} }
} }

View File

@ -4,13 +4,12 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Contracts;
using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Filter; using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {

View File

@ -4,23 +4,16 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Domain.Share;
using System.Linq.Expressions;
using IRaCIS.Core.Infra.EFCore.Common;
using System.Linq;
using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Filter;
using Medallion.Threading; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Infrastructure.Extention;
using System;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NPOI.SS.Formula.Functions;
using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
using Medallion.Threading;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
@ -114,7 +107,7 @@ namespace IRaCIS.Core.Application.Service
} }
#endregion #endregion
var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { IsHaveDoubleReadCriterion = t.TrialReadingCriterionList.Any(t => t.IsSigned && t.IsConfirm && t.ReadingType == ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault(); var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { IsHaveDoubleReadCriterion = t.TrialReadingCriterionList.Any(t => t.IsSigned && t.IsConfirm && t.ReadingType == ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault();
return ResponseOutput.Ok(pageList, trialTaskConfig); return ResponseOutput.Ok(pageList, trialTaskConfig);
} }

View File

@ -4,11 +4,10 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Filter;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Filter; using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
@ -24,16 +23,16 @@ namespace IRaCIS.Core.Application.Service
[HttpPost] [HttpPost]
public async Task<(List<TaskMedicalReviewRuleView>,object)> GetTaskMedicalReviewRuleList(TaskMedicalReviewRuleQuery inQuery) public async Task<(List<TaskMedicalReviewRuleView>, object)> GetTaskMedicalReviewRuleList(TaskMedicalReviewRuleQuery inQuery)
{ {
var taskTaskMedicalReviewRuleQueryable = _taskMedicalReviewRuleRepository.Where(t => t.TrialId == inQuery.TrialId) var taskTaskMedicalReviewRuleQueryable = _taskMedicalReviewRuleRepository.Where(t => t.TrialId == inQuery.TrialId)
.ProjectTo<TaskMedicalReviewRuleView>(_mapper.ConfigurationProvider); .ProjectTo<TaskMedicalReviewRuleView>(_mapper.ConfigurationProvider);
var isHaveMIM = await _trialUserRepository.AnyAsync(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId==inQuery.TrialId); var isHaveMIM = await _trialUserRepository.AnyAsync(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == inQuery.TrialId);
return (await taskTaskMedicalReviewRuleQueryable.ToListAsync(),new {IsHaveMIM=isHaveMIM}); return (await taskTaskMedicalReviewRuleQueryable.ToListAsync(), new { IsHaveMIM = isHaveMIM });
} }
[HttpPost] [HttpPost]
@ -68,7 +67,7 @@ namespace IRaCIS.Core.Application.Service
// return ResponseOutput.NotOk(_localizer["TaskMedicalRule_TaskStarted"]); // return ResponseOutput.NotOk(_localizer["TaskMedicalRule_TaskStarted"]);
//} //}
var success = await _taskMedicalReviewRuleRepository.DeleteFromQueryAsync(t => t.Id == taskMedicalReviewRuleId,true); var success = await _taskMedicalReviewRuleRepository.DeleteFromQueryAsync(t => t.Id == taskMedicalReviewRuleId, true);
return ResponseOutput.Ok(); return ResponseOutput.Ok();
} }

View File

@ -4,14 +4,12 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Filter;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Infrastructure;
using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
@ -41,7 +39,7 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId) .WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId) .WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode)) .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName)) .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
.WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent) .WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent)
.WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId) .WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId)
@ -50,13 +48,13 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState) .WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState)
.WhereIf(inQuery.ArmEnum != null, t => t.VisitTask.ArmEnum == inQuery.ArmEnum) .WhereIf(inQuery.ArmEnum != null, t => t.VisitTask.ArmEnum == inQuery.ArmEnum)
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState) .WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
.WhereIf(inQuery.MedicalManagerUserId != null, t => t.MedicalManagerUserId == inQuery.MedicalManagerUserId) .WhereIf(inQuery.MedicalManagerUserId != null, t => t.MedicalManagerUserId == inQuery.MedicalManagerUserId)
.WhereIf(inQuery.BeginSignTime != null, t => t.VisitTask.SignTime > inQuery.BeginSignTime) .WhereIf(inQuery.BeginSignTime != null, t => t.VisitTask.SignTime > inQuery.BeginSignTime)
.WhereIf(inQuery.EndSignTime != null, t => t.VisitTask.SignTime < inQuery.EndSignTime) .WhereIf(inQuery.EndSignTime != null, t => t.VisitTask.SignTime < inQuery.EndSignTime)
.WhereIf(inQuery.AuditAdviceEnum != null, t => t.AuditAdviceEnum == inQuery.AuditAdviceEnum) .WhereIf(inQuery.AuditAdviceEnum != null, t => t.AuditAdviceEnum == inQuery.AuditAdviceEnum)
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum) .WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid) .WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
.WhereIf(inQuery.IsHaveQuestion != null, t => t.IsHaveQuestion == inQuery.IsHaveQuestion) .WhereIf(inQuery.IsHaveQuestion != null, t => t.IsHaveQuestion == inQuery.IsHaveQuestion)
@ -64,9 +62,9 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate) .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate)
.WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime) .WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime)
.WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime) .WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime)
.ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider); .ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider);
var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.AuditState), nameof(TaskMedicalReviewView.SubjectCode), nameof(TaskMedicalReviewView.ArmEnum) , nameof(TaskMedicalReviewView.VisitTaskNum) }; var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.AuditState), nameof(TaskMedicalReviewView.SubjectCode), nameof(TaskMedicalReviewView.ArmEnum), nameof(TaskMedicalReviewView.VisitTaskNum) };
var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery, defalutSortArray); var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery, defalutSortArray);
return pageList; return pageList;
@ -82,7 +80,7 @@ namespace IRaCIS.Core.Application.Service
public async Task<PageOutput<GenerateMedicalReviewTaskView>> GetGenerateMedicalReviewTaskList(GenerateMedicalReviewTaskQuery inQuery) public async Task<PageOutput<GenerateMedicalReviewTaskView>> GetGenerateMedicalReviewTaskList(GenerateMedicalReviewTaskQuery inQuery)
{ {
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId) var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId)
.Where(t => t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect||t.TaskState==TaskState.Freeze) && t.ReadingTaskState == ReadingTaskState.HaveSigned) .Where(t => t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) && t.ReadingTaskState == ReadingTaskState.HaveSigned)
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
@ -161,16 +159,16 @@ namespace IRaCIS.Core.Application.Service
var result = new TaskMedicalReviewView() { }; var result = new TaskMedicalReviewView() { };
if (index+1 == data.CurrentPageData.Count()) // 最后一个 if (index + 1 == data.CurrentPageData.Count()) // 最后一个
{ {
throw new BusinessValidationFailedException(_localizer["MedicalReview_Finish"]); throw new BusinessValidationFailedException(_localizer["MedicalReview_Finish"]);
} }
else if (index == -1 || data.CurrentPageData.Count == 1) // 第一个或者只有一个 else if (index == -1 || data.CurrentPageData.Count == 1) // 第一个或者只有一个
{ {
if (data.CurrentPageData[0].Id == inDto.MedicalReviewId) if (data.CurrentPageData[0].Id == inDto.MedicalReviewId)
{ {
throw new BusinessValidationFailedException(_localizer["MedicalReview_Finish"]); throw new BusinessValidationFailedException(_localizer["MedicalReview_Finish"]);
} }
result = data.CurrentPageData[0]; result = data.CurrentPageData[0];
} }
else else
@ -183,8 +181,8 @@ namespace IRaCIS.Core.Application.Service
} }
else else
{ {
throw new BusinessValidationFailedException(_localizer["MedicalReview_Finish"]); throw new BusinessValidationFailedException(_localizer["MedicalReview_Finish"]);
} }
} }
@ -196,34 +194,34 @@ namespace IRaCIS.Core.Application.Service
/// <param name="inQuery"></param> /// <param name="inQuery"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task<IResponseOutput< PageOutput<TaskMedicalReviewView>>> GetMIMMedicalReviewTaskList(TaskMedicalReviewQuery inQuery) public async Task<IResponseOutput<PageOutput<TaskMedicalReviewView>>> GetMIMMedicalReviewTaskList(TaskMedicalReviewQuery inQuery)
{ {
var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.Id&&t.VisitTask.TrialReadingCriterionId==inQuery.TrialReadingCriterionId) var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.Id && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.IsGetNextMedicalReviewTask, .WhereIf(inQuery.IsGetNextMedicalReviewTask,
x=>( x => (
!x.IsInvalid&& x.AuditState== MedicalReviewAuditState.Auditing & !x.IsInvalid && x.AuditState == MedicalReviewAuditState.Auditing &
( x.ReadingMedicalReviewDialogList.Count()!=0&& (x.ReadingMedicalReviewDialogList.Count() != 0 &&
x.ReadingMedicalReviewDialogList.Count()>0&& x.ReadingMedicalReviewDialogList.Count() > 0 &&
x.ReadingMedicalReviewDialogList.OrderByDescending(x=>x.CreateTime).FirstOrDefault().UserTypeEnumInt==(int)UserTypeEnum.IndependentReviewer) x.ReadingMedicalReviewDialogList.OrderByDescending(x => x.CreateTime).FirstOrDefault().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer)
) // 审核中最新回复为IR的 ) // 审核中最新回复为IR的
|| (!x.IsInvalid&& x.AuditState==MedicalReviewAuditState.WaitAudit) || (!x.IsInvalid && x.AuditState == MedicalReviewAuditState.WaitAudit)
||x.Id == inQuery.Id // 这里必须找传入id 因为要找到这条的索引 获取下一条 || x.Id == inQuery.Id // 这里必须找传入id 因为要找到这条的索引 获取下一条
) )
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId) .WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
.WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId) .WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent) .WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent)
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState) .WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum) .WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
.WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState) .WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState)
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode)) .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName)) .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
.WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId) .WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId)
.WhereIf(inQuery.ReadingCategory != null, t => t.VisitTask.ReadingCategory == inQuery.ReadingCategory) .WhereIf(inQuery.ReadingCategory != null, t => t.VisitTask.ReadingCategory == inQuery.ReadingCategory)
.WhereIf(inQuery.ReadingTaskState != null, t => t.VisitTask.ReadingTaskState == inQuery.ReadingTaskState) .WhereIf(inQuery.ReadingTaskState != null, t => t.VisitTask.ReadingTaskState == inQuery.ReadingTaskState)
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid) .WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
.WhereIf(inQuery.IsGetBeRead,x=>!x.IsInvalid&&x.AuditState!= MedicalReviewAuditState.HaveSigned) .WhereIf(inQuery.IsGetBeRead, x => !x.IsInvalid && x.AuditState != MedicalReviewAuditState.HaveSigned)
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime) .WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime)
.WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime) .WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime)
@ -239,10 +237,10 @@ namespace IRaCIS.Core.Application.Service
.ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider); .ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider);
var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.SubjectCode), nameof(TaskMedicalReviewView.ArmEnum), nameof(TaskMedicalReviewView.VisitTaskNum) }; var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.SubjectCode), nameof(TaskMedicalReviewView.ArmEnum), nameof(TaskMedicalReviewView.VisitTaskNum) };
var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery, defalutSortArray); var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery, defalutSortArray);
return ResponseOutput.Ok(pageList, new return ResponseOutput.Ok(pageList, new
{ {
IsConfirmMedicineQuestion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).Select(x => x.IsConfirmMedicineQuestion).FirstOrDefaultAsync() IsConfirmMedicineQuestion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).Select(x => x.IsConfirmMedicineQuestion).FirstOrDefaultAsync()
@ -265,7 +263,7 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.NotOk(_localizer["TaskMedical_DirtyData"]); return ResponseOutput.NotOk(_localizer["TaskMedical_DirtyData"]);
} }
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => command.MedicalReviewIdList.Contains(t.Id), c => new TaskMedicalReview() { IsInvalid = true },true); await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => command.MedicalReviewIdList.Contains(t.Id), c => new TaskMedicalReview() { IsInvalid = true }, true);
return ResponseOutput.Ok(); return ResponseOutput.Ok();

View File

@ -4,20 +4,13 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Helper;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using AutoMapper;
using MassTransit;
using IRaCIS.Core.Infra.EFCore.Common;
using System.Linq.Expressions;
using IRaCIS.Core.Domain.Share.Reading; using IRaCIS.Core.Domain.Share.Reading;
using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Infra.EFCore.Common;
using System.Runtime.InteropServices; using MassTransit;
using IRaCIS.Core.Application.Helper; using Microsoft.AspNetCore.Mvc;
using ZiggyCreatures.Caching.Fusion; using ZiggyCreatures.Caching.Fusion;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
@ -136,7 +129,7 @@ namespace IRaCIS.Core.Application.Service
var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max(); var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max();
var cacheMaxCodeInt =_fusionCache.GetOrDefault<int>(CacheKeys.TrialStudyMaxCode(trialId)); var cacheMaxCodeInt = _fusionCache.GetOrDefault<int>(CacheKeys.TrialStudyMaxCode(trialId));
int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode; int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode;
@ -433,7 +426,7 @@ namespace IRaCIS.Core.Application.Service
//CRC 的自动签名 不用管 只用处理PM的就好 //CRC 的自动签名 不用管 只用处理PM的就好
var haveSignedCount = _readingClinicalDataRepository var haveSignedCount = _readingClinicalDataRepository
.Where(t => t.TrialId == trialId && t.IsSign .Where(t => t.TrialId == trialId && t.IsSign
&& t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(x=>x.TrialReadingCriterionId== trialReadingCriterionId) && t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(x => x.TrialReadingCriterionId == trialReadingCriterionId)
&& t.ReadingClinicalDataState == ReadingClinicalDataStatus.HaveSigned && t.ReadingId == readingId && t.ClinicalDataTrialSet.UploadRole == UploadRole.PM).Count(); && t.ReadingClinicalDataState == ReadingClinicalDataStatus.HaveSigned && t.ReadingId == readingId && t.ClinicalDataTrialSet.UploadRole == UploadRole.PM).Count();
@ -575,7 +568,7 @@ namespace IRaCIS.Core.Application.Service
var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max(); var dbMaxCode = _visitTaskRepository.Where(t => t.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max();
var cacheMaxCodeInt =_fusionCache.GetOrDefault<int>(CacheKeys.TrialStudyMaxCode(trialId)); var cacheMaxCodeInt = _fusionCache.GetOrDefault<int>(CacheKeys.TrialStudyMaxCode(trialId));
int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode; int currentMaxCodeInt = cacheMaxCodeInt > dbMaxCode ? cacheMaxCodeInt : dbMaxCode;
@ -1390,10 +1383,10 @@ namespace IRaCIS.Core.Application.Service
var firsttask = generateTaskCommand.GenerataConsistentTaskList[0]; var firsttask = generateTaskCommand.GenerataConsistentTaskList[0];
var clinicalDataList = _readingClinicalDataRepository.Where(t => t.SubjectId == subjectId var clinicalDataList = _readingClinicalDataRepository.Where(t => t.SubjectId == subjectId
&& t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(y => y.TrialReadingCriterionId == firsttask.TrialReadingCriterionId) && t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(y => y.TrialReadingCriterionId == firsttask.TrialReadingCriterionId)
&& t.ClinicalDataTrialSet.ClinicalDataLevel!= ClinicalLevel.Study && t.ClinicalDataTrialSet.ClinicalDataLevel != ClinicalLevel.Study
&& t.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF) && t.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF)
// crc受试者和访视的临床数据没上传 一致性分析的时候也不用显示 // crc受试者和访视的临床数据没上传 一致性分析的时候也不用显示
.Where(x=>x.ClinicalDataTrialSet.UploadRole == UploadRole.PM||x.FileCount>0) .Where(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.PM || x.FileCount > 0)
.Include(t => t.ReadingClinicalDataPDFList).Include(t => t.ClinicalDataTrialSet).ToList(); .Include(t => t.ReadingClinicalDataPDFList).Include(t => t.ClinicalDataTrialSet).ToList();
@ -1427,9 +1420,9 @@ namespace IRaCIS.Core.Application.Service
var exsitPDF = await _readingClinicalDataRepository var exsitPDF = await _readingClinicalDataRepository
.WhereIf(isReadingTaskViewInOrder== ReadingOrder.Random,t=>t.ReadingId== task.SouceReadModuleId|| t.ReadingId == task.SourceSubjectVisitId) .WhereIf(isReadingTaskViewInOrder == ReadingOrder.Random, t => t.ReadingId == task.SouceReadModuleId || t.ReadingId == task.SourceSubjectVisitId)
.AnyAsync(t => t.TrialId == trialId && .AnyAsync(t => t.TrialId == trialId &&
t.SubjectId== task.SubjectId&& t.SubjectId == task.SubjectId &&
t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == readingCriterionId) t.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == readingCriterionId)
&& t.ClinicalDataTrialSet.ClinicalDataLevel != ClinicalLevel.Study && t.ClinicalDataTrialSet.ClinicalDataLevel != ClinicalLevel.Study

View File

@ -4,24 +4,17 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Application.Contracts;
using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Infra.EFCore.Common;
using System.Linq.Expressions;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Filter;
using DocumentFormat.OpenXml.Office2010.Word;
using System.Linq.Dynamic.Core;
using System.Linq;
using DocumentFormat.OpenXml.Bibliography;
using IRaCIS.Core.Domain.Share.Reading; using IRaCIS.Core.Domain.Share.Reading;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
using MassTransit; using MassTransit;
using System.Reactive.Subjects; using Microsoft.AspNetCore.Mvc;
using System.Linq.Dynamic.Core;
using Subject = IRaCIS.Core.Domain.Models.Subject; using Subject = IRaCIS.Core.Domain.Models.Subject;
namespace IRaCIS.Core.Application.Service.Allocation; namespace IRaCIS.Core.Application.Service.Allocation;
@ -145,7 +138,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
.ProjectTo<SubjectAssignStat>(_mapper.ConfigurationProvider, new { trialReadingCriterionId = inQuery.TrialReadingCriterionId }); .ProjectTo<SubjectAssignStat>(_mapper.ConfigurationProvider, new { trialReadingCriterionId = inQuery.TrialReadingCriterionId });
var pageList = await subjectQuery.ToPagedListAsync(inQuery,nameof(SubjectAssignStat.SubjectId)); var pageList = await subjectQuery.ToPagedListAsync(inQuery, nameof(SubjectAssignStat.SubjectId));
@ -1205,7 +1198,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
.ToList() .ToList()
}).Where(x => x.UnReadCanReadTaskCount > 0); }).Where(x => x.UnReadCanReadTaskCount > 0);
var pageList = await visitTaskQuery.ToPagedListAsync(inQuery, nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) ); var pageList = await visitTaskQuery.ToPagedListAsync(inQuery, nameof(IRUnReadSubjectView.UnReadCanReadTaskCount));
return pageList; return pageList;
} }

View File

@ -1,8 +1,6 @@
using AutoMapper; using AutoMapper;
using IRaCIS.Application.Contracts; using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
@ -59,10 +57,10 @@ namespace IRaCIS.Core.Application.Service
: u.Trial.SubjectList.Where(t => subjectIdList.Contains(t.Id) && t.SubjectVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count() : u.Trial.SubjectList.Where(t => subjectIdList.Contains(t.Id) && t.SubjectVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
)) ))
//.ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u => //.ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u =>
//subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count() //subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count()
//: u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count() //: u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count()
// )) // ))
.ForMember(o => o.WaitApplyTotalTaskCount, t => t.MapFrom(u => .ForMember(o => o.WaitApplyTotalTaskCount, t => t.MapFrom(u =>
subjectIdList.Count == 0 ? u.Trial.VisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null).Count() subjectIdList.Count == 0 ? u.Trial.VisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null).Count()
@ -75,7 +73,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser)) .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser))
.ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }))) .ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId })))
.ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.TrialReadingCriterionList.Where(t => t.IsConfirm))) .ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.TrialReadingCriterionList.Where(t => t.IsConfirm)))
.ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId).OrderBy(t => t.ReadingCategory).Select(t => t.ReadingCategory).ToList())) .ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).OrderBy(t => t.ReadingCategory).Select(t => t.ReadingCategory).ToList()))
; ;
CreateMap<ReadingQuestionCriterionTrial, TrialReadingCriterionDto>() CreateMap<ReadingQuestionCriterionTrial, TrialReadingCriterionDto>()
@ -93,18 +91,18 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id)) .ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code))
.ForMember(o => o.VisitTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TrialReadingCriterionId==trialReadingCriterionId && t.TaskState==TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count())) .ForMember(o => o.VisitTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
.ForMember(o => o.GlobalTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count())) .ForMember(o => o.GlobalTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
.ForMember(o => o.OncologyTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count())) .ForMember(o => o.OncologyTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
.ForMember(o => o.JudgeTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count())) .ForMember(o => o.JudgeTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
.ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId))); .ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId)));
CreateMap<SubjectUser, SubjectUserView>() CreateMap<SubjectUser, SubjectUserView>()
.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser)); .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser));
CreateMap<SubjectUser, SubjectUserDTO>().IncludeBase<SubjectUser, SubjectUserView>() CreateMap<SubjectUser, SubjectUserDTO>().IncludeBase<SubjectUser, SubjectUserView>()
.ForMember(o => o.IsHaveReading, t => t.MapFrom(u => u.Subject.SubjectVisitTaskList.Any(t => t.ReadingTaskState != ReadingTaskState.WaitReading && t.TrialReadingCriterionId==u.TrialReadingCriterionId && t.DoctorUserId==u.DoctorUserId && t.TaskState == TaskState.Effect))); .ForMember(o => o.IsHaveReading, t => t.MapFrom(u => u.Subject.SubjectVisitTaskList.Any(t => t.ReadingTaskState != ReadingTaskState.WaitReading && t.TrialReadingCriterionId == u.TrialReadingCriterionId && t.DoctorUserId == u.DoctorUserId && t.TaskState == TaskState.Effect)));
CreateMap<SubjectVisit, VisitGenerataTaskDTO>(); CreateMap<SubjectVisit, VisitGenerataTaskDTO>();
@ -127,13 +125,13 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.TrialSiteId, t => t.MapFrom(u => u.Subject.TrialSiteId)) .ForMember(o => o.TrialSiteId, t => t.MapFrom(u => u.Subject.TrialSiteId))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code))
.ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.Subject.MedicalNo)) .ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.Subject.MedicalNo))
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode)) .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName)) .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName)) .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
//.ForMember(o => o.IsClinicalDataSigned, t => t.MapFrom(u => u.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == u.SouceReadModuleId || c.ReadingId == u.SourceSubjectVisitId)))) //.ForMember(o => o.IsClinicalDataSigned, t => t.MapFrom(u => u.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == u.SouceReadModuleId || c.ReadingId == u.SourceSubjectVisitId))))
; ;
@ -145,8 +143,8 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.HistoryReadingDoctorUserList, t => t.MapFrom(u => u.JudgeVisitList)); .ForMember(o => o.HistoryReadingDoctorUserList, t => t.MapFrom(u => u.JudgeVisitList));
CreateMap<VisitTask, ReadingTaskView>().IncludeBase<VisitTask, VisitTaskView>() CreateMap<VisitTask, ReadingTaskView>().IncludeBase<VisitTask, VisitTaskView>()
.ForMember(o=>o.IsManualGeneration,t=> t.MapFrom(u => !u.TrialReadingCriterion.IsAutoCreate)) .ForMember(o => o.IsManualGeneration, t => t.MapFrom(u => !u.TrialReadingCriterion.IsAutoCreate))
.ForMember(o => o.IsHaveFeedBack, t => t.MapFrom(u => u.UserFeedBackList.Any(t=>t.State==0))) .ForMember(o => o.IsHaveFeedBack, t => t.MapFrom(u => u.UserFeedBackList.Any(t => t.State == 0)))
; ;
CreateMap<VisitTask, AnalysisTaskView>().IncludeBase<VisitTask, VisitTaskView>() CreateMap<VisitTask, AnalysisTaskView>().IncludeBase<VisitTask, VisitTaskView>()
@ -154,7 +152,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<CancelDoctorCommand, SubjectCanceDoctor>(); CreateMap<CancelDoctorCommand, SubjectCanceDoctor>();
CreateMap<SubjectCanceDoctor, SubjectCancelDoctorView>(); CreateMap<SubjectCanceDoctor, SubjectCancelDoctorView>();
@ -239,7 +237,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName)) .ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code))
.ForMember(o => o.GeneratedMedicalReviewCount, t => t.MapFrom(u => u.TaskMedicalReviewList.Count(t=>t.MedicalManagerUserId!=null))) .ForMember(o => o.GeneratedMedicalReviewCount, t => t.MapFrom(u => u.TaskMedicalReviewList.Count(t => t.MedicalManagerUserId != null)))
.ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.Subject.MedicalNo)) .ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.Subject.MedicalNo))
.ForMember(o => o.IsGeneratedJudge, t => t.MapFrom(u => u.JudgeVisitTaskId != null)) .ForMember(o => o.IsGeneratedJudge, t => t.MapFrom(u => u.JudgeVisitTaskId != null))
.ForMember(o => o.ReadingDurationTimeSpan, t => t.MapFrom(u => u.SignTime - u.FirstReadingTime)) .ForMember(o => o.ReadingDurationTimeSpan, t => t.MapFrom(u => u.SignTime - u.FirstReadingTime))

View File

@ -4,12 +4,10 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Helper;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Helper; using Microsoft.AspNetCore.Mvc;
using IRaCIS.Application.Contracts;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
@ -111,7 +109,7 @@ namespace IRaCIS.Core.Application.Service
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, dbbeforeEntity.Path); var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, dbbeforeEntity.Path);
if (File.Exists(filePath) && dbbeforeEntity.Path!=addOrEditCommonDocument.Path) if (File.Exists(filePath) && dbbeforeEntity.Path != addOrEditCommonDocument.Path)
{ {
File.Delete(filePath); File.Delete(filePath);
} }
@ -129,9 +127,9 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{commonDocumentId:guid}")] [HttpDelete("{commonDocumentId:guid}")]
public async Task<IResponseOutput> DeleteCommonDocument(Guid commonDocumentId) public async Task<IResponseOutput> DeleteCommonDocument(Guid commonDocumentId)
{ {
var find= await _commonDocumentRepository.FirstOrDefaultNoTrackingAsync(t=>t.Id== commonDocumentId); var find = await _commonDocumentRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == commonDocumentId);
var success = await _commonDocumentRepository.DeleteFromQueryAsync(t => t.Id == commonDocumentId, true,true); var success = await _commonDocumentRepository.DeleteFromQueryAsync(t => t.Id == commonDocumentId, true, true);
if (find != null) if (find != null)
{ {

View File

@ -3,9 +3,7 @@
// 生成时间 2022-03-31 13:18:48 // 生成时间 2022-03-31 13:18:48
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
@ -23,7 +21,7 @@ namespace IRaCIS.Core.Application.ViewModel
public class CommonDocumentView : CommonDocumentAddOrEdit public class CommonDocumentView : CommonDocumentAddOrEdit
{ {
public string FullFilePath { get; set; } = String.Empty; public string FullFilePath { get; set; } = String.Empty;
public DateTime? DeletedTime { get; set; } public DateTime? DeletedTime { get; set; }
public DateTime CreateTime { get; set; } public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; } public DateTime UpdateTime { get; set; }

View File

@ -1,5 +1,4 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure.Extention;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Application.Contracts namespace IRaCIS.Application.Contracts
@ -92,8 +91,8 @@ namespace IRaCIS.Application.Contracts
{ {
public Guid? TrialReadingCriterionId { get; set; } public Guid? TrialReadingCriterionId { get; set; }
public Guid? SystemReadingCriterionId { get; set; } public Guid? SystemReadingCriterionId { get; set; }
} }
public class GetTrialCriterionDictionaryListInDto public class GetTrialCriterionDictionaryListInDto
@ -118,7 +117,7 @@ namespace IRaCIS.Application.Contracts
} }
public class BasicDicSelectCopy:BasicDicSelect public class BasicDicSelectCopy : BasicDicSelect
{ {
} }
@ -144,12 +143,12 @@ namespace IRaCIS.Application.Contracts
public CrterionDictionaryGroup CrterionDictionaryGroup { get; set; } = IRaCIS.Core.Domain.Share.CrterionDictionaryGroup.General; public CrterionDictionaryGroup CrterionDictionaryGroup { get; set; } = IRaCIS.Core.Domain.Share.CrterionDictionaryGroup.General;
public bool IsEnumInt => System.Text.RegularExpressions.Regex.IsMatch(Code, @"^[-+]?\d*$") && DataTypeEnum== DicDataTypeEnum.Enum; public bool IsEnumInt => System.Text.RegularExpressions.Regex.IsMatch(Code, @"^[-+]?\d*$") && DataTypeEnum == DicDataTypeEnum.Enum;
} }
public class BasicDicQuery:PageInput public class BasicDicQuery : PageInput
{ {
public string? keyInfo { get; set; } public string? keyInfo { get; set; }

View File

@ -3,9 +3,7 @@
// 生成时间 2022-02-15 11:55:57 // 生成时间 2022-02-15 11:55:57
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Contracts namespace IRaCIS.Core.Application.Contracts
{ {
public class TrialSelectEmailNoticeConfigView : EmailNoticeConfigView public class TrialSelectEmailNoticeConfigView : EmailNoticeConfigView

View File

@ -3,13 +3,10 @@
// 生成时间 2024-07-02 09:29:36 // 生成时间 2024-07-02 09:29:36
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
/// <summary> ExploreRecommendView 列表视图模型 </summary> /// <summary> ExploreRecommendView 列表视图模型 </summary>
public class ExploreRecommendView: ExploreRecommendAddOrEdit public class ExploreRecommendView : ExploreRecommendAddOrEdit
{ {
public DateTime CreateTime { get; set; } public DateTime CreateTime { get; set; }
@ -22,7 +19,7 @@ namespace IRaCIS.Core.Application.ViewModel
} }
///<summary>ExploreRecommendQuery 列表查询参数模型</summary> ///<summary>ExploreRecommendQuery 列表查询参数模型</summary>
public class ExploreRecommendQuery:PageInput public class ExploreRecommendQuery : PageInput
{ {
public string? Version { get; set; } public string? Version { get; set; }

View File

@ -3,16 +3,13 @@
// 生成时间 2022-03-28 16:43:52 // 生成时间 2022-03-28 16:43:52
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infra.EFCore.Common;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
/// <summary> FrontAuditConfigView 列表视图模型 </summary> /// <summary> FrontAuditConfigView 列表视图模型 </summary>
public class FrontAuditConfigView:FrontAuditConfig public class FrontAuditConfigView : FrontAuditConfig
{ {
public string ChildrenTypeValue { get; set; } = string.Empty; public string ChildrenTypeValue { get; set; } = string.Empty;
public string ChildrenTypeValueCN { get; set; } = string.Empty; public string ChildrenTypeValueCN { get; set; } = string.Empty;
@ -74,7 +71,7 @@ namespace IRaCIS.Core.Application.ViewModel
/// <summary> /// <summary>
/// 数据源Guids /// 数据源Guids
/// </summary> /// </summary>
public List<Guid?> DataSourceGuids { get; set; }=new List<Guid?>(){ }; public List<Guid?> DataSourceGuids { get; set; } = new List<Guid?>() { };
/// <summary> /// <summary>
/// 添加对象的Guid /// 添加对象的Guid
@ -131,7 +128,7 @@ namespace IRaCIS.Core.Application.ViewModel
public class FrontAuditConfigDTO: FrontAuditConfigAddOrEdit public class FrontAuditConfigDTO : FrontAuditConfigAddOrEdit
{ {
} }
@ -244,7 +241,7 @@ namespace IRaCIS.Core.Application.ViewModel
/// 日期类型 /// 日期类型
/// </summary> /// </summary>
public string DateType { get; set; }=string.Empty; public string DateType { get; set; } = string.Empty;
/// <summary> /// <summary>

View File

@ -3,9 +3,6 @@
// 生成时间 2023-06-01 13:38:20 // 生成时间 2023-06-01 13:38:20
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
/// <summary> InternationalizationView 列表视图模型 </summary> /// <summary> InternationalizationView 列表视图模型 </summary>

View File

@ -3,9 +3,6 @@
// 生成时间 2023-06-27 15:47:02 // 生成时间 2023-06-27 15:47:02
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel namespace IRaCIS.Core.Application.ViewModel
{ {
/// <summary> PublishLogView 列表视图模型 </summary> /// <summary> PublishLogView 列表视图模型 </summary>
@ -19,7 +16,7 @@ namespace IRaCIS.Core.Application.ViewModel
} }
///<summary>PublishLogQuery 列表查询参数模型</summary> ///<summary>PublishLogQuery 列表查询参数模型</summary>
public class PublishLogQuery:PageInput public class PublishLogQuery : PageInput
{ {
public string? Version { get; set; } public string? Version { get; set; }

View File

@ -1,6 +1,4 @@
using System; namespace IRaCIS.Application.Contracts
namespace IRaCIS.Application.Contracts
{ {
public class SysMessageDTO public class SysMessageDTO
{ {

View File

@ -3,14 +3,10 @@
// 生成时间 2022-02-15 15:46:00 // 生成时间 2022-02-15 15:46:00
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.Contracts namespace IRaCIS.Core.Application.Contracts
{ {
/// <summary> SystemBasicDataView 列表视图模型 </summary> /// <summary> SystemBasicDataView 列表视图模型 </summary>
public class SystemBasicDataView: SystemBasicDataAddOrEdit public class SystemBasicDataView : SystemBasicDataAddOrEdit
{ {
public DateTime CreateTime { get; set; } public DateTime CreateTime { get; set; }
@ -34,7 +30,7 @@ namespace IRaCIS.Core.Application.Contracts
///<summary>SystemBasicDataQuery 列表查询参数模型</summary> ///<summary>SystemBasicDataQuery 列表查询参数模型</summary>
public class SystemBasicDataQuery:PageInput public class SystemBasicDataQuery : PageInput
{ {
///<summary> Name</summary> ///<summary> Name</summary>
public string? Name { get; set; } public string? Name { get; set; }
@ -57,7 +53,7 @@ namespace IRaCIS.Core.Application.Contracts
public string ValueCN { get; set; } = string.Empty; public string ValueCN { get; set; } = string.Empty;
public bool IsEnable { get; set; }=true; public bool IsEnable { get; set; } = true;
} }

View File

@ -1,6 +1,4 @@
using IRaCIS.Core.Infrastructure.Extention; namespace IRaCIS.Application.Contracts
namespace IRaCIS.Application.Contracts
{ {
public class SystemLogDTO public class SystemLogDTO
{ {
@ -42,7 +40,7 @@ namespace IRaCIS.Application.Contracts
public Guid? OptUserId { get; set; } public Guid? OptUserId { get; set; }
public DateTime? StartDate { get; set; } public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; } public DateTime? EndDate { get; set; }
} }
@ -82,7 +80,7 @@ namespace IRaCIS.Application.Contracts
public class OptUserDto public class OptUserDto
{ {
public Guid OptUserId { get; set; } public Guid OptUserId { get; set; }
public string OptUser { get; set; } = string.Empty; public string OptUser { get; set; } = string.Empty;
} }

View File

@ -1,9 +1,4 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.Common namespace IRaCIS.Core.Application.Service.Common
{ {

View File

@ -1,22 +1,18 @@
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Contracts;
using IRaCIS.Application.Contracts; using IRaCIS.Application.Interfaces;
using IRaCIS.Core.Domain.Share;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Infra.EFCore.Common;
using IP2Region.Net.XDB;
using System.Collections;
using System.Text; using System.Text;
namespace IRaCIS.Application.Services namespace IRaCIS.Core.Application.Service
{ {
/// <summary> /// <summary>
/// 数据字典-基础数据维护 /// 数据字典-基础数据维护
/// </summary> /// </summary>
[ApiExplorerSettings(GroupName = "Common")] [ApiExplorerSettings(GroupName = "Common")]
public class DictionaryService (IRepository<Dictionary> _dicRepository, public class DictionaryService(IRepository<Dictionary> _dicRepository,
IRepository<DoctorDictionary> _doctorDictionaryRepository, IRepository<DoctorDictionary> _doctorDictionaryRepository,
IRepository<TrialDictionary> _trialDictionaryRepository, IRepository<TrialDictionary> _trialDictionaryRepository,
IRepository<Doctor> _doctorRepository, IRepository<Doctor> _doctorRepository,
@ -52,7 +48,7 @@ namespace IRaCIS.Application.Services
enumCode.AppendLine("}"); enumCode.AppendLine("}");
// 返回生成的枚举代码 // 返回生成的枚举代码
var enumStr= enumCode.ToString(); var enumStr = enumCode.ToString();
return ResponseOutput.Ok(enumStr); return ResponseOutput.Ok(enumStr);
@ -96,11 +92,11 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task<List<string>> GetAllDictionaryKey() public async Task<List<string>> GetAllDictionaryKey()
{ {
var result =await _dicRepository.Where(t => t.ParentId == null).OrderBy(x=>x.Code).Select(x => x.Code).ToListAsync(); var result = await _dicRepository.Where(t => t.ParentId == null).OrderBy(x => x.Code).Select(x => x.Code).ToListAsync();
return result; return result;
} }
/// <summary> /// <summary>
/// 添加字典 的同时 一起添加子项 --New /// 添加字典 的同时 一起添加子项 --New
@ -118,9 +114,9 @@ namespace IRaCIS.Application.Services
}; };
if((addBasicDicAndChild.DataTypeEnum == DicDataTypeEnum.Enum || addBasicDicAndChild.DataTypeEnum == DicDataTypeEnum.Bool)) if ((addBasicDicAndChild.DataTypeEnum == DicDataTypeEnum.Enum || addBasicDicAndChild.DataTypeEnum == DicDataTypeEnum.Bool))
{ {
if(addBasicDicAndChild.ChildList.GroupBy(t => t.Code).Where(g => g.Count() > 1).Any()) if (addBasicDicAndChild.ChildList.GroupBy(t => t.Code).Where(g => g.Count() > 1).Any())
{ {
return ResponseOutput.NotOk(_localizer["Dictionary_RepeateCode"]); return ResponseOutput.NotOk(_localizer["Dictionary_RepeateCode"]);
} }
@ -187,11 +183,11 @@ namespace IRaCIS.Application.Services
var verifyExp2 = new EntityVerifyExp<Dictionary>() var verifyExp2 = new EntityVerifyExp<Dictionary>()
{ {
VerifyExp = t => t.Code == addOrEditBasic.Code && t.ParentId == addOrEditBasic.ParentId && t.Code==addOrEditBasic.Code, VerifyExp = t => t.Code == addOrEditBasic.Code && t.ParentId == addOrEditBasic.ParentId && t.Code == addOrEditBasic.Code,
VerifyMsg = _localizer["Dictionary_RepeateCode"], VerifyMsg = _localizer["Dictionary_RepeateCode"],
IsVerify = addOrEditBasic.ParentId != null && (addOrEditBasic.DataTypeEnum == DicDataTypeEnum.Enum || addOrEditBasic.DataTypeEnum == DicDataTypeEnum.Bool) IsVerify = addOrEditBasic.ParentId != null && (addOrEditBasic.DataTypeEnum == DicDataTypeEnum.Enum || addOrEditBasic.DataTypeEnum == DicDataTypeEnum.Bool)
}; };
@ -236,14 +232,14 @@ namespace IRaCIS.Application.Services
//return ResponseOutput.NotOk(_localizer["Dictionary_DictionaryDeletion"]); //return ResponseOutput.NotOk(_localizer["Dictionary_DictionaryDeletion"]);
} }
if (await _readingTrialCriterionDictionaryRepository.AnyAsync(x => x.DictionaryId == id)) if (await _readingTrialCriterionDictionaryRepository.AnyAsync(x => x.DictionaryId == id))
{ {
await _readingTrialCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DictionaryId == id); await _readingTrialCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DictionaryId == id);
//---当前字典在标准中被引用,不允许删除! //---当前字典在标准中被引用,不允许删除!
//return ResponseOutput.NotOk(_localizer["Dictionary_DictionaryDeletion"]); //return ResponseOutput.NotOk(_localizer["Dictionary_DictionaryDeletion"]);
} }
if (await _dicRepository.AnyAsync(t => t.ParentId == id)) if (await _dicRepository.AnyAsync(t => t.ParentId == id))
{ {
//---有子项数据,不允许直接删除! //---有子项数据,不允许直接删除!
return ResponseOutput.NotOk(_localizer["Dictionary_SubitemDeletion"]); return ResponseOutput.NotOk(_localizer["Dictionary_SubitemDeletion"]);
@ -279,7 +275,7 @@ namespace IRaCIS.Application.Services
public async Task<Dictionary<string, List<BasicDicSelectCopy>>> GetBasicDataSelect(string[] searchArray) public async Task<Dictionary<string, List<BasicDicSelectCopy>>> GetBasicDataSelect(string[] searchArray)
{ {
var searchList = await _dicRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelectCopy>(_mapper.ConfigurationProvider,new { isEn_Us = _userInfo.IsEn_Us}).ToListAsync(); var searchList = await _dicRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelectCopy>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.OrderBy(t => t.ShowOrder).ToList()); return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.OrderBy(t => t.ShowOrder).ToList());
@ -397,45 +393,45 @@ namespace IRaCIS.Application.Services
List<string> selectCode = new List<string>(); List<string> selectCode = new List<string>();
List<BasicDicSelect> criterionDictionList = new List<BasicDicSelect>(); List<BasicDicSelect> criterionDictionList = new List<BasicDicSelect>();
var isSystemCriterion = await _readingQuestionCriterionSystem.AnyAsync(x => x.Id == inDto.ReadingCriterionId); var isSystemCriterion = await _readingQuestionCriterionSystem.AnyAsync(x => x.Id == inDto.ReadingCriterionId);
if (isSystemCriterion) if (isSystemCriterion)
{ {
selectCode = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.ReadingCriterionId).Select(x => x.Code).ToListAsync(); selectCode = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.ReadingCriterionId).Select(x => x.Code).ToListAsync();
criterionDictionList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect() criterionDictionList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect()
{ {
ChildGroup = x.Dictionary.ChildGroup, ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code, Code = x.Dictionary.Code,
DataTypeEnum = x.Dictionary.DataTypeEnum, DataTypeEnum = x.Dictionary.DataTypeEnum,
ShowOrder = x.Dictionary.ShowOrder, ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.ParentCode, ParentCode = x.ParentCode,
CrterionDictionaryGroup = x.CrterionDictionaryGroup, CrterionDictionaryGroup = x.CrterionDictionaryGroup,
Id = x.DictionaryId, Id = x.DictionaryId,
ParentId = x.Dictionary.ParentId, ParentId = x.Dictionary.ParentId,
Value = x.Dictionary.Value, Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN ValueCN = x.Dictionary.ValueCN
}).ToListAsync(); }).ToListAsync();
} }
else else
{ {
selectCode = await _trialCriterionDictionaryCodeRepository.Where(x => x.TrialCriterionId == inDto.ReadingCriterionId).Select(x => x.Code).ToListAsync(); selectCode = await _trialCriterionDictionaryCodeRepository.Where(x => x.TrialCriterionId == inDto.ReadingCriterionId).Select(x => x.Code).ToListAsync();
criterionDictionList = await _readingTrialCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect() criterionDictionList = await _readingTrialCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.ReadingCriterionId).Select(x => new BasicDicSelect()
{ {
ChildGroup = x.Dictionary.ChildGroup, ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code, Code = x.Dictionary.Code,
DataTypeEnum = x.Dictionary.DataTypeEnum, DataTypeEnum = x.Dictionary.DataTypeEnum,
ShowOrder = x.Dictionary.ShowOrder, ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.ParentCode, ParentCode = x.ParentCode,
CrterionDictionaryGroup = x.CrterionDictionaryGroup, CrterionDictionaryGroup = x.CrterionDictionaryGroup,
Id = x.DictionaryId, Id = x.DictionaryId,
ParentId = x.Dictionary.ParentId, ParentId = x.Dictionary.ParentId,
Value = x.Dictionary.Value, Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN ValueCN = x.Dictionary.ValueCN
}).ToListAsync(); }).ToListAsync();
} }
var criterionCode = await _dicRepository.Where(x => x.ConfigDictionary.Code == "Reading_eCRF_Criterion").Select(x => x.Code).ToListAsync(); var criterionCode = await _dicRepository.Where(x => x.ConfigDictionary.Code == "Reading_eCRF_Criterion").Select(x => x.Code).ToListAsync();
@ -542,48 +538,48 @@ namespace IRaCIS.Application.Services
} }
else else
{ {
List<string> selectCode = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemReadingCriterionId).Select(x => x.Code).ToListAsync(); List<string> selectCode = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemReadingCriterionId).Select(x => x.Code).ToListAsync();
var criterionCode = await _dicRepository.Where(x => x.ConfigDictionary.Code == "Reading_eCRF_Criterion").Select(x => x.Code).ToListAsync(); var criterionCode = await _dicRepository.Where(x => x.ConfigDictionary.Code == "Reading_eCRF_Criterion").Select(x => x.Code).ToListAsync();
foreach (var item in criterionCode) foreach (var item in criterionCode)
{ {
if (result.ContainsKey(item)) if (result.ContainsKey(item))
{ {
result[item] = new List<BasicDicSelect>(); result[item] = new List<BasicDicSelect>();
} }
} }
var criterionDictionList = await _readingSystemCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.SystemReadingCriterionId).Select(x => new BasicDicSelect() var criterionDictionList = await _readingSystemCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.SystemReadingCriterionId).Select(x => new BasicDicSelect()
{ {
ChildGroup = x.Dictionary.ChildGroup, ChildGroup = x.Dictionary.ChildGroup,
Code = x.Dictionary.Code, Code = x.Dictionary.Code,
Description = x.Dictionary.Description, Description = x.Dictionary.Description,
DataTypeEnum = x.Dictionary.DataTypeEnum, DataTypeEnum = x.Dictionary.DataTypeEnum,
ShowOrder = x.Dictionary.ShowOrder, ShowOrder = x.Dictionary.ShowOrder,
ParentCode = x.ParentCode, ParentCode = x.ParentCode,
Id = x.DictionaryId, Id = x.DictionaryId,
CrterionDictionaryGroup = x.CrterionDictionaryGroup, CrterionDictionaryGroup = x.CrterionDictionaryGroup,
ParentId = x.Dictionary.ParentId, ParentId = x.Dictionary.ParentId,
Value = x.Dictionary.Value, Value = x.Dictionary.Value,
ValueCN = x.Dictionary.ValueCN ValueCN = x.Dictionary.ValueCN
}).ToListAsync(); }).ToListAsync();
criterionDictionList = criterionDictionList.Where(x => selectCode.Contains(x.ParentCode)).ToList(); criterionDictionList = criterionDictionList.Where(x => selectCode.Contains(x.ParentCode)).ToList();
var criterionDic = criterionDictionList.GroupBy(x => x.ParentCode).ToDictionary(g => g.Key, g => g.OrderBy(t => t.ShowOrder).ToList()); var criterionDic = criterionDictionList.GroupBy(x => x.ParentCode).ToDictionary(g => g.Key, g => g.OrderBy(t => t.ShowOrder).ToList());
foreach (var item in criterionDic) foreach (var item in criterionDic)
{ {
result[item.Key] = item.Value; result[item.Key] = item.Value;
} }
return result; return result;
} }
} }

View File

@ -5,7 +5,6 @@
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -24,7 +23,7 @@ namespace IRaCIS.Core.Application.Contracts
{ {
var emailNoticeConfigQueryable = _emailNoticeConfigrepository var emailNoticeConfigQueryable = _emailNoticeConfigrepository
.WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) .WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys)
.WhereIf(inQuery.SystemLevel!=null, t =>t.SystemLevel == inQuery.SystemLevel) .WhereIf(inQuery.SystemLevel != null, t => t.SystemLevel == inQuery.SystemLevel)
.WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria) .WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria)
.WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum) .WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum)
.WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum)
@ -48,8 +47,8 @@ namespace IRaCIS.Core.Application.Contracts
// 匹配所有占位符的正则表达式,允许包含空格的占位符 // 匹配所有占位符的正则表达式,允许包含空格的占位符
var regex = new Regex(@"\{\s*\d+\s*\}"); var regex = new Regex(@"\{\s*\d+\s*\}");
if (regex.Matches($"{addOrEditEmailNoticeConfig.EmailTopic}{addOrEditEmailNoticeConfig.EmailTopicCN}{addOrEditEmailNoticeConfig.EmailHtmlContent}{addOrEditEmailNoticeConfig.EmailHtmlContentCN}" ) if (regex.Matches($"{addOrEditEmailNoticeConfig.EmailTopic}{addOrEditEmailNoticeConfig.EmailTopicCN}{addOrEditEmailNoticeConfig.EmailHtmlContent}{addOrEditEmailNoticeConfig.EmailHtmlContentCN}")
.Any(t=>t.Value.Contains(" "))) .Any(t => t.Value.Contains(" ")))
{ {
//邮件模板占位符不允许有空格,请核查占位符的地方 //邮件模板占位符不允许有空格,请核查占位符的地方
return ResponseOutput.NotOk("EmailNoticeConfig_ContainEmpty"); return ResponseOutput.NotOk("EmailNoticeConfig_ContainEmpty");
@ -98,7 +97,7 @@ namespace IRaCIS.Core.Application.Contracts
} }
var entity = await _emailNoticeConfigrepository.UpdateFromDTOAsync(addOrEditEmailNoticeConfig, true, false,verifyExp1); var entity = await _emailNoticeConfigrepository.UpdateFromDTOAsync(addOrEditEmailNoticeConfig, true, false, verifyExp1);
return ResponseOutput.Ok(entity.Id.ToString()); return ResponseOutput.Ok(entity.Id.ToString());

View File

@ -1,29 +1,14 @@
using DocumentFormat.OpenXml.Office2010.ExcelAc; using IRaCIS.Application.Contracts;
using DocumentFormat.OpenXml.Presentation;
using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Application.Contracts;
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Interfaces;
using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson; using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson;
using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.DTO; using IRaCIS.Core.Application.Contracts.DTO;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common; using IRaCIS.Core.Infra.EFCore.Common;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
using MiniExcelLibs.OpenXml;
using NPOI.HPSF;
using NPOI.HSSF.UserModel;
using NPOI.SS.Formula.Functions;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.Common namespace IRaCIS.Core.Application.Service.Common
{ {
@ -220,7 +205,7 @@ namespace IRaCIS.Core.Application.Service.Common
var query = _trialRepository.AsQueryable() var query = _trialRepository.AsQueryable()
.WhereIf(inQuery.TrialIdList.Count()>0, o => inQuery.TrialIdList.Contains(o.Id)) .WhereIf(inQuery.TrialIdList.Count() > 0, o => inQuery.TrialIdList.Contains(o.Id))
.WhereIf(inQuery.SponsorId != null, o => o.SponsorId == inQuery.SponsorId) .WhereIf(inQuery.SponsorId != null, o => o.SponsorId == inQuery.SponsorId)
.WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code))
@ -348,7 +333,7 @@ namespace IRaCIS.Core.Application.Service.Common
[FromServices] IRepository<Trial> _trialRepository [FromServices] IRepository<Trial> _trialRepository
) )
{ {
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync()); var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId) join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
@ -433,7 +418,7 @@ namespace IRaCIS.Core.Application.Service.Common
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
exportInfo.List=list; exportInfo.List = list;
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);

View File

@ -4,11 +4,10 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
/// <summary> /// <summary>
@ -47,7 +46,7 @@ namespace IRaCIS.Core.Application.Service
VerifyExp = u => u.IsDeleted == addOrEditExploreRecommend.IsDeleted && u.ExploreType == addOrEditExploreRecommend.ExploreType, VerifyExp = u => u.IsDeleted == addOrEditExploreRecommend.IsDeleted && u.ExploreType == addOrEditExploreRecommend.ExploreType,
// "当前类型浏览器启用版本只允许有一个" // "当前类型浏览器启用版本只允许有一个"
VerifyMsg = _localizer["ExploreRecommend_OnlyOneTypePerType"] , VerifyMsg = _localizer["ExploreRecommend_OnlyOneTypePerType"],
IsVerify = addOrEditExploreRecommend.IsDeleted == false IsVerify = addOrEditExploreRecommend.IsDeleted == false
}; };
@ -62,18 +61,18 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{exploreRecommendId:guid}")] [HttpDelete("{exploreRecommendId:guid}")]
public async Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId) public async Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId)
{ {
var success = await _exploreRecommendRepository.DeleteFromQueryAsync(t => t.Id == exploreRecommendId, true,true); var success = await _exploreRecommendRepository.DeleteFromQueryAsync(t => t.Id == exploreRecommendId, true, true);
return ResponseOutput.Ok(); return ResponseOutput.Ok();
} }
[AllowAnonymous] [AllowAnonymous]
public async Task<List<ExploreRecommendView> > GetExploreRecommentInfo() public async Task<List<ExploreRecommendView>> GetExploreRecommentInfo()
{ {
var result = await _exploreRecommendRepository.Where(t => t.IsDeleted == false).ProjectTo<ExploreRecommendView>(_mapper.ConfigurationProvider).ToListAsync(); var result = await _exploreRecommendRepository.Where(t => t.IsDeleted == false).ProjectTo<ExploreRecommendView>(_mapper.ConfigurationProvider).ToListAsync();
if (result .Count==0) if (result.Count == 0)
{ //"系统浏览器版本推荐未维护,请联系维护人员" { //"系统浏览器版本推荐未维护,请联系维护人员"
throw new QueryBusinessObjectNotExistException(_localizer["ExploreRecommend_NoExporeRecord"]); throw new QueryBusinessObjectNotExistException(_localizer["ExploreRecommend_NoExporeRecord"]);
} }

View File

@ -1,12 +1,10 @@
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Interfaces;
using System.Text;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Infrastructure;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using System.Text;
namespace IRaCIS.Application.Services namespace IRaCIS.Core.Application.Service
{ {
public class FileService( public class FileService(
IDoctorService _doctorService, IDoctorService _doctorService,

View File

@ -7,16 +7,16 @@
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces namespace IRaCIS.Core.Application.Interfaces
{ {
/// <summary> /// <summary>
/// ICommonDocumentService /// ICommonDocumentService
/// </summary> /// </summary>
public interface ICommonDocumentService public interface ICommonDocumentService
{ {
Task<PageOutput<CommonDocumentView>> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument); Task<PageOutput<CommonDocumentView>> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument);
Task<IResponseOutput> AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument); Task<IResponseOutput> AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument);

View File

@ -1,7 +1,4 @@
using System; using IRaCIS.Application.Contracts;
using System.Collections.Generic;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Application.Interfaces namespace IRaCIS.Application.Interfaces
{ {
@ -12,7 +9,7 @@ namespace IRaCIS.Application.Interfaces
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
Task<string> GetBoolValueState(bool value); Task<string> GetBoolValueState(bool value);
/// <summary> /// <summary>
/// 获取审核状态 /// 获取审核状态
@ -21,7 +18,7 @@ namespace IRaCIS.Application.Interfaces
/// <param name="trial"></param> /// <param name="trial"></param>
/// <param name="childCode"></param> /// <param name="childCode"></param>
/// <returns></returns> /// <returns></returns>
Task<string> GetAuditState<T>(Guid trial, T childCode); Task<string> GetAuditState<T>(Guid trial, T childCode);
/// <summary> /// <summary>
/// 获取枚举翻译 /// 获取枚举翻译

View File

@ -7,17 +7,17 @@
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces namespace IRaCIS.Core.Application.Interfaces
{ {
/// <summary> /// <summary>
/// IExploreRecommendService /// IExploreRecommendService
/// </summary> /// </summary>
public interface IExploreRecommendService public interface IExploreRecommendService
{ {
Task<PageOutput<ExploreRecommendView>> GetExploreRecommendList(ExploreRecommendQuery inQuery); Task<PageOutput<ExploreRecommendView>> GetExploreRecommendList(ExploreRecommendQuery inQuery);
Task<IResponseOutput> AddOrUpdateExploreRecommend(ExploreRecommendAddOrEdit addOrEditExploreRecommend); Task<IResponseOutput> AddOrUpdateExploreRecommend(ExploreRecommendAddOrEdit addOrEditExploreRecommend);
Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId); Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId);
} }

View File

@ -1,6 +1,4 @@
using System; namespace IRaCIS.Application.Interfaces
namespace IRaCIS.Application.Interfaces
{ {
public interface IFileService public interface IFileService
{ {

View File

@ -7,18 +7,18 @@
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces namespace IRaCIS.Core.Application.Interfaces
{ {
/// <summary> /// <summary>
/// IFrontAuditConfigService /// IFrontAuditConfigService
/// </summary> /// </summary>
public interface IFrontAuditConfigService public interface IFrontAuditConfigService
{ {
Task<List<FrontAuditConfigView>> GetFrontAuditConfigList(FrontAuditConfigQuery queryFrontAuditConfig); Task<List<FrontAuditConfigView>> GetFrontAuditConfigList(FrontAuditConfigQuery queryFrontAuditConfig);
Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig); Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig);
Task<IResponseOutput> DeleteFrontAuditConfig(Guid frontAuditConfigId); Task<IResponseOutput> DeleteFrontAuditConfig(Guid frontAuditConfigId);
} }

View File

@ -1,7 +1,4 @@
using System; using IRaCIS.Application.Contracts;
using IRaCIS.Application.Contracts;
using System.Collections.Generic;
using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Application.Interfaces namespace IRaCIS.Application.Interfaces
{ {

View File

@ -1,6 +1,4 @@
using System; using IRaCIS.Application.Contracts;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Application.Interfaces namespace IRaCIS.Application.Interfaces
{ {

View File

@ -7,17 +7,17 @@
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces namespace IRaCIS.Core.Application.Interfaces
{ {
/// <summary> /// <summary>
/// IPublishLogService /// IPublishLogService
/// </summary> /// </summary>
public interface IPublishLogService public interface IPublishLogService
{ {
Task<PageOutput<PublishLogView>> GetPublishLogList(PublishLogQuery inQuery); Task<PageOutput<PublishLogView>> GetPublishLogList(PublishLogQuery inQuery);
Task<IResponseOutput> AddOrUpdatePublishLog(PublishLogAddOrEdit addOrEditPublishLog); Task<IResponseOutput> AddOrUpdatePublishLog(PublishLogAddOrEdit addOrEditPublishLog);
Task<IResponseOutput> DeletePublishLog(Guid publishLogId); Task<IResponseOutput> DeletePublishLog(Guid publishLogId);
} }

View File

@ -7,18 +7,18 @@
namespace IRaCIS.Core.Application.Contracts namespace IRaCIS.Core.Application.Contracts
{ {
/// <summary> /// <summary>
/// ISystemBasicDataService /// ISystemBasicDataService
/// </summary> /// </summary>
public interface ISystemBasicDataService public interface ISystemBasicDataService
{ {
Task<PageOutput<SystemBasicDataView>> GetSystemBasicDataList(SystemBasicDataQuery querySystemBasicData); Task<PageOutput<SystemBasicDataView>> GetSystemBasicDataList(SystemBasicDataQuery querySystemBasicData);
Task<IResponseOutput> AddOrUpdateSystemBasicData(SystemBasicDataAddOrEdit addOrEditSystemBasicData); Task<IResponseOutput> AddOrUpdateSystemBasicData(SystemBasicDataAddOrEdit addOrEditSystemBasicData);
Task<IResponseOutput> DeleteSystemBasicData(Guid systemBasicDataId); Task<IResponseOutput> DeleteSystemBasicData(Guid systemBasicDataId);
} }

View File

@ -4,13 +4,11 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Helper;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using IRaCIS.Core.Application.Helper; using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share;
using ZiggyCreatures.Caching.Fusion; using ZiggyCreatures.Caching.Fusion;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
@ -19,7 +17,7 @@ namespace IRaCIS.Core.Application.Service
/// InternationalizationService /// InternationalizationService
/// </summary> /// </summary>
[ApiExplorerSettings(GroupName = "Common")] [ApiExplorerSettings(GroupName = "Common")]
public class InternationalizationService (IRepository<Internationalization> _internationalizationRepository) : BaseService, IInternationalizationService public class InternationalizationService(IRepository<Internationalization> _internationalizationRepository) : BaseService, IInternationalizationService
{ {
@ -140,7 +138,7 @@ namespace IRaCIS.Core.Application.Service
await _internationalizationRepository.SaveChangesAsync(); await _internationalizationRepository.SaveChangesAsync();
//清理缓存 //清理缓存
await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, new List<InternationalizationSimpleDto>(), TimeSpan.FromDays(1)); await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, new List<InternationalizationSimpleDto>(), TimeSpan.FromDays(1));
return ResponseOutput.Ok(); return ResponseOutput.Ok();
} }
@ -181,7 +179,7 @@ namespace IRaCIS.Core.Application.Service
else else
{ {
//清理缓存 //清理缓存
await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, new List<InternationalizationSimpleDto>(), TimeSpan.FromDays(1)); await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, new List<InternationalizationSimpleDto>(), TimeSpan.FromDays(1));
} }
return ResponseOutput.Ok(entity.Id.ToString()); return ResponseOutput.Ok(entity.Id.ToString());

View File

@ -1,29 +1,15 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Application.Contracts;
using MimeKit;
using IRaCIS.Core.Application.Helper;
using MailKit;
using Microsoft.AspNetCore.Hosting;
using IRaCIS.Core.Application.Auth; using IRaCIS.Core.Application.Auth;
using AutoMapper; using IRaCIS.Core.Application.Helper;
using IRaCIS.Application.Contracts; using IRaCIS.Core.Domain.Share;
using Microsoft.Extensions.Options;
using Medallion.Threading;
using System.Text.RegularExpressions;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;
using DocumentFormat.OpenXml.Spreadsheet; using MailKit;
using IRaCIS.Core.Application.Service.Reading.Dto; using Medallion.Threading;
using NPOI.SS.Formula.Functions; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.Options;
using IRaCIS.Core.Domain.Models; using MimeKit;
using DocumentFormat.OpenXml.Office2013.Excel;
using IRaCIS.Core.Application.Contracts;
using DocumentFormat.OpenXml.Vml;
using System.Net.Mail;
using IP2Region.Net.XDB;
using NPOI.SS.Formula.Eval;
using System.Linq;
namespace IRaCIS.Application.Services namespace IRaCIS.Core.Application.Service
{ {
public interface IMailVerificationService public interface IMailVerificationService
{ {
@ -818,7 +804,7 @@ namespace IRaCIS.Application.Services
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialFeedBack).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync(); var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.TrialFeedBack).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
var info = await _trialRepository.Where(t => t.Id == feedBack.TrialId).Select(t => new { t.ResearchProgramNo, t.TrialCode }).FirstNotNullAsync(); var info = await _trialRepository.Where(t => t.Id == feedBack.TrialId).Select(t => new { t.ResearchProgramNo, t.TrialCode }).FirstNotNullAsync();
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
{ {

View File

@ -4,12 +4,10 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Application.Contracts;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {
@ -45,7 +43,7 @@ namespace IRaCIS.Core.Application.Service
if (!Version.TryParse(addOrEditPublishLog.Version, out version)) if (!Version.TryParse(addOrEditPublishLog.Version, out version))
{ {
//"版本号不符合要求" //"版本号不符合要求"
return ResponseOutput.NotOk(_localizer["PublishLog_NotValidVersion"] ); return ResponseOutput.NotOk(_localizer["PublishLog_NotValidVersion"]);
} }
var verifyExp1 = new EntityVerifyExp<PublishLog>() var verifyExp1 = new EntityVerifyExp<PublishLog>()
@ -61,9 +59,9 @@ namespace IRaCIS.Core.Application.Service
VerifyExp = u => u.IsCurrentVersion == addOrEditPublishLog.IsCurrentVersion, VerifyExp = u => u.IsCurrentVersion == addOrEditPublishLog.IsCurrentVersion,
//"当前发布版本只允许有一个" //"当前发布版本只允许有一个"
VerifyMsg = _localizer["PublishLog_OnlyOneCurrentVersion"] , VerifyMsg = _localizer["PublishLog_OnlyOneCurrentVersion"],
IsVerify=addOrEditPublishLog.IsCurrentVersion==true IsVerify = addOrEditPublishLog.IsCurrentVersion == true
}; };
var entity = await _publishLogRepository.InsertOrUpdateAsync(addOrEditPublishLog, true, verifyExp1, verifyExp2); var entity = await _publishLogRepository.InsertOrUpdateAsync(addOrEditPublishLog, true, verifyExp1, verifyExp2);
@ -88,7 +86,7 @@ namespace IRaCIS.Core.Application.Service
if (result == null) if (result == null)
{ {
//"系统当前版本未标记,请联系维护人员" //"系统当前版本未标记,请联系维护人员"
throw new QueryBusinessObjectNotExistException(_localizer["PublishLog_NoCurrentVersion"] ); throw new QueryBusinessObjectNotExistException(_localizer["PublishLog_NoCurrentVersion"]);
} }
return result; return result;

View File

@ -28,7 +28,7 @@ namespace IRaCIS.Core.Application.Services
var systemBasicDataQueryable = _systemBasicDataRepository.Where(t => t.ParentId == null) var systemBasicDataQueryable = _systemBasicDataRepository.Where(t => t.ParentId == null)
.ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider); .ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider);
return await systemBasicDataQueryable.ToPagedListAsync(inQuery,nameof(SystemBasicDataView.Code)); return await systemBasicDataQueryable.ToPagedListAsync(inQuery, nameof(SystemBasicDataView.Code));
} }
@ -47,7 +47,7 @@ namespace IRaCIS.Core.Application.Services
[HttpGet("{parentId:guid}")] [HttpGet("{parentId:guid}")]
public async Task<List<SystemBasicDataView>> GetChildList(Guid parentId) public async Task<List<SystemBasicDataView>> GetChildList(Guid parentId)
{ {
return await _systemBasicDataRepository.Where(t => t.ParentId == parentId&&t.IsEnable).OrderBy(t => t.Code).ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider).ToListAsync(); return await _systemBasicDataRepository.Where(t => t.ParentId == parentId && t.IsEnable).OrderBy(t => t.Code).ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider).ToListAsync();
} }
@ -63,7 +63,7 @@ namespace IRaCIS.Core.Application.Services
else else
{ {
var entity =await _systemBasicDataRepository.Where(t => t.Id == addOrEditSystemBasicData.Id,true).FirstOrDefaultAsync(); var entity = await _systemBasicDataRepository.Where(t => t.Id == addOrEditSystemBasicData.Id, true).FirstOrDefaultAsync();
_mapper.Map(addOrEditSystemBasicData, entity); _mapper.Map(addOrEditSystemBasicData, entity);
await _systemBasicDataRepository.SaveChangesAsync(); await _systemBasicDataRepository.SaveChangesAsync();
@ -80,7 +80,7 @@ namespace IRaCIS.Core.Application.Services
[HttpDelete("{systemBasicDataId:guid}")] [HttpDelete("{systemBasicDataId:guid}")]
public async Task<IResponseOutput> DeleteSystemBasicData(Guid systemBasicDataId) public async Task<IResponseOutput> DeleteSystemBasicData(Guid systemBasicDataId)
{ {
var success = await _systemBasicDataRepository.DeleteFromQueryAsync(x=>x.Id== systemBasicDataId); var success = await _systemBasicDataRepository.DeleteFromQueryAsync(x => x.Id == systemBasicDataId);
await _systemBasicDataRepository.SaveChangesAsync(); await _systemBasicDataRepository.SaveChangesAsync();
return ResponseOutput.Result(true); return ResponseOutput.Result(true);
} }
@ -95,7 +95,7 @@ namespace IRaCIS.Core.Application.Services
public async Task<Dictionary<string, List<SystemBasicDataSelect>>> GetBasicDataSelect(string[] searchArray) public async Task<Dictionary<string, List<SystemBasicDataSelect>>> GetBasicDataSelect(string[] searchArray)
{ {
var searchList = await _systemBasicDataRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null).ProjectTo<SystemBasicDataSelect>(_mapper.ConfigurationProvider,new { _userInfo.IsEn_Us}).ToListAsync(); var searchList = await _systemBasicDataRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null).ProjectTo<SystemBasicDataSelect>(_mapper.ConfigurationProvider, new { _userInfo.IsEn_Us }).ToListAsync();
return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.ToList()); return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.ToList());

View File

@ -1,23 +1,7 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Application.Helper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration.Json;
using IRaCIS.Core.Infrastructure.Extention;
using SharpCompress.Common;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Encodings.Web;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Application.Helper; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
namespace IRaCIS.Core.Application.Service.Common namespace IRaCIS.Core.Application.Service.Common
{ {
@ -63,7 +47,7 @@ namespace IRaCIS.Core.Application.Service.Common
{ {
//---解析Json文件配置出现问题 //---解析Json文件配置出现问题
throw new BusinessValidationFailedException(_localizer["SysMon_JsonConfig"]+e.Message); throw new BusinessValidationFailedException(_localizer["SysMon_JsonConfig"] + e.Message);
} }
//默认存储的路径 //默认存储的路径

View File

@ -2,8 +2,6 @@
using IRaCIS.Application.Contracts; using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Service namespace IRaCIS.Core.Application.Service
{ {

View File

@ -1,12 +1,9 @@
using IRaCIS.Application.Interfaces; using IRaCIS.Application.Contracts;
using IRaCIS.Application.Contracts; using IRaCIS.Application.Interfaces;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Panda.DynamicWebApi.Attributes; using Panda.DynamicWebApi.Attributes;
namespace IRaCIS.Application.Services namespace IRaCIS.Core.Application.Service
{ {
/// <summary> /// <summary>
/// 医生文档关联关系维护 /// 医生文档关联关系维护
@ -22,7 +19,7 @@ namespace IRaCIS.Application.Services
/// <param name="param"></param> /// <param name="param"></param>
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput> DeleteAttachment([FromBody]AttachementCommand param) public async Task<IResponseOutput> DeleteAttachment([FromBody] AttachementCommand param)
{ {
//var attachment = _doctorAttachmentApp.GetDetailById(id); //var attachment = _doctorAttachmentApp.GetDetailById(id);
//string file = HostingEnvironment.MapPath(attachment.Path); //string file = HostingEnvironment.MapPath(attachment.Path);
@ -37,7 +34,7 @@ namespace IRaCIS.Application.Services
// File.Delete(temp); // File.Delete(temp);
//} //}
var success =await _attachmentrepository.BatchDeleteNoTrackingAsync(a => a.Id == param.Id); var success = await _attachmentrepository.BatchDeleteNoTrackingAsync(a => a.Id == param.Id);
return ResponseOutput.Result(success); return ResponseOutput.Result(success);
} }
@ -52,7 +49,7 @@ namespace IRaCIS.Application.Services
public async Task<IEnumerable<AttachmentDTO>> GetAttachmentByType(Guid doctorId, string type) public async Task<IEnumerable<AttachmentDTO>> GetAttachmentByType(Guid doctorId, string type)
{ {
var attachmentList = await _attachmentrepository.Where(a => a.DoctorId == doctorId && a.Type.Equals(type)).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync(); var attachmentList = await _attachmentrepository.Where(a => a.DoctorId == doctorId && a.Type.Equals(type)).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken); attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return attachmentList; return attachmentList;
} }
@ -64,11 +61,11 @@ namespace IRaCIS.Application.Services
/// <param name="types">类型数组</param> /// <param name="types">类型数组</param>
/// <returns></returns> /// <returns></returns>
[HttpPost("{doctorId:guid}")] [HttpPost("{doctorId:guid}")]
public async Task<IEnumerable<AttachmentDTO>> GetAttachmentByTypes(Guid doctorId, string[] types) public async Task<IEnumerable<AttachmentDTO>> GetAttachmentByTypes(Guid doctorId, string[] types)
{ {
var attachmentList =await _attachmentrepository.Where(a => a.DoctorId == doctorId && types.Contains(a.Type)).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync(); var attachmentList = await _attachmentrepository.Where(a => a.DoctorId == doctorId && types.Contains(a.Type)).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken); attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return attachmentList; return attachmentList;
} }
@ -81,8 +78,8 @@ namespace IRaCIS.Application.Services
[HttpGet("{doctorId:guid}")] [HttpGet("{doctorId:guid}")]
public async Task<IEnumerable<AttachmentDTO>> GetAttachments(Guid doctorId) public async Task<IEnumerable<AttachmentDTO>> GetAttachments(Guid doctorId)
{ {
var attachmentList =await _attachmentrepository.Where(a => a.DoctorId == doctorId).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync(); var attachmentList = await _attachmentrepository.Where(a => a.DoctorId == doctorId).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken); attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return attachmentList; return attachmentList;
} }
@ -91,8 +88,8 @@ namespace IRaCIS.Application.Services
public async Task<AttachmentDTO> GetDetailById(Guid attachmentId) public async Task<AttachmentDTO> GetDetailById(Guid attachmentId)
{ {
var attachment = await _attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachmentId).IfNullThrowException(); var attachment = await _attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachmentId).IfNullThrowException();
var temp= _mapper.Map<AttachmentDTO>(attachment); var temp = _mapper.Map<AttachmentDTO>(attachment);
temp.FullPath = temp.Path + "?access_token=" + _userInfo.UserToken; temp.FullPath = temp.Path + "?access_token=" + _userInfo.UserToken;
return temp; return temp;
} }
@ -134,7 +131,7 @@ namespace IRaCIS.Application.Services
//重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方 //重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方
if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2) if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2)
{ {
await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == reUpload.Id, u => new Attachment() await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == reUpload.Id, u => new Attachment()
{ {
Path = reUpload.Path, Path = reUpload.Path,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
@ -167,7 +164,7 @@ namespace IRaCIS.Application.Services
var list = _mapper.Map<IEnumerable<AttachmentDTO>>(attachments).ToList(); var list = _mapper.Map<IEnumerable<AttachmentDTO>>(attachments).ToList();
list.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken); list.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return list; return list;
} }
@ -177,7 +174,7 @@ namespace IRaCIS.Application.Services
var newAttachment = _mapper.Map<Attachment>(attachment); var newAttachment = _mapper.Map<Attachment>(attachment);
//如果这个医生不存在 这个语言的官方简历 就设置为官方简历 //如果这个医生不存在 这个语言的官方简历 就设置为官方简历
if (! await _attachmentrepository.AnyAsync(t => t.Type == "Resume" && t.DoctorId == attachment.DoctorId && t.Language == attachment.Language && t.IsOfficial)) if (!await _attachmentrepository.AnyAsync(t => t.Type == "Resume" && t.DoctorId == attachment.DoctorId && t.Language == attachment.Language && t.IsOfficial))
{ {
newAttachment.IsOfficial = true; newAttachment.IsOfficial = true;
@ -214,7 +211,7 @@ namespace IRaCIS.Application.Services
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")] [HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
public async Task<IResponseOutput> SetOfficial(Guid doctorId, Guid attachmentId, int language) public async Task<IResponseOutput> SetOfficial(Guid doctorId, Guid attachmentId, int language)
{ {
var resumeList = await _attachmentrepository.Where(t => t.DoctorId == doctorId && t.Type == "Resume" && t.Language == language,true).ToListAsync(); var resumeList = await _attachmentrepository.Where(t => t.DoctorId == doctorId && t.Type == "Resume" && t.Language == language, true).ToListAsync();
foreach (var item in resumeList) foreach (var item in resumeList)
{ {
if (item.Id == attachmentId) item.IsOfficial = true; if (item.Id == attachmentId) item.IsOfficial = true;
@ -235,7 +232,7 @@ namespace IRaCIS.Application.Services
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")] [HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
public async Task<IResponseOutput> SetLanguage(Guid doctorId, Guid attachmentId, int language) public async Task<IResponseOutput> SetLanguage(Guid doctorId, Guid attachmentId, int language)
{ {
bool result =await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == attachmentId, a => new Attachment bool result = await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == attachmentId, a => new Attachment
{ {
Language = language, Language = language,
IsOfficial = false IsOfficial = false

View File

@ -21,7 +21,7 @@
public Guid DoctorId { get; set; } public Guid DoctorId { get; set; }
public string Type { get; set; } = string.Empty; public string Type { get; set; } = string.Empty;
public string Path { get; set; } = string.Empty; public string Path { get; set; } = string.Empty;
public string FullPath => Path; public string FullPath => Path;
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
} }
@ -51,7 +51,7 @@
public Guid DoctorId { get; set; } public Guid DoctorId { get; set; }
public string Type { get; set; } = string.Empty; public string Type { get; set; } = string.Empty;
public string Path { get; set; } = string.Empty; public string Path { get; set; } = string.Empty;
public string FullPath => Path; public string FullPath => Path;
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
} }

View File

@ -1,6 +1,4 @@
using System; namespace IRaCIS.Application.Contracts
namespace IRaCIS.Application.Contracts
{ {
public class DoctorAccountRegisterModel : DoctorAccountLoginDTO public class DoctorAccountRegisterModel : DoctorAccountLoginDTO
{ {

View File

@ -1,10 +1,5 @@
using System; using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
using IRaCIS.Core.Infrastructure.Extention;
using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Linq;
namespace IRaCIS.Application.Contracts namespace IRaCIS.Application.Contracts
{ {
@ -343,9 +338,9 @@ namespace IRaCIS.Application.Contracts
//职称 //职称
public List<Guid> TitleIds => DoctorDicViewDtos.Select(t => t.Id).ToList(); public List<Guid> TitleIds => DoctorDicViewDtos.Select(t => t.Id).ToList();
public List<string> TitleList=> DoctorDicViewDtos.Select(t => t.Value).ToList(); public List<string> TitleList => DoctorDicViewDtos.Select(t => t.Value).ToList();
public List<string> TitleCNList=> DoctorDicViewDtos.Select(t => t.ValueCN).ToList(); public List<string> TitleCNList => DoctorDicViewDtos.Select(t => t.ValueCN).ToList();
#region ef select #region ef select
//[JsonIgnore] //[JsonIgnore]
@ -403,7 +398,7 @@ namespace IRaCIS.Application.Contracts
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string TrialCode { get; set; } = string.Empty; public string TrialCode { get; set; } = string.Empty;
public string FilePath { get; set; } = string.Empty; public string FilePath { get; set; } = string.Empty;
public string FullPath { get { return FilePath; } } public string FullPath { get { return FilePath; } }
public DateTime CreateTime { get; set; } public DateTime CreateTime { get; set; }
} }
@ -789,7 +784,7 @@ namespace IRaCIS.Application.Contracts
public class GetDoctorCriterionFileInDto public class GetDoctorCriterionFileInDto
{ {
public Guid DoctorId { get; set; } public Guid DoctorId { get; set; }
/// <summary> /// <summary>
/// 文件类型 /// 文件类型

View File

@ -1,7 +1,4 @@
using System; namespace IRaCIS.Application.Contracts
using System.Collections.Generic;
namespace IRaCIS.Application.Contracts
{ {
public class EducationCommand public class EducationCommand
{ {
@ -28,7 +25,7 @@ namespace IRaCIS.Application.Contracts
public class EducationInfoViewModel : EducationCommand public class EducationInfoViewModel : EducationCommand
{ {
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
public string BeginDateStr => BeginDate.ToString("yyyy-MM"); public string BeginDateStr => BeginDate.ToString("yyyy-MM");
public string EndDateStr => EndDate.ToString("yyyy-MM"); public string EndDateStr => EndDate.ToString("yyyy-MM");
} }
@ -72,7 +69,7 @@ namespace IRaCIS.Application.Contracts
} }
public class PostgraduateViewModel: PostgraduateCommand public class PostgraduateViewModel : PostgraduateCommand
{ {
public DateTime? CreateTime { get; set; } public DateTime? CreateTime { get; set; }
public string BeginDateStr => BeginDate.ToString("yyyy-MM"); public string BeginDateStr => BeginDate.ToString("yyyy-MM");
@ -81,9 +78,9 @@ namespace IRaCIS.Application.Contracts
} }
public class DoctorEducationExperienceDTO public class DoctorEducationExperienceDTO
{ {
public IEnumerable<EducationInfoViewModel> EducationList=new List<EducationInfoViewModel>(); public IEnumerable<EducationInfoViewModel> EducationList = new List<EducationInfoViewModel>();
public IEnumerable<PostgraduateViewModel> PostgraduateList = new List<PostgraduateViewModel>(); public IEnumerable<PostgraduateViewModel> PostgraduateList = new List<PostgraduateViewModel>();
} }
} }

View File

@ -1,6 +1,4 @@
using System; namespace IRaCIS.Application.Contracts
namespace IRaCIS.Application.Contracts
{ {
public class VacationCommand public class VacationCommand
{ {

View File

@ -1,6 +1,4 @@
using System; namespace IRaCIS.Application.Contracts
namespace IRaCIS.Application.Contracts
{ {
public class ResearchPublicationDTO public class ResearchPublicationDTO
{ {

Some files were not shown because too many files have changed in this diff Show More