新增 IsFrontTaskNeedSignButNotSign
parent
e936416f25
commit
0f60809c32
|
@ -244,6 +244,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public int UnReadTaskCount { get; set; }
|
||||
|
||||
public int UnReadCanReadTaskCount { get; set; }
|
||||
|
||||
public int HaveReadTaskCount { get; set; }
|
||||
|
||||
public int TotalTaskCount { get; set; }
|
||||
|
@ -278,7 +280,10 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
public bool IsClinicalDataSigned { get; set; } = false;
|
||||
public bool IsNeedClinicalDataSign { get; set; }
|
||||
|
||||
public bool IsClinicalDataSign { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -957,19 +957,36 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
/// <returns></returns>
|
||||
public async Task<(int, List<IRUnReadSubjectView>)> GetOrderReadingIQueryable(GetOrderReadingIQueryableInDto inDto)
|
||||
{
|
||||
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
|
||||
.Where(t => t.TrialReadingCriterionId == inDto.TrialReadingCriterionId)
|
||||
|
||||
|
||||
//Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == inDto.TrialReadingCriterionId;
|
||||
|
||||
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId== inDto.TrialReadingCriterionId)
|
||||
//满足前序访视不存在 需要签署但是未签署 sql 相当复杂 同时想查询所有未读的统计数字 就无法统计 byzhouhang
|
||||
//但是加字段 IsFrontTaskNeedSignButNotSign 那么签名临床数据的时候,要对该subject 该标准的有效的任务 这个字段需要在签名的时候维护 采取这种方式 统计数字灵活
|
||||
//.Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum))
|
||||
.WhereIf(!string.IsNullOrEmpty(inDto.SubjectCode), t => t.Subject.Code.Contains(inDto.SubjectCode) || t.BlindSubjectCode.Contains(inDto.SubjectCode))
|
||||
//.Where(t => (t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect))
|
||||
.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
|
||||
|
||||
var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView()
|
||||
{
|
||||
SubjectId = x.Key.SubjectId,
|
||||
SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode,
|
||||
|
||||
//未读任务量
|
||||
UnReadTaskCount = x.Where(y => y.ReadingTaskState != ReadingTaskState.HaveSigned).Count(),
|
||||
|
||||
//未读 里可读任务量
|
||||
UnReadCanReadTaskCount = x.Where(y => y.ReadingTaskState != ReadingTaskState.HaveSigned && y.IsFrontTaskNeedSignButNotSign==false
|
||||
//(y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)
|
||||
//不能对包含聚合或子查询的表达式执行聚合函数
|
||||
//&& !x.Any(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.IsNeedClinicalDataSign == true && t.IsClinicalDataSign == false && t.VisitTaskNum<y.VisitTaskNum )
|
||||
).Count(),
|
||||
|
||||
//已读任务量
|
||||
HaveReadTaskCount = x.Where(y => y.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
|
||||
ExistReadingApply = x.Any(y => y.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed || y.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed),
|
||||
UnReadTaskList = x.Where(y => y.ReadingTaskState != ReadingTaskState.HaveSigned).OrderBy(x => x.VisitTaskNum)
|
||||
UnReadTaskList = x.Where(y => y.ReadingTaskState != ReadingTaskState.HaveSigned /*&& y.IsFrontTaskNeedSignButNotSign == false*/).OrderBy(x => x.VisitTaskNum)
|
||||
.Select(u => new IRUnreadTaskView()
|
||||
{
|
||||
Id = u.Id,
|
||||
|
@ -981,11 +998,11 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
|||
ReadingCategory = u.ReadingCategory,
|
||||
IsAnalysisCreate = u.IsAnalysisCreate,
|
||||
TrialReadingCriterionId = u.TrialReadingCriterionId,
|
||||
IsClinicalDataSigned = u.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == u.SouceReadModuleId || c.ReadingId == u.SourceSubjectVisitId))
|
||||
IsNeedClinicalDataSign =u.IsNeedClinicalDataSign,
|
||||
IsClinicalDataSign=u.IsClinicalDataSign
|
||||
})
|
||||
//.Where(z=>z.IsClinicalDataSigned)
|
||||
.ToList(),
|
||||
}).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId);
|
||||
}).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.UnReadCanReadTaskCount);
|
||||
// 有序阅片需要找到最小需要
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using IRaCIS.Core.Application.Contracts;
|
|||
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -300,13 +301,26 @@ namespace IRaCIS.Application.Services
|
|||
needSignCount = trialClinicalDataSetList.Where(t => t.CriterionEnumList.Any(c => c == (int)criterionType) && t.ClinicalDataLevel == ClinicalLevel.SubjectVisit && t.UploadRole == UploadRole.PM).Count();
|
||||
}
|
||||
|
||||
if (needSignCount == haveSignedCount )
|
||||
if (needSignCount == haveSignedCount && needSignCount!=0 )
|
||||
{
|
||||
|
||||
//将该标准 该subject 该访视 任务临床数据状态变更
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCritrialId && t.SourceSubjectVisitId == readingId, u => new VisitTask()
|
||||
{
|
||||
IsClinicalDataSign = true
|
||||
});
|
||||
|
||||
Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.TrialId == trialId && x.SubjectId == subjectId && x.TrialReadingCriterionId == trialReadingCritrialId;
|
||||
|
||||
|
||||
var visitTaskIdQueryable = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务
|
||||
//小于自己任务号的任务 存在需要签名 但是没签名
|
||||
.Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)).Select(t => t.Id);
|
||||
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t=>visitTaskIdQueryable.Contains(t.Id), u => new VisitTask()
|
||||
{
|
||||
IsFrontTaskNeedSignButNotSign = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,7 +341,7 @@ namespace IRaCIS.Application.Services
|
|||
needSignCount = trialClinicalDataSetList.Where(t => t.CriterionEnumList.Any(c => c == (int)criterionType) && t.ClinicalDataLevel == ClinicalLevel.OncologyRead).Count();
|
||||
}
|
||||
|
||||
if (needSignCount == haveSignedCount)
|
||||
if (needSignCount == haveSignedCount && needSignCount != 0)
|
||||
{
|
||||
//将该标准 该subject 该阅片期|肿瘤学 任务临床数据状态变更
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCritrialId && t.SouceReadModuleId == readingId, u => new VisitTask()
|
||||
|
@ -408,7 +422,7 @@ namespace IRaCIS.Application.Services
|
|||
.WhereIf(inDto.IsVisit && !inDto.IsBaseLine, x => x.ClinicalDataLevel == ClinicalLevel.SubjectVisit)
|
||||
.WhereIf(!inDto.IsVisit, x => x.ClinicalDataLevel == ClinicalLevel.ImageRead || x.ClinicalDataLevel == ClinicalLevel.OncologyRead)
|
||||
.WhereIf(readModule != null, x => x.ClinicalDataLevel == keyValuePairs[readModule.ModuleType])
|
||||
.WhereIf(criterion!=null,x=>x.CriterionEnumList.Contains((int)criterion.CriterionType))
|
||||
//.WhereIf(criterion!=null,x=>x.CriterionEnumListStr.Contains($"|{(int)criterion.CriterionType}|"))
|
||||
.Select(x => new GetTrialClinicalDataSelectOutDto()
|
||||
{
|
||||
ClinicalDataLevel = x.ClinicalDataLevel,
|
||||
|
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
|
@ -43,6 +44,17 @@ namespace IRaCIS.Application.Services
|
|||
[UnitOfWork]
|
||||
public async Task<string> Get()
|
||||
{
|
||||
|
||||
Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.TrialId == Guid.Empty && x.SubjectId == Guid.Empty && x.TrialReadingCriterionId == Guid.Empty;
|
||||
|
||||
var visitTaskIdQueryable = _visitTaskRepositoryy.Where(visitTaskLambda).Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)).Select(t => t.Id);
|
||||
|
||||
await _visitTaskRepositoryy.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask()
|
||||
{
|
||||
IsFrontTaskNeedSignButNotSign = true
|
||||
});
|
||||
|
||||
|
||||
//var a = ((Decimal)1.00).ToString().TrimEnd(new char[] { '.', '0' });
|
||||
//var b = ((Decimal)1.01).ToString().TrimEnd(new char[] { '.', '0' });
|
||||
//var c = ((Decimal)100).ToString().TrimEnd(new char[] { '.', '0' });
|
||||
|
@ -105,7 +117,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
//await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now.AddMinutes(1) });
|
||||
|
||||
var a= _userInfo.IsTestUser;
|
||||
var a= _userInfo.IsTestUser;
|
||||
|
||||
var list1 = await _repository.Where<Dictionary>().Select(t => t.TranslateValue(t.Value, t.ValueCN,true)).ToListAsync();
|
||||
var list2 = await _repository.Where<Dictionary>().Select(t => t.TranslateValue(t.Value, t.ValueCN, false)).ToListAsync();
|
||||
|
|
|
@ -228,6 +228,8 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public bool IsClinicalDataSign { get; set; }
|
||||
|
||||
//前序任务需要签名 但是未签名
|
||||
public bool IsFrontTaskNeedSignButNotSign { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
|
|
|
@ -290,4 +290,19 @@ inner join ReadModule on VisitTask.SouceReadModuleId=ReadModule.Id
|
|||
and (select count(*) from ClinicalDataTrialSet where TrialId=VisitTask.TrialId and CriterionEnumListStr LIKE '%'+ CAST(ReadingQuestionCriterionTrial.CriterionType AS varchar(20))+'%' and ClinicalDataLevel=2)
|
||||
=(select count(*) from ReadingClinicalData inner join ClinicalDataTrialSet on ReadingClinicalData.ClinicalDataTrialSetId =ClinicalDataTrialSet.Id
|
||||
where ReadingClinicalData.TrialId=VisitTask.TrialId and IsSign=1 and ReadingClinicalDataState=3 and ReadingId=VisitTask.SourceSubjectVisitId and ClinicalDataTrialSet.UploadRole=1)
|
||||
|
||||
|
||||
|
||||
--处理字段 IsFrontTaskNeedSignButNotSign
|
||||
UPDATE v SET [v].[IsFrontTaskNeedSignButNotSign] =1
|
||||
FROM [VisitTask] AS [v]
|
||||
WHERE EXISTS (
|
||||
|
||||
SELECT 1
|
||||
FROM [VisitTask] AS [v0]
|
||||
where [v0].SubjectId=v.SubjectId and [v0].TrialReadingCriterionId=V.TrialReadingCriterionId and [v0].TrialId=V.TrialId and
|
||||
|
||||
EXISTS(
|
||||
SELECT 1
|
||||
FROM [VisitTask] AS [v1]
|
||||
WHERE [v1].SubjectId=v.SubjectId and V1.TrialReadingCriterionId=V.TrialReadingCriterionId and V1.TrialId=V.TrialId and [v1].[IsNeedClinicalDataSign]=1 and V1.IsClinicalDataSign=0 and V1.VisitTaskNum< [v0].[VisitTaskNum] AND [v0].[Id] = [v].[Id]
|
||||
))
|
Loading…
Reference in New Issue