Uat_Study
he 2023-06-30 10:49:41 +08:00
parent 88b800415c
commit 808dfe7d31
5 changed files with 181 additions and 51 deletions

View File

@ -408,56 +408,94 @@ namespace IRaCIS.Core.Application.Service
[HttpPost] [HttpPost]
public async Task<List<GetCRCConfirmListOutDto>> GetCRCConfirmList(GetCRCConfirmListInDto inDto) public async Task<List<GetCRCConfirmListOutDto>> GetCRCConfirmList(GetCRCConfirmListInDto inDto)
{ {
List<GetCRCConfirmListOutDto> result = await _readModuleRepository.Where(x => x.TrialId == inDto.TrialId)
List<GetCRCConfirmListOutDto> result = await _readModuleRepository.Where(x => x.TrialId == inDto.TrialId) .Select(x => new GetCRCConfirmListOutDto()
.Select(x => new GetCRCConfirmListOutDto() {
{ SubjectId= x.SubjectId,
IsCRCConfirm = x.IsCRCConfirm, IsCRCConfirm = x.IsCRCConfirm,
LatestScanDate = x.SubjectVisit.LatestScanDate, LatestScanDate = x.SubjectVisit.LatestScanDate,
ReadingSetType = x.ReadingSetType, ReadingSetType = x.ReadingSetType,
IsPMConfirm = x.IsPMConfirm, IsPMConfirm = x.IsPMConfirm,
ReadModuleId=x.Id, ReadModuleId = x.Id,
}).OrderBy(x => x.LatestScanDate).ToListAsync();
}).OrderBy(x => x.LatestScanDate).ToListAsync(); var formList = await _clinicalFormRepository.Where(x => x.TrialId == inDto.TrialId)
.Where(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC)
var formList = await _clinicalFormRepository.Where(x => x.TrialId == inDto.TrialId) .Where(x => x.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.ImageRead || x.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.OncologyRead)
.Where(x=> x.ClinicalDataTrialSet.UploadRole==UploadRole.CRC) .Select(x => new CRCClinicalForm
.Where(x=> x.ClinicalDataTrialSet.ClinicalDataLevel==ClinicalLevel.ImageRead|| x.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.OncologyRead) {
.Select(x =>new CRCConfirmFormList CkeckDate = x.CheckDate,
{ ClinicalDataLevel = x.ClinicalDataTrialSet.ClinicalDataLevel,
CkeckDate=x.CheckDate, ClinicalFormId = x.Id,
ClinicalDataLevel= x.ClinicalDataTrialSet.ClinicalDataLevel, }).ToListAsync();
var confirmList = await _readModuleCriterionFromRepository.Where(x => x.TrialId == inDto.TrialId).ToListAsync();
}).ToListAsync();
var confirmList = await _readModuleCriterionFromRepository.Where(x => x.TrialId == inDto.TrialId).ToListAsync();
result.ForEach(x => result.ForEach(x =>
{ {
if (x.IsCRCConfirm) if (x.IsCRCConfirm)
{ {
x.FormCount = confirmList.Where(y => y.ReadModuleId == x.ReadModuleId).Count(); x.ClinicalFormIdList = confirmList.Where(y => y.ReadModuleId == x.ReadModuleId).Select(y=>y.ClinicalFormId).ToList();
} }
else else
{ {
if (x.ReadingSetType == ReadingSetType.ImageReading) if (x.ReadingSetType == ReadingSetType.ImageReading)
{ {
x.FormCount = formList.Where(y => y.ClinicalDataLevel == ClinicalLevel.ImageRead&&y.CkeckDate<=x.LatestScanDate).Count(); x.ClinicalFormIdList = formList.Where(y => y.ClinicalDataLevel == ClinicalLevel.ImageRead&&y.CkeckDate<=x.LatestScanDate).Select(y => y.ClinicalFormId).ToList();
} }
else else
{ {
x.FormCount = formList.Where(y => y.ClinicalDataLevel == ClinicalLevel.OncologyRead&&y.CkeckDate <= x.LatestScanDate).Count(); x.ClinicalFormIdList = formList.Where(y => y.ClinicalDataLevel == ClinicalLevel.OncologyRead&&y.CkeckDate <= x.LatestScanDate).Select(y => y.ClinicalFormId).ToList();
} }
} }
}); });
return result; return result;
} }
/// <summary>
/// CRC 确认临床数据
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> CRCConfirmClinical(CRCConfirmClinicalInDto inDto)
{
var dataList =await this.GetCRCConfirmList(new GetCRCConfirmListInDto()
{
TrialId = inDto.TrialId
});
var presentData = dataList.Where(x => x.ReadModuleId == inDto.ReadModuleId).First();
var confirmlist= dataList.Where(x =>(x.LatestScanDate < presentData.LatestScanDate && x.ReadingSetType == presentData.ReadingSetType)
|| x.ReadModuleId == presentData.ReadModuleId).Where(x => !x.IsCRCConfirm).ToList();
List<ReadModuleCriterionFrom> needAddList = new List<ReadModuleCriterionFrom>()
{
};
confirmlist.ForEach(x =>
{
x.ClinicalFormIdList.ForEach(y =>
{
needAddList.Add(new ReadModuleCriterionFrom()
{
ClinicalFormId = y,
ReadModuleId = x.ReadModuleId,
SubjectId = x.SubjectId,
TrialId = inDto.TrialId,
});
});
});
var readModuleIds = confirmlist.Select(x => x.ReadModuleId).ToList();
await _readModuleRepository.UpdatePartialFromQueryAsync(x => readModuleIds.Contains(x.Id),x=>new ReadModule() {
IsCRCConfirm=true
});
await _readModuleCriterionFromRepository.AddRangeAsync(needAddList);
await _readModuleCriterionFromRepository.SaveChangesAsync();
return ResponseOutput.Ok(true);
}
} }
} }

View File

@ -99,10 +99,20 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
} }
public class CRCConfirmFormList public class CRCConfirmClinicalInDto
{
public Guid TrialId { get; set; }
public Guid ReadModuleId { get; set; }
}
public class CRCClinicalForm
{ {
public DateTime? CkeckDate { get; set; } public DateTime? CkeckDate { get; set; }
public Guid ClinicalFormId { get; set; }
/// <summary> /// <summary>
/// 临床级别 /// 临床级别
/// </summary> /// </summary>
@ -125,7 +135,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary> /// </summary>
public DateTime? LatestScanDate { get; set; } public DateTime? LatestScanDate { get; set; }
public int FormCount { get; set; }
public List<Guid> ClinicalFormIdList { get; set; }
public int FormCount
{
get
{
return this.ClinicalFormIdList.Count();
}
}
} }
public class SubmitClinicalFormInDto public class SubmitClinicalFormInDto

View File

@ -1,6 +1,8 @@
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -178,7 +180,37 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// 单位 /// 单位
/// </summary> /// </summary>
public string Unit { get; set; } = string.Empty; public string Unit { get; set; } = string.Empty;
}
/// <summary>
/// 自定义计算标记
/// </summary>
public ClinicalCalculateMark? CustomCalculateMark { get; set; }
/// <summary>
/// 自定义计算问题
/// </summary>
public string CalculateQuestions { get; set; } = "[]";
[NotMapped]
public List<CalculateInfo> CalculateQuestionList
{
get
{
try
{
var result = JsonConvert.DeserializeObject<List<CalculateInfo>>(this.CalculateQuestions);
return result == null ? new List<CalculateInfo>() : result;
}
catch (Exception)
{
return new List<CalculateInfo>();
}
}
}
}
/// <summary> /// <summary>
/// 查询临床数据基类 /// 查询临床数据基类
@ -218,16 +250,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// 项目临床数据Id /// 项目临床数据Id
/// </summary> /// </summary>
public Guid TrialClinicalId { get; set; } public Guid TrialClinicalId { get; set; }
/// <summary>
/// 自定义计算标记
/// </summary>
public ClinicalCalculateMark? ClinicalCalculateMarkEnum { get; set; }
/// <summary>
/// 自定义计算问题
/// </summary>
public string CalculateQuestions { get; set; } = "[]";
} }
/// <summary> /// <summary>

View File

@ -126,7 +126,37 @@ namespace IRaCIS.Core.Domain.Models
/// 单位 /// 单位
/// </summary> /// </summary>
public string Unit { get; set; } = string.Empty; public string Unit { get; set; } = string.Empty;
}
/// <summary>
/// 自定义计算标记
/// </summary>
public ClinicalCalculateMark? CustomCalculateMark { get; set; }
/// <summary>
/// 自定义计算问题
/// </summary>
public string CalculateQuestions { get; set; } = "[]";
[NotMapped]
public List<CalculateInfo> CalculateQuestionList
{
get
{
try
{
var result = JsonConvert.DeserializeObject<List<CalculateInfo>>(this.CalculateQuestions);
return result == null ? new List<CalculateInfo>() : result;
}
catch (Exception)
{
return new List<CalculateInfo>();
}
}
}
}
} }

View File

@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;
using System.Collections.Generic;
namespace IRaCIS.Core.Domain.Models namespace IRaCIS.Core.Domain.Models
{ {
@ -125,17 +126,37 @@ namespace IRaCIS.Core.Domain.Models
/// <summary> /// <summary>
/// 自定义计算标记 /// 自定义计算标记
/// </summary> /// </summary>
public ClinicalCalculateMark? ClinicalCalculateMarkEnum { get; set; } public ClinicalCalculateMark? CustomCalculateMark { get; set; }
/// <summary> /// <summary>
/// 自定义计算问题 /// 自定义计算问题
/// </summary> /// </summary>
public string CalculateQuestions { get; set; } = "[]"; public string CalculateQuestions { get; set; } = "[]";
/// <summary> [NotMapped]
/// 小数点位数 public List<CalculateInfo> CalculateQuestionList
/// </summary> {
public int? DigitPlaces { get; set; } get
{
try
{
var result = JsonConvert.DeserializeObject<List<CalculateInfo>>(this.CalculateQuestions);
return result == null ? new List<CalculateInfo>() : result;
}
catch (Exception)
{
return new List<CalculateInfo>();
}
}
}
/// <summary>
/// 小数点位数
/// </summary>
public int? DigitPlaces { get; set; }
/// <summary> /// <summary>
/// 单位 /// 单位