Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-10-15 10:03:49 +08:00
commit 2208e1dbe5
15 changed files with 18077 additions and 298 deletions

View File

@ -108,7 +108,7 @@ builder.Services.AddEFSetup(_configuration, enviromentName);
//Http 响应压缩
builder.Services.AddResponseCompressionSetup();
//Swagger Api 文档
builder.Services.AddSwaggerSetup();
builder.Services.AddSwaggerSetupOld();
//JWT Token 验证
builder.Services.AddJWTAuthSetup(_configuration);

View File

@ -1,139 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Filters;
using Swashbuckle.AspNetCore.SwaggerGen;
using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
namespace IRaCIS.Core.API
{
public static class SwaggerSetup
{
public static void AddSwaggerSetup(this IServiceCollection services)
{
services.AddSwaggerGen(options =>
{
//此处的Name 是控制器上分组的名称 Title是界面的大标题
//分组
options.SwaggerDoc("Reviewer", new OpenApiInfo { Title = "医生模块", Version = "Reviewer", });
options.SwaggerDoc("Trial", new OpenApiInfo { Title = "项目模块", Version = "Trial" });
options.SwaggerDoc("Enroll", new OpenApiInfo { Title = "入组模块", Version = "Enroll" });
options.SwaggerDoc("Workload", new OpenApiInfo { Title = "工作量模块", Version = "Workload" });
options.SwaggerDoc("Common", new OpenApiInfo { Title = "通用信息获取", Version = "Common" });
options.SwaggerDoc("Institution", new OpenApiInfo { Title = "机构信息模块", Version = "Institution" });
options.SwaggerDoc("Dashboard&Statistics", new OpenApiInfo { Title = "统计模块", Version = "Dashboard&Statistics" });
options.SwaggerDoc("Financial", new OpenApiInfo { Title = "财务模块", Version = "Financial" });
options.SwaggerDoc("Management", new OpenApiInfo { Title = "管理模块", Version = "Management" });
options.SwaggerDoc("Image", new OpenApiInfo { Title = "影像模块", Version = "Image" });
options.SwaggerDoc("Reading", new OpenApiInfo { Title = "读片模块", Version = "Reading" });
// Add "General" fallback group for ungrouped APIs
//options.SwaggerDoc("General", new OpenApiInfo { Title = "未分类模块", Version = "General" });
// 接口排序
options.OrderActionsBy(o => o.GroupName);
options.DocInclusionPredicate((docName, apiDes) =>
{
if (!apiDes.TryGetMethodInfo(out MethodInfo methodInfo)) return false;
var versions = methodInfo.DeclaringType.GetCustomAttributes(true)
.OfType<ApiExplorerSettingsAttribute>()
.Select(attr => attr.GroupName);
//return versions.Any(v => v == docName) || (docName == "General" && !versions.Any());
return versions.Any(v => v.ToString() == docName);
});
var xmlPath = Path.Combine(AppContext.BaseDirectory, "IRaCIS.Core.API.xml");//这个就是刚刚配置的xml文件名
options.IncludeXmlComments(xmlPath, true);
var xmlPath2 = Path.Combine(AppContext.BaseDirectory, "IRaCIS.Core.Application.xml");//这个就是刚刚配置的xml文件名
options.IncludeXmlComments(xmlPath2, true);
//默认的第二个参数是false这个是controller的注释记得修改
// 在header中添加token传递到后台
options.OperationFilter<SecurityRequirementsOperationFilter>();
// 添加登录按钮
options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
//In = "header",
//Type = "apiKey"
});
//// Bearer
//options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
//{
// Description = "JWT Authorization header using the Bearer scheme.",
// Name = "Authorization",
// In = ParameterLocation.Header,
// Scheme = "bearer",
// Type = SecuritySchemeType.Http,
// BearerFormat = "JWT"
//});
});
}
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(options =>
{
//此处的Name 是页面 选择文档下拉框 显示的名称
options.SwaggerEndpoint($"swagger/Reviewer/swagger.json", "医生模块");
options.SwaggerEndpoint($"swagger/Trial/swagger.json", "项目模块");
options.SwaggerEndpoint($"swagger/Enroll/swagger.json", "入组模块");
options.SwaggerEndpoint($"swagger/Workload/swagger.json", "工作量模块");
options.SwaggerEndpoint($"swagger/Dashboard&Statistics/swagger.json", "统计模块");
options.SwaggerEndpoint($"swagger/Common/swagger.json", "通用模块");
options.SwaggerEndpoint($"swagger/Financial/swagger.json", "财务模块");
options.SwaggerEndpoint($"swagger/Institution/swagger.json", "机构信息模块");
options.SwaggerEndpoint($"swagger/Management/swagger.json", "管理模块");
options.SwaggerEndpoint($"swagger/Image/swagger.json", "影像模块");
options.SwaggerEndpoint($"swagger/Reading/swagger.json", "读片模块");
//路径配置设置为空表示直接在根域名localhost:8001访问该文件,
//注意localhost:8001/swagger是访问不到的去launchSettings.json把launchUrl去掉如果你想换一个路径直接写名字即可比如直接写c.Route = "doc";
//options.RoutePrefix = string.Empty;
var data = Assembly.GetExecutingAssembly().Location;
options.IndexStream = () => Assembly.GetExecutingAssembly()
.GetManifestResourceStream("IRaCIS.Core.API.wwwroot.swagger.ui.Index.html");
options.RoutePrefix = string.Empty;
//DocExpansion设置为none可折叠所有方法
options.DocExpansion(DocExpansion.None);
//DefaultModelsExpandDepth设置为 - 1 可不显示models
options.DefaultModelsExpandDepth(-1);
// 引入静态文件添加登录功能
// 清除静态文件缓存
// options.IndexStream = () => null;
});
}
}
}

View File

@ -0,0 +1,203 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.Filters;
using Swashbuckle.AspNetCore.SwaggerGen;
using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
namespace IRaCIS.Core.API;
public enum SwaggerVersion
{
[Description("医生模块")]
Reviewer = 1,
[Description("项目模块")]
Trial = 2,
[Description("入组模块")]
Enroll = 3,
[Description("工作量模块")]
Workload = 4,
[Description("通用信息获取")]
Common = 5,
[Description("机构信息模块")]
Institution = 6,
[Description("统计模块")]
DashboardStatistics = 7,
[Description("财务模块")]
Financial = 8,
[Description("管理模块")]
Management =9,
[Description("影像模块")]
Image =10,
[Description("读片模块")]
Reading =11
};
public static class SwaggerSetup
{
public static void AddSwaggerSetupOld(this IServiceCollection services)
{
services.AddEndpointsApiExplorer();
services.AddSwaggerGen(options =>
{
typeof(SwaggerVersion).GetFields(BindingFlags.Public | BindingFlags.Static).ToList()
.ForEach(field =>
{
var description = field.GetCustomAttribute<DescriptionAttribute>()?.Description ?? field.Name;
options.SwaggerDoc(field.Name, new Microsoft.OpenApi.Models.OpenApiInfo
{
Version = field.Name,
Description = $"{field.Name} API",
Title = description // 使用Description作为Title
});
});
// 接口排序
options.OrderActionsBy(o => o.GroupName);
options.DocInclusionPredicate((docName, apiDes) =>
{
if (!apiDes.TryGetMethodInfo(out MethodInfo methodInfo)) return false;
var versions = methodInfo.DeclaringType.GetCustomAttributes(true)
.OfType<ApiExplorerSettingsAttribute>()
.Select(attr => attr.GroupName);
return versions.Any(v => v.ToString() == docName);
});
//添加注释
var basePath = AppContext.BaseDirectory;
var xmlPath1 = Path.Combine(basePath, "IRaCIS.Core.Application.xml");
var xmlPath2 = Path.Combine(basePath, "IRaCIS.Core.API.xml");
options.IncludeXmlComments(xmlPath1, true);
options.IncludeXmlComments(xmlPath2, true);
// 在header中添加token传递到后台
options.OperationFilter<SecurityRequirementsOperationFilter>();
// 添加登录按钮
options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
//In = "header",
//Type = "apiKey"
});
//// 添加登录按钮
//options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
//{
// Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
// Name = "Authorization",
// //In = "header",
// //Type = "apiKey"
//});
});
}
public static void AddSwaggerSetup(this IServiceCollection services)
{
services.AddEndpointsApiExplorer();
services.AddSwaggerGen(options =>
{
typeof(SwaggerVersion).GetFields(BindingFlags.Public | BindingFlags.Static).ToList()
.ForEach(field =>
{
var description = field.GetCustomAttribute<DescriptionAttribute>()?.Description ?? field.Name;
options.SwaggerDoc(field.Name, new Microsoft.OpenApi.Models.OpenApiInfo
{
Version = field.Name,
Description = $"{field.Name} API",
Title = description // 使用Description作为Title
});
});
// 接口排序
options.OrderActionsBy(o => o.GroupName);
options.DocInclusionPredicate((docName, apiDes) =>
{
if (!apiDes.TryGetMethodInfo(out MethodInfo methodInfo)) return false;
var versions = methodInfo.DeclaringType.GetCustomAttributes(true)
.OfType<ApiExplorerSettingsAttribute>()
.Select(attr => attr.GroupName);
return versions.Any(v => v.ToString() == docName);
});
//添加注释
var basePath = AppContext.BaseDirectory;
var xmlPath1 = Path.Combine(basePath, "IRaCIS.Core.Application.xml");
var xmlPath2 = Path.Combine(basePath, "IRaCIS.Core.API.xml");
options.IncludeXmlComments(xmlPath1, true);
options.IncludeXmlComments(xmlPath2, true);
// 在header中添加token传递到后台
options.OperationFilter<SecurityRequirementsOperationFilter>();
// 添加登录按钮
options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
{
Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
Name = "Authorization",
//In = "header",
//Type = "apiKey"
});
});
}
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseSwagger();
app.UseSwaggerUI(options =>
{
typeof(SwaggerVersion).GetFields(BindingFlags.Public | BindingFlags.Static).ToList()
.ForEach(field =>
{
var description = field.GetCustomAttribute<DescriptionAttribute>()?.Description ?? field.Name;
options.SwaggerEndpoint($"swagger/{field.Name}/swagger.json", $"{description}");
});
var data = Assembly.GetExecutingAssembly().Location;
options.IndexStream = () => Assembly.GetExecutingAssembly()
.GetManifestResourceStream("IRaCIS.Core.API.wwwroot.swagger.ui.Index.html");
//路径配置设置为空表示直接在根域名localhost:8001访问该文件,
//注意localhost:8001/swagger是访问不到的去launchSettings.json把launchUrl去掉如果你想换一个路径直接写名字即可比如直接写c.Route = "doc";
options.RoutePrefix = string.Empty;
options.RoutePrefix = string.Empty;
//DocExpansion设置为none可折叠所有方法
options.DocExpansion(DocExpansion.None);
//DefaultModelsExpandDepth设置为 - 1 可不显示models
options.DefaultModelsExpandDepth(-1);
});
}
}

View File

@ -43,7 +43,7 @@
"AccessKeyId": "AKIAW3MEAFJX7IPXISP4",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-lili-uat-store",
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com/",
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com",
"DurationSeconds": 7200
}
},

View File

@ -846,16 +846,6 @@
<param name="_trialRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetCommonEvaluationDetailList_Export(IRaCIS.Core.Application.ViewModel.VisitTaskQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<summary>
阅片结果明细表
</summary>
<param name="inQuery"></param>
<param name="_commonDocumentRepository"></param>
<param name="_dictionaryService"></param>
<param name="_trialRepository"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.DictionaryService">
<summary>
数据字典-基础数据维护

View File

@ -463,12 +463,21 @@ namespace IRaCIS.Core.Application.ViewModel
public bool? IsEffect { get; set; }
public string? RequestReReadingReason { get; set; }
public ReadingExportType? ReadingExportType { get; set; }
}
public enum ReadingExportType
{
ReadingResult=0,
ReadingDetailResult=1,
JudgeReadingDetailResult=2
}

View File

@ -2044,7 +2044,7 @@ namespace IRaCIS.Core.Application.Service.Common
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect)
var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect && t.TaskState==TaskState.Freeze))
//访视和全局查询已签名完成的,裁判可以是未签名,未完成的
.Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Judge))
@ -2066,10 +2066,19 @@ namespace IRaCIS.Core.Application.Service.Common
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate)
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1))
.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
.ProjectTo<CommonEvaluationExport>(_mapper.ConfigurationProvider, new { readingExportType=inQuery.ReadingExportType, criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
if (inQuery.ReadingExportType == ReadingExportType.JudgeReadingDetailResult)
{
//R1 R2 两个人的访视都阅片完成了才可以,去除只有一个人阅片完成的访视
//找到只有一个人阅片的受试者 和访视
var exceptVisit = list.GroupBy(t => new { t.SubjectCode, t.TaskName }).Where(g => g.Count() == 1).Select(g => new { g.Key.SubjectCode, g.Key.TaskName }).ToList();
list = list.Where(t => !exceptVisit.Any(ev => ev.SubjectCode == t.SubjectCode && ev.TaskName == t.TaskName)).ToList();
}
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
exportInfo.CriterionName = criterion.CriterionName;
@ -2083,58 +2092,15 @@ namespace IRaCIS.Core.Application.Service.Common
TempalteLastColumnIndex = 8,
DynamicItemDicName = "TranslateDicName",
DynamicItemValueName = "QuestionValue",
DynamicListName = "JudgeQuestionAnswerList",
DynamicListName = "QuestionAnswerList",
RemoveColunmIndexList = new List<int>() { 1, 7 },
ColumnNameList = list.FirstOrDefault()?.JudgeQuestionAnswerList.Select(t => t.QuestionName).ToList() ?? new List<string>(),
TranslateDicNameList = list.FirstOrDefault()?.JudgeQuestionAnswerList.Select(t => t.TranslateDicName).ToList() ?? new List<string>()
ColumnNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.QuestionName).ToList() ?? new List<string>(),
TranslateDicNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.TranslateDicName).ToList() ?? new List<string>()
};
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(StaticData.Export.CommonReading_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
#region 废弃
//var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
//var dynamicTranslateDataList = await _dictionaryService.GetBasicDataSelect(list.FirstOrDefault()?.JudgeQuestionAnswerList.Select(t => t.JudgeTranslateDicName).Distinct().ToArray());
//// 使用NPOI 进行二次处理
//var wb = new XSSFWorkbook(memoryStream);
//var sheet = wb.GetSheetAt(0);
//foreach (var itemResult in list)
//{
// var index = list.IndexOf(itemResult);
// //从第四行开始处理动态列
// var row = sheet.GetRow(index + 3);
// foreach (var item in itemResult.JudgeQuestionAnswerList)
// {
// var writeIndex = itemResult.JudgeQuestionAnswerList.IndexOf(item) + dynamicColumnConfig.AutoColumnStartIndex;
// if (item.JudgeTranslateDicName.IsNotNullOrEmpty())
// {
// var translateData = dynamicTranslateDataList[item.JudgeTranslateDicName].Where(t => t.Code.ToLower() == item.JudgeQuestionValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
// row.GetCell(writeIndex).SetCellValue(translateData);
// }
// else
// {
// row.GetCell(writeIndex).SetCellValue(item.JudgeQuestionValue);
// }
// }
//}
//var memoryStream2 = new MemoryStream();
//wb.Write(memoryStream2, true);
//memoryStream2.Seek(0, SeekOrigin.Begin);
#endregion
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
FileDownloadName = $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}_{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
@ -2185,74 +2151,7 @@ namespace IRaCIS.Core.Application.Service.Common
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
//R1 R2 两个人的访视都阅片完成了才可以,去除只有一个人阅片完成的访视
//找到只有一个人阅片的受试者 和访视
var exceptVisit = list.GroupBy(t => new { t.SubjectCode, t.TaskName }).Where(g => g.Count() == 1).Select(g => new { g.Key.SubjectCode, g.Key.TaskName }).ToList();
list = list.Where(t => !exceptVisit.Any(ev => ev.SubjectCode == t.SubjectCode && ev.TaskName == t.TaskName)).ToList();
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
exportInfo.CriterionName = criterion.CriterionName;
//处理裁判标记
list = DealJudgeMark(criterion.ArbitrationRule, list);
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId);
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
var dynamicColumnConfig = new DynamicColumnConfig() { AutoColumnTitleRowIndex = 2, AutoColumnStartIndex = 6, ColumnNameList = list.FirstOrDefault()?.JudgeQuestionAnswerList.Select(t => t.QuestionName).ToList() };
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(StaticData.Export.CommonJudgeReadingDetail_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
FileDownloadName = $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}_{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
};
}
/// <summary>
/// 阅片结果明细表
/// </summary>
/// <param name="inQuery"></param>
/// <param name="_commonDocumentRepository"></param>
/// <param name="_dictionaryService"></param>
/// <param name="_trialRepository"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> GetCommonEvaluationDetailList_Export(VisitTaskQuery inQuery,
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,
[FromServices] IDictionaryService _dictionaryService,
[FromServices] IRepository<Trial> _trialRepository)
{
//每次查询必须是单标准的
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
var list = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect)
//访视和全局查询已签名完成的,裁判可以是未签名,未完成的
.Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Judge))
//.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
//.WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState)
//.WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis)
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent)
.WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId)
.WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory)
.WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState)
.WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState)
.WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum)
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false))
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName))
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate)
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1))
.ProjectTo<CommonEvaluationDetailExport>(_mapper.ConfigurationProvider, new { criterionType = criterion.CriterionType, arbitrationRule = criterion.ArbitrationRule, trialReadingCriterionId = inQuery.TrialReadingCriterionId, isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
exportInfo.CriterionName = criterion.CriterionName;
@ -2265,7 +2164,7 @@ namespace IRaCIS.Core.Application.Service.Common
var dynamicColumnConfig = new DynamicColumnConfig() { AutoColumnTitleRowIndex = 2, AutoColumnStartIndex = 6, ColumnNameList = list.FirstOrDefault()?.QuestionAnswerList.Select(t => t.QuestionName).ToList() };
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(StaticData.Export.CommonReadingDetail_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(StaticData.Export.CommonJudgeReadingDetail_Export, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(CommonEvaluationExport), criterion.CriterionType, dynamicColumnConfig);
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
@ -2275,6 +2174,7 @@ namespace IRaCIS.Core.Application.Service.Common
}
[HttpPost]
public async Task<IActionResult> GetCommonJudgeRatioList_Export(VisitTaskQuery inQuery,
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,

View File

@ -1068,11 +1068,6 @@ namespace IRaCIS.Core.Application.Contracts
public string TranslateDicName { get; set; }
}
public class CommonEvaluationExport : OverallTumorEvaluationExport
{
public List<CommonQuesionInfo> JudgeQuestionAnswerList { get; set; }
}
public class CommonEvaluationDetailExport : OverallTumorEvaluationExport
{
public List<CommonQuesionInfo> QuestionAnswerList { get; set; }
}

View File

@ -4,6 +4,7 @@ using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.DTO;
using IRaCIS.Core.Application.MassTransit.Command;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Service
@ -198,6 +199,8 @@ namespace IRaCIS.Core.Application.Service
Guid trialReadingCriterionId = Guid.Empty;
ArbitrationRule? arbitrationRule = null;
CriterionType? criterionType = null;
ReadingExportType? readingExportType=null;
CreateMap<VisitTask, OverallTumorEvaluationExport>()
// .ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))
.ForMember(o => o.IsBaseline, t => t.MapFrom(u => u.SourceSubjectVisit.IsBaseLine))
@ -223,6 +226,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code))
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName));
CreateMap<VisitTask, CommonEvaluationExport>()
.ForMember(o => o.IsBaseline, t => t.MapFrom(u => u.SourceSubjectVisit.IsBaseLine))
@ -236,7 +240,9 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code))
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
.ForMember(o => o.JudgeQuestionAnswerList, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(k => k.ReadingQuestionTrial.ShowOrder)
.ForMember(o => o.QuestionAnswerList, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList
.Where(c => readingExportType == ReadingExportType.ReadingDetailResult ? c.ReadingQuestionTrial.IsJudgeQuestion : c.ReadingQuestionTrial.IsJudgeQuestion)
.OrderBy(k => k.ReadingQuestionTrial.ShowOrder)
.Select(c => new CommonQuesionInfo()
{
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
@ -244,27 +250,6 @@ namespace IRaCIS.Core.Application.Service
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode
})));
CreateMap<VisitTask, CommonEvaluationDetailExport>()
.ForMember(o => o.IsBaseline, t => t.MapFrom(u => u.SourceSubjectVisit.IsBaseLine))
.ForMember(o => o.JudgeArmEnum, t => t.MapFrom(u => u.JudgeResultTask.ArmEnum))
.ForMember(o => o.IsTrigerJudge, t => t.MapFrom(u => arbitrationRule == ArbitrationRule.Visit ? u.JudgeResultTaskId != null :
(arbitrationRule == ArbitrationRule.Reading ?
u.Subject.SubjectVisitTaskList.Any(t => t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && u.VisitTaskNum < t.VisitTaskNum) :
false)))
.ForMember(o => o.JudgeNote, t => t.MapFrom(u => u.JudgeResultRemark))
.ForMember(o => o.VisitNote, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).FirstOrDefault()!.Answer))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code))
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
.ForMember(o => o.QuestionAnswerList, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(k => k.ReadingQuestionTrial.ShowOrder)
.Select(c => new CommonQuesionInfo()
{
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
QuestionValue = c.Answer,
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode
})));
CreateMap<VisitTask, RECIST1Point1EvaluationOfTumorEfficacyExport>().IncludeBase<VisitTask, OverallTumorEvaluationExport>()
.ForMember(o => o.TargetlesionEvaluationResult, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.TargetLesion).FirstOrDefault()!.Answer))

View File

@ -9,7 +9,7 @@ namespace IRaCIS.Core.Application.Service
/// Dashboard统计、全局工作量统计、入组两个维度统计按照项目、按照人
/// </summary>
[ApiExplorerSettings(GroupName = "Dashboard&Statistics")]
[ApiExplorerSettings(GroupName = "DashboardStatistics")]
public class StatisticsService(IRepository<Doctor> _doctorRepository,
IRepository<Trial> _trialRepository,
IRepository<Enroll> _enrollRepository,

View File

@ -16,6 +16,7 @@ using Medallion.Threading;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -40,7 +41,7 @@ namespace IRaCIS.Core.Application.Service
public TestMinimalApiService()
{
RouteHandlerBuilder = t => {
t.WithGroupName("TestMinimalApi").WithOpenApi();
t.WithOpenApi();
};
}

View File

@ -30,5 +30,6 @@ public class UserFeedBack : BaseFullAuditEntity
public Guid? TrialSiteId { get; set; }
public Guid? TrialId { get; set; }
[MaxLength]
public string ScreenshotListStr { get; set; } = string.Empty;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class UserFeedBackLength : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ScreenshotListStr",
table: "UserFeedBack",
type: "nvarchar(max)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(400)",
oldMaxLength: 400);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ScreenshotListStr",
table: "UserFeedBack",
type: "nvarchar(400)",
maxLength: 400,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
}
}
}

View File

@ -12544,8 +12544,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<string>("ScreenshotListStr")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
.HasColumnType("nvarchar(max)");
b.Property<int>("State")
.HasColumnType("int");