Merge branch 'Uat_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
c8bbb3da48
|
@ -54,7 +54,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||||
public async Task<IResponseOutput> BatchSubmitGlobalReadingInfo(BatchSubmitGlobalReadingInfo inDto)
|
public async Task<IResponseOutput> BatchSubmitGlobalReadingInfo(BatchSubmitGlobalReadingInfo inDto)
|
||||||
{
|
{
|
||||||
await VerifyTaskIsSign(inDto.GlobalTaskId);
|
await VerifyTaskIsSign(inDto.GlobalTaskId);
|
||||||
|
@ -94,7 +94,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
})).ToList();
|
})).ToList();
|
||||||
|
|
||||||
await _readingGlobalTaskInfoRepository.AddRangeAsync(answers);
|
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();
|
var result = await _readingGlobalTaskInfoRepository.SaveChangesAsync();
|
||||||
return ResponseOutput.Ok(result);
|
return ResponseOutput.Ok(result);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||||
public async Task<IResponseOutput> SaveGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto)
|
public async Task<IResponseOutput> SaveGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto)
|
||||||
{
|
{
|
||||||
await VerifyTaskIsSign(inDto.GlobalTaskId);
|
await VerifyTaskIsSign(inDto.GlobalTaskId);
|
||||||
|
@ -301,7 +301,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
LimitEdit = y.LimitEdit,
|
LimitEdit = y.LimitEdit,
|
||||||
MaxAnswerLength = y.MaxAnswerLength,
|
MaxAnswerLength = y.MaxAnswerLength,
|
||||||
FileType = y.FileType,
|
FileType = y.FileType,
|
||||||
Unit=y.Unit,
|
Unit = y.Unit,
|
||||||
QuestionGenre = y.QuestionGenre,
|
QuestionGenre = y.QuestionGenre,
|
||||||
ShowOrder = y.ShowOrder,
|
ShowOrder = y.ShowOrder,
|
||||||
DictionaryCode = y.DictionaryCode,
|
DictionaryCode = y.DictionaryCode,
|
||||||
|
|
|
@ -3271,7 +3271,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
await _readingCustomTagRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
await _readingCustomTagRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
||||||
{
|
{
|
||||||
ReadingTaskState = ReadingTaskState.WaitReading
|
ReadingTaskState = ReadingTaskState.WaitReading
|
||||||
});
|
});
|
||||||
|
|
|
@ -346,7 +346,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var relatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList);
|
var relatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList);
|
||||||
|
|
||||||
// 这里先保存 签名的时候 会统一创建关系
|
// 这里先保存 签名的时候 会统一创建关系
|
||||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask()
|
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask()
|
||||||
{
|
{
|
||||||
RelatedVisitTaskIds = relatedVisitTaskIds
|
RelatedVisitTaskIds = relatedVisitTaskIds
|
||||||
});
|
});
|
||||||
|
|
|
@ -502,8 +502,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
#region 方式二
|
#region 方式二
|
||||||
|
|
||||||
var subjectVisitQuery = _subjectVisitRepository.Where(t => t.TrialId == inQuery.TrialId).Where(t => t.IsLostVisit == false)
|
var subjectVisitQuery = _subjectVisitRepository.Where(t => t.TrialId == inQuery.TrialId)/*.Where(t => t.IsLostVisit == false)*/
|
||||||
.Where(sv => sv.Subject.FinalSubjectVisitId == null ? true : sv.VisitNum < sv.Subject.LatestSubjectVisit.VisitNum).Select(sv => new ReadModuleView()
|
.Where(sv => sv.Subject.FinalSubjectVisitId == null ? true : sv.VisitNum <= sv.Subject.LatestSubjectVisit.VisitNum).Select(sv => new ReadModuleView()
|
||||||
{
|
{
|
||||||
Id = sv.Id,
|
Id = sv.Id,
|
||||||
CreateTime = sv.CreateTime,
|
CreateTime = sv.CreateTime,
|
||||||
|
@ -888,7 +888,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var resultlist = await visitQuery.WhereIf(finalVisitNum != 0, x => x.VisitNum <= finalVisitNum)
|
var resultlist = await visitQuery.WhereIf(finalVisitNum != 0, x => x.VisitNum <= finalVisitNum)
|
||||||
.WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0)
|
.WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0)
|
||||||
.Where(x => x.VisitNum > maxReadVisitNum)
|
.Where(x => x.VisitNum > maxReadVisitNum)
|
||||||
.Where(x => !x.IsBaseLine) // 排除基线
|
//.Where(x => !x.IsBaseLine) // 排除基线
|
||||||
.Where(x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId && y.ReadingSetType == inDto.ReadingSetType).Count() == 0).OrderBy(x => finalVisitNum)
|
.Where(x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId && y.ReadingSetType == inDto.ReadingSetType).Count() == 0).OrderBy(x => finalVisitNum)
|
||||||
.Select(x => new GetSubjectReadVisitsOutDto()
|
.Select(x => new GetSubjectReadVisitsOutDto()
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
//TrialDicList = string.Join(",", trialDics)
|
//TrialDicList = string.Join(",", trialDics)
|
||||||
|
|
||||||
ImageFormatListStr = string.Join("|", entity.ImageFormatList),
|
ImageFormatListStr = string.Join("|", entity.ImageFormatList),
|
||||||
StudyNamesStr = string.Join("|", entity.StudyNameList.Where(x => x.IsChoose).Select(x=>_userInfo.IsEn_Us?x.EnName:x.Name )),
|
StudyNamesStr = string.Join("|", entity.StudyNameList.Where(x => x.IsChoose).Select(x => _userInfo.IsEn_Us ? x.EnName : x.Name)),
|
||||||
|
|
||||||
CriterionNames = string.Join(",", criterionNameList.Union(memoryCriterionNameList).Distinct()),
|
CriterionNames = string.Join(",", criterionNameList.Union(memoryCriterionNameList).Distinct()),
|
||||||
|
|
||||||
|
@ -1738,11 +1738,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
var entity = item.Entity as IdentityUser;
|
var entity = item.Entity as IdentityUser;
|
||||||
|
|
||||||
|
|
||||||
await InsertInspection<IdentityUser>(entity, type, x => new InspectionConvertDTO
|
await InsertInspection<IdentityUser>(entity, type, x => new InspectionConvertDTO
|
||||||
{
|
{
|
||||||
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 项目参与人员
|
// 项目参与人员
|
||||||
|
@ -1777,7 +1777,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
identityUser.Phone,
|
identityUser.Phone,
|
||||||
identityUser.OrganizationName,
|
identityUser.OrganizationName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 项目人员
|
// 项目人员
|
||||||
|
@ -1795,7 +1795,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
|
//var user = await _dbContext.Users.Include(x => x.UserTypeRole).FirstOrDefaultAsync(x => x.Id == entity.UserId);
|
||||||
await InsertInspection<TrialUserRole>(entity, type, x => new InspectionConvertDTO
|
await InsertInspection<TrialUserRole>(entity, type, x => new InspectionConvertDTO
|
||||||
{
|
{
|
||||||
IsDistinctionInterface = false,
|
IsDistinctionInterface = false,
|
||||||
TrialId = x.TrialId,
|
TrialId = x.TrialId,
|
||||||
ObjectRelationParentId = x.TrialId,
|
ObjectRelationParentId = x.TrialId,
|
||||||
ExtraIndentification = extraIndentification,
|
ExtraIndentification = extraIndentification,
|
||||||
|
@ -2027,7 +2027,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
{
|
{
|
||||||
extraIdentification = "/2";
|
extraIdentification = "/2";
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3241,7 +3241,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
u.ShowOrder
|
u.ShowOrder
|
||||||
}
|
}
|
||||||
).OrderBy(t => t.ShowOrder).ToList()
|
).OrderBy(t => t.ShowOrder).ToList()
|
||||||
},_userInfo.AuditIdentification);
|
}, _userInfo.AuditIdentification);
|
||||||
|
|
||||||
|
|
||||||
////添加/修改病灶接口 只会对单个病灶进行操作
|
////添加/修改病灶接口 只会对单个病灶进行操作
|
||||||
|
@ -3502,18 +3502,24 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
isDistinctionInterface = false;
|
|
||||||
switch (_userInfo.RequestUrl)
|
switch (_userInfo.RequestUrl)
|
||||||
{
|
{
|
||||||
//申请重阅
|
//申请重阅
|
||||||
case "VisitTask/applyReReading":
|
case "VisitTask/applyReReading":
|
||||||
|
|
||||||
|
|
||||||
extraIdentification = "/" + (int)entity.ReReadingApplyState;
|
extraIdentification = "/" + (int)entity.ReReadingApplyState;
|
||||||
|
|
||||||
//PM 申请重阅,区分不了是否有SPM参与
|
//PM 申请重阅,区分不了是否有SPM参与
|
||||||
|
|
||||||
if (entity.ReReadingApplyState== ReReadingApplyState.TrialGroupHaveApplyed)
|
if (entity.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
|
||||||
{
|
{
|
||||||
var hasSPM = _dbContext.VisitTaskReReading.Any(t => t.OriginalReReadingTaskId == entity.Id);
|
|
||||||
|
//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);
|
||||||
|
|
||||||
|
|
||||||
if (!hasSPM)
|
if (!hasSPM)
|
||||||
{
|
{
|
||||||
|
@ -3528,6 +3534,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
//同意重阅
|
//同意重阅
|
||||||
case "VisitTask/ConfirmReReading":
|
case "VisitTask/ConfirmReReading":
|
||||||
|
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
|
||||||
{
|
{
|
||||||
extraIdentification = "/" + 1;
|
extraIdentification = "/" + 1;
|
||||||
|
@ -3549,51 +3556,86 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "ReadingImageTask/SubmitVisitTaskQuestions":
|
||||||
|
|
||||||
|
//访视任务-- 非Dicom 阅片
|
||||||
|
if (entity.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||||
|
{
|
||||||
|
//提交访视任务的时候 会多次更新同一个记录 只记录最后一次
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Dicom 阅片 签名
|
||||||
|
case "ReadingImageTask/SubmitDicomVisitTask":
|
||||||
|
|
||||||
|
//跳转阅片结果需要该参数
|
||||||
|
var subjectCode = _dbContext.Subject.Where(t => t.Id == entity.SubjectId).Select(t => t.Code).First();
|
||||||
|
|
||||||
|
obj.SubjectCode = subjectCode;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "ReadingImageTask/resetReadingTask":
|
||||||
|
//跳转阅片结果需要该参数
|
||||||
|
|
||||||
|
obj.IsReadingReset = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 裁判、肿瘤学、全局 都是通用的
|
||||||
|
|
||||||
|
//裁判任务 结果的保存 和签名提交
|
||||||
|
if (entity.JudgeResultTaskId != null && (_userInfo.RequestUrl == "ReadingImageTask/SaveJudgeVisitTaskResult" || _userInfo.RequestUrl == "ReadingImageTask/SubmitJudgeVisitTaskResult"))
|
||||||
|
{
|
||||||
|
|
||||||
|
var visitTaskNum = entity.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge];
|
||||||
|
var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == visitTaskNum && t.JudgeVisitTaskId == entity.Id && t.TrialReadingCriterionId == entity.TrialReadingCriterionId).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
var r1 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm1).FirstOrDefault();
|
||||||
|
var r2 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm2).FirstOrDefault();
|
||||||
|
|
||||||
|
obj.R1 = r1.FullName;
|
||||||
|
obj.R2 = r2.FullName;
|
||||||
|
obj.SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//增加进入阅片中的稽查
|
||||||
|
|
||||||
|
//重置阅片也会从待阅片 变为阅片中,因为复制病灶依赖这个改变
|
||||||
|
if (obj.IsReadingReset != true)
|
||||||
|
{
|
||||||
|
if (entity.ReadingTaskState == ReadingTaskState.Reading)
|
||||||
|
{
|
||||||
|
if (_dbContext.VisitTask.Where(t => t.Id == entity.Id).Any(t => t.ReadingTaskState == ReadingTaskState.WaitReading))
|
||||||
|
{
|
||||||
|
isDistinctionInterface = false;
|
||||||
|
extraIdentification = "/ChangeToReading";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (entity.IsReadClinicalData == true)
|
||||||
|
{
|
||||||
|
if (_dbContext.VisitTask.Where(t => t.Id == entity.Id).Any(t => t.IsReadClinicalData == false))
|
||||||
|
{
|
||||||
|
isDistinctionInterface = false;
|
||||||
|
extraIdentification = "/ReadClinicalData";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//访视任务-- 非Dicom 阅片
|
|
||||||
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type == AuditOpt.Update)
|
|
||||||
{
|
|
||||||
//提交访视任务的时候 会多次更新同一个记录 只记录最后一次
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Dicom 阅片 签名
|
|
||||||
if (_userInfo.RequestUrl == "ReadingImageTask/SubmitDicomVisitTask")
|
|
||||||
{
|
|
||||||
//跳转阅片结果需要该参数
|
|
||||||
var subjectCode = _dbContext.Subject.Where(t => t.Id == entity.SubjectId).Select(t => t.Code).First();
|
|
||||||
|
|
||||||
obj.SubjectCode = subjectCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 裁判、肿瘤学、全局 都是通用的
|
|
||||||
|
|
||||||
//裁判任务 结果的保存 和签名提交
|
|
||||||
if (entity.JudgeResultTaskId != null && (_userInfo.RequestUrl == "ReadingImageTask/SaveJudgeVisitTaskResult" || _userInfo.RequestUrl == "ReadingImageTask/SubmitJudgeVisitTaskResult"))
|
|
||||||
{
|
|
||||||
|
|
||||||
var visitTaskNum = entity.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge];
|
|
||||||
var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == visitTaskNum && t.JudgeVisitTaskId == entity.Id && t.TrialReadingCriterionId == entity.TrialReadingCriterionId).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
var r1 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm1).FirstOrDefault();
|
|
||||||
var r2 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm2).FirstOrDefault();
|
|
||||||
|
|
||||||
obj.R1 = r1.FullName;
|
|
||||||
obj.R2 = r2.FullName;
|
|
||||||
obj.SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 通过链接跳转 2022 12-19
|
#region 通过链接跳转 2022 12-19
|
||||||
|
|
||||||
|
@ -3710,7 +3752,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
/// <param name="expression">表达式</param>
|
/// <param name="expression">表达式</param>
|
||||||
/// <param name="otherItem">其他对象</param>
|
/// <param name="otherItem">其他对象</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task InsertInspection<T>(T entityObj, string type, Expression<Func<T, InspectionConvertDTO>> expression = null, object otherItem = null,string auditIdentification = "") where T : Entity
|
public async Task InsertInspection<T>(T entityObj, string type, Expression<Func<T, InspectionConvertDTO>> expression = null, object otherItem = null, string auditIdentification = "") where T : Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
InspectionConvertDTO inspection = new InspectionConvertDTO();
|
InspectionConvertDTO inspection = new InspectionConvertDTO();
|
||||||
|
@ -3937,7 +3979,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
/// 获取稽查记录的标识符 部分业务会进行特殊处理
|
/// 获取稽查记录的标识符 部分业务会进行特殊处理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string GetInspectionRecordIdentification<T>(T entityObj, string type, bool IsDistinctionInterface = true, bool isSelfDefine = false,string auditIdentification="")
|
public string GetInspectionRecordIdentification<T>(T entityObj, string type, bool IsDistinctionInterface = true, bool isSelfDefine = false, string auditIdentification = "")
|
||||||
{
|
{
|
||||||
//var entityType = _dbContext.Model.FindEntityType(entityObj.GetType());
|
//var entityType = _dbContext.Model.FindEntityType(entityObj.GetType());
|
||||||
//var tableName = entityType.GetTableName();
|
//var tableName = entityType.GetTableName();
|
||||||
|
@ -3956,11 +3998,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
//自定义 标识后面 补充由代码上层的 extraIdentification 附加
|
//自定义 标识后面 补充由代码上层的 extraIdentification 附加
|
||||||
if (isSelfDefine)
|
if (isSelfDefine)
|
||||||
{
|
{
|
||||||
result= $"{_userInfo.RequestUrl}/{entityTypeName}";
|
result = $"{_userInfo.RequestUrl}/{entityTypeName}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result= $"{_userInfo.RequestUrl}/{entityTypeName}/{type}";
|
result = $"{_userInfo.RequestUrl}/{entityTypeName}/{type}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||||
public string CutOffVisitName { get; set; }
|
public string CutOffVisitName { get; set; }
|
||||||
|
|
||||||
public string SelectResult { get; set; }
|
public string SelectResult { get; set; }
|
||||||
|
|
||||||
|
public bool? IsReadingReset { get;set; }
|
||||||
}
|
}
|
||||||
public class InspectionConvertDTO : DataInspection
|
public class InspectionConvertDTO : DataInspection
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,15 +35,19 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
Task<bool> UpdateAsync(TEntity entity, Expression<Func<TEntity, TEntity>> updateFactory,
|
Task<bool> UpdateAsync(TEntity entity, Expression<Func<TEntity, TEntity>> updateFactory,
|
||||||
bool autoSave = false, CancellationToken cancellationToken = default);
|
bool autoSave = false, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 </summary>
|
/// <summary> EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 一定会产生更新sql </summary>
|
||||||
Task<TEntity> UpdatePartialFromQueryAsync(Guid id, Expression<Func<TEntity, TEntity>> updateFactory,
|
Task<TEntity> UpdatePartialFromQueryAsync(Guid id, Expression<Func<TEntity, TEntity>> updateFactory,
|
||||||
bool autoSave = false, CancellationToken cancellationToken = default);
|
bool autoSave = false, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary> 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 </summary>
|
/// <summary> 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 一定会产生更新sql</summary>
|
||||||
Task UpdatePartialFromQueryAsync(Expression<Func<TEntity, bool>> updateFilter,
|
Task UpdatePartialFromQueryAsync(Expression<Func<TEntity, bool>> updateFilter,
|
||||||
Expression<Func<TEntity, TEntity>> updateFactory,
|
Expression<Func<TEntity, TEntity>> updateFactory,
|
||||||
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default);
|
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
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Infra.EFCore
|
namespace IRaCIS.Core.Infra.EFCore
|
||||||
{
|
{
|
||||||
|
@ -167,6 +168,36 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
return searchEntity;
|
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,
|
public async Task UpdatePartialFromQueryAsync(Expression<Func<TEntity, bool>> updateFilter,
|
||||||
Expression<Func<TEntity, TEntity>> updateFactory,
|
Expression<Func<TEntity, TEntity>> updateFactory,
|
||||||
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default)
|
bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default)
|
||||||
|
@ -191,6 +222,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>EF跟踪方式 删除</summary>
|
/// <summary>EF跟踪方式 删除</summary>
|
||||||
public async Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
|
public async Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue