增加进入阅片中稽查

Test_IRC_Net8
hang 2025-06-11 09:27:18 +08:00
parent 9f187e4b36
commit 1a4ca6e36b
5 changed files with 96 additions and 48 deletions

View File

@ -2523,7 +2523,7 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.GetModuleTypeDescriptionLiset(System.Guid,System.Guid)">
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.getModuleTypeDescriptionList(System.Guid,System.Guid)">
<summary>
获取Description
</summary>

View File

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

View File

@ -3556,26 +3556,27 @@ namespace IRaCIS.Core.Infra.EFCore.Common
break;
}
}
case "ReadingImageTask/SubmitVisitTaskQuestions":
//访视任务-- 非Dicom 阅片
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type == AuditOpt.Update)
if (entity.ReadingTaskState != ReadingTaskState.HaveSigned)
{
//提交访视任务的时候 会多次更新同一个记录 只记录最后一次
return;
}
break;
//Dicom 阅片 签名
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitDicomVisitTask")
{
case "ReadingImageTask/SubmitDicomVisitTask":
//跳转阅片结果需要该参数
var subjectCode = _dbContext.Subject.Where(t => t.Id == entity.SubjectId).Select(t => t.Code).First();
obj.SubjectCode = subjectCode;
break;
}
#region 裁判、肿瘤学、全局 都是通用的
@ -3596,10 +3597,21 @@ 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,15 +35,19 @@ namespace IRaCIS.Core.Infra.EFCore
Task<bool> UpdateAsync(TEntity entity, Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, CancellationToken cancellationToken = default);
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 </summary>
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 一定会产生更新sql </summary>
Task<TEntity> UpdatePartialFromQueryAsync(Guid id, Expression<Func<TEntity, TEntity>> updateFactory,
bool autoSave = false, CancellationToken cancellationToken = default);
/// <summary> 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 </summary>
/// <summary> 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 一定会产生更新sql</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,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.Extensions.Localization;
using System.Reflection;
namespace IRaCIS.Core.Infra.EFCore
{
@ -167,6 +168,36 @@ 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)
@ -191,6 +222,7 @@ namespace IRaCIS.Core.Infra.EFCore
/// <summary>EF跟踪方式 删除</summary>
public async Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
{