Compare commits

..

No commits in common. "05627ff126d27dd348fd0ec96da18e639e8d2db3" and "a8ccbce76fa229c68e93c7eecc06951baaa6b56c" have entirely different histories.

5 changed files with 50 additions and 105 deletions

View File

@ -94,7 +94,7 @@ namespace IRaCIS.Core.Application.Service
})).ToList();
await _readingGlobalTaskInfoRepository.AddRangeAsync(answers);
await _visitTaskRepository.UpdatePartialFromEFAutoAsync(inDto.GlobalTaskId, u => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading });
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.GlobalTaskId, u => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading });
var result = await _readingGlobalTaskInfoRepository.SaveChangesAsync();
return ResponseOutput.Ok(result);
}

View File

@ -346,7 +346,7 @@ namespace IRaCIS.Core.Application.Service
var relatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList);
// 这里先保存 签名的时候 会统一创建关系
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask()
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask()
{
RelatedVisitTaskIds = relatedVisitTaskIds
});

View File

@ -3502,24 +3502,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common
{
isDistinctionInterface = false;
switch (_userInfo.RequestUrl)
{
//申请重阅
case "VisitTask/applyReReading":
extraIdentification = "/" + (int)entity.ReReadingApplyState;
//PM 申请重阅区分不了是否有SPM参与
if (entity.ReReadingApplyState== ReReadingApplyState.TrialGroupHaveApplyed)
{
//var hasSPM = _dbContext.VisitTaskReReading.Any(t => t.OriginalReReadingTaskId == entity.Id);
var hasSPM = entitys.Where(x => x.Entity.GetType() == typeof(VisitTaskReReading))
.Select(t => t.Entity as VisitTaskReReading).Any(t => t.OriginalReReadingTaskId == entity.Id);
var hasSPM = _dbContext.VisitTaskReReading.Any(t => t.OriginalReReadingTaskId == entity.Id);
if (!hasSPM)
{
@ -3534,7 +3528,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common
//同意重阅
case "VisitTask/ConfirmReReading":
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{
extraIdentification = "/" + 1;
@ -3556,27 +3549,26 @@ namespace IRaCIS.Core.Infra.EFCore.Common
break;
case "ReadingImageTask/SubmitVisitTaskQuestions":
}
}
//访视任务-- 非Dicom 阅片
if (entity.ReadingTaskState != ReadingTaskState.HaveSigned)
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type == AuditOpt.Update)
{
//提交访视任务的时候 会多次更新同一个记录 只记录最后一次
return;
}
break;
//Dicom 阅片 签名
case "ReadingImageTask/SubmitDicomVisitTask":
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitDicomVisitTask")
{
//跳转阅片结果需要该参数
var subjectCode = _dbContext.Subject.Where(t => t.Id == entity.SubjectId).Select(t => t.Code).First();
obj.SubjectCode = subjectCode;
break;
}
#region 裁判、肿瘤学、全局 都是通用的
@ -3597,21 +3589,10 @@ namespace IRaCIS.Core.Infra.EFCore.Common
obj.SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2";
}
#endregion
//增加进入阅片中的稽查
if (entity.ReadingTaskState == ReadingTaskState.Reading)
{
if(_dbContext.VisitTask.Where(t => t.Id == entity.Id).Any(t => t.ReadingTaskState== ReadingTaskState.WaitReading))
{
isDistinctionInterface = false;
extraIdentification = "/ChangeToReading";
}
}
}
#region 通过链接跳转 2022 12-19

View File

@ -35,19 +35,15 @@ namespace IRaCIS.Core.Infra.EFCore
Task<bool> UpdateAsync(TEntity entity, Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, CancellationToken cancellationToken = default);
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 一定会产生更新sql </summary>
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 </summary>
Task<TEntity> UpdatePartialFromQueryAsync(Guid id, Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, CancellationToken cancellationToken = default);
/// <summary> 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 一定会产生更新sql</summary>
/// <summary> 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 </summary>
Task UpdatePartialFromQueryAsync(Expression<Func<TEntity, bool>> updateFilter,
Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default);
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 根据是否修改了字段ef 自动判断是否生成sql</summary>
Task<TEntity> UpdatePartialFromEFAutoAsync(Guid id, Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, CancellationToken cancellationToken = default);
#endregion

View File

@ -8,7 +8,6 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.Extensions.Localization;
using System.Reflection;
namespace IRaCIS.Core.Infra.EFCore
{
@ -168,36 +167,6 @@ namespace IRaCIS.Core.Infra.EFCore
return searchEntity;
}
public async Task<TEntity> UpdatePartialFromEFAutoAsync(Guid id, Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, CancellationToken cancellationToken = default)
{
var searchEntity = await _dbSet.FindAsync(id);
if (searchEntity == null)
{
throw new BusinessValidationFailedException(I18n.T("Repository_UpdateError"));
}
var list = ((MemberInitExpression)updateFactory.Body).Bindings.Select(mb => mb.Member.Name)
.Select(propName => typeof(TEntity).GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)).ToList();
Func<TEntity, TEntity> func = updateFactory.Compile();
TEntity applyObj = func(searchEntity);
foreach (PropertyInfo prop in list)
{
object value = prop.GetValue(applyObj);
prop.SetValue(searchEntity, value);
}
await SaveChangesAsync(autoSave);
return searchEntity;
}
public async Task UpdatePartialFromQueryAsync(Expression<Func<TEntity, bool>> updateFilter,
Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default)
@ -222,7 +191,6 @@ namespace IRaCIS.Core.Infra.EFCore
/// <summary>EF跟踪方式 删除</summary>
public async Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{