Compare commits

..

9 Commits

Author SHA1 Message Date
hang 5ee8a3db21 迁移修改数据库连接地址
continuous-integration/drone/push Build is failing Details
2023-12-22 18:01:29 +08:00
hang 3c41789ba9 修改导表 5 2023-12-20 16:44:40 +08:00
hang d2268f0706 裁判任务失效的时候,清理裁判任务id 需要迁移 2023-12-20 16:44:36 +08:00
hang e8496df81a 修改模板文件位置 4 2023-12-20 16:43:49 +08:00
hang 3e24fe9461 修改路径bug 3 2023-12-20 16:43:45 +08:00
hang d771ab0f6f 修改文档删除2 2023-12-20 16:43:39 +08:00
hang 29dfa03d0f 修改导表时间格式2 2023-12-20 16:43:34 +08:00
hang 44e9b211c2 更新模板的时候,清理之前的文档,需要迁移 2023-12-20 16:43:29 +08:00
hang b1154ea594 修改导表时间格式 2023-12-20 16:43:25 +08:00
7 changed files with 213 additions and 30 deletions

View File

@ -30,8 +30,8 @@
},
"ConnectionStrings": {
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true",
"Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
"RemoteNew": "Server=101.132.193.237,1435;Database=Test_Study;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
"Hangfire": "Server=101.132.193.237,1435;Database=Test_Study_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
},
"BasicSystemConfig": {

View File

@ -16,6 +16,7 @@ using NPOI.HPSF;
using NPOI.HSSF.UserModel;
using NPOI.XSSF.UserModel;
using SkiaSharp;
using System.Collections;
using System.IO;
namespace IRaCIS.Core.Application.Service;
@ -52,21 +53,24 @@ public static class ExcelExportHelper
var translateDataList = await _dictionaryService.GetBasicDataSelect(needTranslatePropertyList.Select(t => t.DicParentCode).Distinct().ToArray());
var dic = (JsonConvert.DeserializeObject<IDictionary<string, object>>(data.ToJsonNotIgnoreNull())).IfNullThrowException();
var dic = data.ConvertToDictionary();
foreach (var key in dic.Keys)
{
//是数组 那么找到对应的属性 进行翻译
if (dic[key].GetType().IsAssignableFrom(typeof(JArray)))
if (dic[key].GetType().GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>)))
{
var newObjList = new List<object>();
var no = 1;
foreach (var item in dic[key] as JArray)
foreach (var item in dic[key] as IList )
{
var itemDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(item.ToJsonNotIgnoreNull());
//var itemDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(item.ToJsonNotIgnoreNull());
var itemDic = item.ConvertToDictionary();
foreach (var needTranslateProperty in needTranslatePropertyList)
@ -74,7 +78,7 @@ public static class ExcelExportHelper
//翻译的属性依赖其他属性
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
{
if (item[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
@ -232,29 +236,30 @@ public static class ExcelExportHelper
var translateDataList = await _dictionaryService.GetBasicDataSelect(needTranslatePropertyList.Select(t => t.DicParentCode).Distinct().ToArray());
var dic = (JsonConvert.DeserializeObject<IDictionary<string, object>>(data.ToJsonNotIgnoreNull())).IfNullThrowException();
var dic = data.ConvertToDictionary();
//var dic = (JsonConvert.DeserializeObject<IDictionary<string, object>>(data.ToJsonNotIgnoreNull())).IfNullThrowException();
foreach (var key in dic.Keys)
{
//是数组 那么找到对应的属性 进行翻译
if (dic[key].GetType().IsAssignableFrom(typeof(JArray)))
if (dic[key].GetType().GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>)))
//if (dic[key].GetType().IsAssignableFrom(typeof(JArray)))
{
var newObjList = new List<object>();
var no = 1;
foreach (var item in dic[key] as JArray)
foreach (var item in dic[key] as IList)
//foreach (var item in dic[key] as JArray)
{
var itemDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(item.ToJsonNotIgnoreNull());
//var itemDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(item.ToJsonNotIgnoreNull());
var itemDic = item.ConvertToDictionary();
foreach (var needTranslateProperty in needTranslatePropertyList)
{
//翻译的属性依赖其他属性
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
{
if (item[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
{
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();

View File

@ -164,7 +164,7 @@ public static class FileStoreHelper
{
var rootPath = GetIRaCISRootPath(_hostEnvironment);
var physicalFilePath = Path.Combine(rootPath, relativePath.Trim('/'));
var physicalFilePath = Path.Combine(rootPath, relativePath.TrimStart('/'));
return physicalFilePath;
}

View File

@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Application.Contracts;
namespace IRaCIS.Core.Application.Service
{
@ -99,14 +100,36 @@ namespace IRaCIS.Core.Application.Service
//---读取模板内容失败, 请将文件另存为docx格式尝试!
return ResponseOutput.NotOk(_localizer["Document_ TemplateRead"]);
}
}
}
var entity = await _commonDocumentRepository.InsertOrUpdateAsync(addOrEditCommonDocument, true, verifyExp1, verifyExp2);
return ResponseOutput.Ok(entity.Id.ToString());
if (addOrEditCommonDocument.Id == null) //insert
{
var entity = await _commonDocumentRepository.InsertFromDTOAsync(addOrEditCommonDocument, true, verifyExp1, verifyExp2);
return ResponseOutput.Ok(entity.Id.ToString());
}
else //update
{
var dbbeforeEntity = await _commonDocumentRepository.UpdateFromDTOAsync(addOrEditCommonDocument, true, true, verifyExp1, verifyExp2);
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, dbbeforeEntity.Path);
if (File.Exists(filePath))
{
File.Delete(filePath);
}
return ResponseOutput.Ok();
}
}
@ -114,7 +137,20 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{commonDocumentId:guid}")]
public async Task<IResponseOutput> DeleteCommonDocument(Guid commonDocumentId)
{
var find= await _commonDocumentRepository.FirstOrDefaultNoTrackingAsync(t=>t.Id== commonDocumentId);
var success = await _commonDocumentRepository.DeleteFromQueryAsync(t => t.Id == commonDocumentId, true,true);
if (find != null)
{
var filePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, find.Path);
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
return ResponseOutput.Ok();
}

View File

@ -22,14 +22,14 @@ namespace IRaCIS.Application.Contracts
[DictionaryTranslateAttribute("IsUserExitTrial")]
public bool IsDeleted { get; set; }
[ExcelFormat("yyyy-MM-dd hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd HH:mm:ss")]
public DateTime? DeletedTime { get; set; }
public Guid? SiteId { get; set; }
public string Phone { get; set; } = String.Empty;
public DateTime UpdateTime { get; set; }
[ExcelFormat("yyyy-MM-dd hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd HH:mm:ss")]
public DateTime CreateTime { get; set; }
@ -84,7 +84,7 @@ namespace IRaCIS.Application.Contracts
[ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd hh:mm:ss")]
[ExcelFormat("yyyy-MM-dd HH:mm:ss")]
public DateTime CreateTime { get; set; }
@ -118,7 +118,8 @@ namespace IRaCIS.Application.Contracts
public class ExcelExportInfo : TrialSelectDTO
{
public DateTime CurrentTime { get; set; } = DateTime.Now;
public string CurrentTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public bool IsEn_US { get; set; }

View File

@ -22,13 +22,14 @@ namespace IRaCIS.Core.Application.Triggers
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
private readonly IRepository<SubjectAdditionalEvaluationResult> _subjectAdditionalEvaluationResultRepository;
private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository;
public VisitTaskIsFrontTaskNeedSignButNotSignTrigger(
IRepository<VisitTask> visitTaskRepository, IRepository<ReadingQuestionCriterionTrial> trialReadingCriterionRepository, IRepository<ReadingQuestionTrial> trialReadingQuestionRepository
, IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository)
, IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository, IRepository<SubjectAdditionalEvaluationResult> subjectAdditionalEvaluationResultRepository, IRepository<ReadingJudgeInfo> readingJudgeInfoRepository)
{
_trialReadingCriterionRepository = trialReadingCriterionRepository;
@ -36,6 +37,8 @@ namespace IRaCIS.Core.Application.Triggers
_trialReadingQuestionRepository = trialReadingQuestionRepository;
_readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
_subjectAdditionalEvaluationResultRepository = subjectAdditionalEvaluationResultRepository;
_readingJudgeInfoRepository = readingJudgeInfoRepository;
}
@ -98,7 +101,120 @@ namespace IRaCIS.Core.Application.Triggers
}
}
else if (context.ChangeType == ChangeType.Modified)
{
if (visitTask.ReadingCategory == ReadingCategory.Judge && (visitTask.TaskState == TaskState.Adbandon || visitTask.TaskState == TaskState.HaveReturned))
{
var find = _readingJudgeInfoRepository.Where(t => t.JudgeTaskId == visitTask.Id).FirstOrDefault();
if (find != null)
{
var ids = new Guid[] { find.TaskIdOne, find.TaskIdTwo };
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => ids.Contains(t.Id), u => new VisitTask() { JudgeResultTaskId = null });
}
}
}
#region 附加评估 暂时废弃
// //从未签名状态 改为签名状态时 判断是否进行了附加评估,将附加评估的结果冗余
// if (context.ChangeType == ChangeType.Modified && visitTask.ReadingTaskState == ReadingTaskState.HaveSigned && context.UnmodifiedEntity.ReadingTaskState != ReadingTaskState.HaveSigned)
// {
// var criterion = _trialReadingCriterionRepository.Where(t => t.Id == visitTask.TrialReadingCriterionId).FirstOrDefault();
// //如果是附加评估
// if (criterion.IsAdditionalAssessment)
// {
// if (visitTask.ReadingCategory == ReadingCategory.Visit)
// {
// switch (criterion.CriterionType)
// {
// case CriterionType.RECIST1Point1:
// var isbaseLine = _visitTaskRepository.Where(t => t.Id == visitTask.Id).Select(t => t.SourceSubjectVisit.IsBaseLine).FirstOrDefault();
// if (isbaseLine)
// {
// var currentTaskAdditionarlAnswer = await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == visitTask.Id &&
// t.ReadingQuestionTrial.IsAdditional == true && t.ReadingQuestionTrial.Type != "group"
// ).Include(t => t.ReadingQuestionTrial).FirstOrDefaultAsync();
// //双重阅片完成了
// if (criterion.ReadingType == ReadingMethod.Double &&
//(_visitTaskRepository.Where(t => t.SubjectId == visitTask.SubjectId && t.TaskName == visitTask.TaskName && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() == 2)
// )
// {
// var otherTaskId = await _visitTaskRepository.Where(t => t.SubjectId == visitTask.SubjectId && t.TaskName == visitTask.TaskName && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.Id != visitTask.Id)
// .Select(t => t.Id).FirstOrDefaultAsync();
// var otherTaskAdditionarlAnswer = await _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == otherTaskId &&
// t.ReadingQuestionTrial.IsAdditional == true && t.ReadingQuestionTrial.Type != "group"
// ).Include(t => t.ReadingQuestionTrial).FirstOrDefaultAsync();
// await _subjectAdditionalEvaluationResultRepository.AddAsync(new SubjectAdditionalEvaluationResult()
// {
// TrialReadingCriterionId = visitTask.TrialReadingCriterionId,
// IsFinalResult = true,
// SubjectId = visitTask.SubjectId,
// TrialReadingQuestionId = currentTaskAdditionarlAnswer.ReadingQuestionTrialId,
// FinalAnswer = currentTaskAdditionarlAnswer.Answer,
// FinalTranslateDictionaryCode = currentTaskAdditionarlAnswer.ReadingQuestionTrial.DictionaryCode,
// });
// }
// if (criterion.ReadingType == ReadingMethod.Single)
// {
// await _subjectAdditionalEvaluationResultRepository.AddAsync(new SubjectAdditionalEvaluationResult()
// {
// TrialReadingCriterionId = visitTask.TrialReadingCriterionId,
// IsFinalResult = true,
// SubjectId = visitTask.SubjectId,
// TrialReadingQuestionId = currentTaskAdditionarlAnswer.ReadingQuestionTrialId,
// FinalAnswer = currentTaskAdditionarlAnswer.Answer,
// FinalTranslateDictionaryCode = currentTaskAdditionarlAnswer.ReadingQuestionTrial.DictionaryCode,
// });
// }
// }
// break;
// default:
// break;
// }
// }
// }
// }
#endregion
}

View File

@ -1,5 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace IRaCIS.Core.Infrastructure.Extention
{
@ -38,7 +40,30 @@ namespace IRaCIS.Core.Infrastructure.Extention
public static string ToJsonNotIgnoreNull(this object obj)
{
return JsonConvert.SerializeObject(obj, new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss", ReferenceLoopHandling = ReferenceLoopHandling.Ignore, NullValueHandling = NullValueHandling.Include });
return JsonConvert.SerializeObject(obj, new JsonSerializerSettings { DateFormatString = "yyyy-MM-dd HH:mm:ss", Formatting = Formatting.Indented, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, NullValueHandling = NullValueHandling.Include });
}
}
public static Dictionary<string, object> ConvertToDictionary(this object obj)
{
if (obj == null)
{
throw new ArgumentNullException(nameof(obj));
}
Type type = obj.GetType();
PropertyInfo[] properties = type.GetProperties();
Dictionary<string, object> dictionary = new Dictionary<string, object>();
foreach (PropertyInfo property in properties)
{
string propertyName = property.Name;
object propertyValue = property.GetValue(obj);
dictionary.Add(propertyName, propertyValue);
}
return dictionary;
}
}
}