Compare commits
310 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9a73876b1 | |||
| e1b716d20b | |||
| 62d93b2db4 | |||
| 8fe84cd2ad | |||
| dd1da21738 | |||
| 7185be2ff2 | |||
| c1d0bf8914 | |||
| 64fec97864 | |||
| edd562183d | |||
| 84bf6d9145 | |||
| a065f4533c | |||
| 52d64682cb | |||
| 5e0513ebcb | |||
| f7525942e7 | |||
| 3971e65482 | |||
| 4fde957519 | |||
| 8faa078afc | |||
| 7f55877688 | |||
| 84922152bd | |||
| a267c52109 | |||
| 1cad62fe1b | |||
| ac284241b7 | |||
| efbcdce768 | |||
| 00d8be6ff5 | |||
| 152ee46fd6 | |||
| 0208ffa8f4 | |||
| 71b765a28b | |||
| e72791b0f8 | |||
| 77f9275d93 | |||
| 3ba953ac7e | |||
| a627be0234 | |||
| 5eb49ca378 | |||
| 04954a4b25 | |||
| 7d08a3d920 | |||
| 4328862c92 | |||
| 58e705716e | |||
| d786b3bb61 | |||
| 905f11625a | |||
| 24c5b3c91f | |||
| ad6f593743 | |||
| f0369e15c7 | |||
| 4b7778ee7f | |||
| 7f970edd52 | |||
| d37ab8ee65 | |||
| 1570731516 | |||
| ed004fe54e | |||
| cbca0ac08f | |||
| a5b5dfb214 | |||
| 19cd09439d | |||
| 18f844601f | |||
| ea79bb71fc | |||
| 01783f9a7f | |||
| c9573fc610 | |||
| 270c4abde4 | |||
| 07270ee83d | |||
| 64060c125d | |||
| c9b998213b | |||
| fe79c77285 | |||
| 72591ee203 | |||
| 1d180fa83f | |||
| 9bf639dac0 | |||
| 11450a973a | |||
| bbb361d0cd | |||
| 7c9959b9ee | |||
| d1fb6314db | |||
| 4047220d53 | |||
| d1b45fa56d | |||
| 4c2c72fe12 | |||
| a0d1a39125 | |||
| 33618e8dfb | |||
| 1edc52bd76 | |||
| 2fa0e9e88e | |||
| 7f5e9f1bfc | |||
| 9910fb3c8e | |||
| aaf8fd62e0 | |||
| 5df54fd75d | |||
| ad00478511 | |||
| cd3508da21 | |||
| e7a116f228 | |||
| 82c0d2bcb4 | |||
| afba3b073c | |||
| 4e37c2d53e | |||
| c03c739ba0 | |||
| 65137e585c | |||
| e0111a2419 | |||
| 73b7aae6c0 | |||
| 14e212c4a8 | |||
| 344146a46e | |||
| cd5a1fcbb7 | |||
| 424448db2f | |||
| 629116cb6a | |||
| 57f7b29cc7 | |||
| f55f498626 | |||
| 955fe25d30 | |||
| 86c24e6002 | |||
| b835a028ad | |||
| c8d5b94154 | |||
| d03d294e97 | |||
| 28014139f5 | |||
| b42a86922e | |||
| 09bf2b4d91 | |||
| 3685686447 | |||
| b6d2128034 | |||
| 9545e699c2 | |||
| 87955d2ca0 | |||
| 0a8573091e | |||
| a713ffdc61 | |||
| 406235cc03 | |||
| 1095e07f87 | |||
| 14b8cbac23 | |||
| 92063da2bf | |||
| 9c6b835800 | |||
| f71b71bb54 | |||
| 6d39e72506 | |||
| a90edaff51 | |||
| bb8fb0a968 | |||
| 348ca93086 | |||
| e3b2046cb8 | |||
| 99350c3a17 | |||
| 1523450b88 | |||
| fb20b1f1b2 | |||
| 5c90b66fc9 | |||
| bc1a6562d5 | |||
| be1fbf2059 | |||
| 7a3bbbeb19 | |||
| d263ecbe2a | |||
| 447e916564 | |||
| 48c9721ab4 | |||
| e641e78fb3 | |||
| d37c1cb872 | |||
| 64c3d96807 | |||
| d607018832 | |||
| 0d65625caa | |||
| da2afd0d5a | |||
| 09305928ed | |||
| 2b82044213 | |||
| e16fd2f4de | |||
| b2389403d9 | |||
| 29c137a2c5 | |||
| 2769cf7efd | |||
| 1c84a374a1 | |||
| 2a59cfe3b5 | |||
| 0dff3d6e4b | |||
| 1d6731e3a4 | |||
| 224318e0c4 | |||
| 7096062d76 | |||
| a0b06fbc28 | |||
| 4a76705ec7 | |||
| 2e1a68fa14 | |||
| 7ec76f6ce3 | |||
| 87e70447f3 | |||
| f72e3f4300 | |||
| 7154196667 | |||
| 0081cf16d0 | |||
| 2eec5f02da | |||
| 4b011ee727 | |||
| b115dd5253 | |||
| 84349c19e7 | |||
| 84d08c0378 | |||
| 7676e3cc4d | |||
| 197aa9bf0a | |||
| 234a5706a8 | |||
| f83819d0c9 | |||
| 43c0885e0a | |||
| 1cff4f7603 | |||
| 71f978609b | |||
| 774e7ccc25 | |||
| c89b65b550 | |||
| a8800b01f3 | |||
| fcc2a68618 | |||
| a353c90bf7 | |||
| 8e730fc342 | |||
| 53149bf8a0 | |||
| b2d681da09 | |||
| 49a36b8214 | |||
| 270941431d | |||
| 2e3c209de2 | |||
| 0be5763ce3 | |||
| 7f1232e2ff | |||
| 9669032e6c | |||
| fd5711a31d | |||
| 25c5b32fa7 | |||
| 5f75413c9c | |||
| 9fa73705ba | |||
| 0f27e246a6 | |||
| 0d26daa3b0 | |||
| 8186ec1b02 | |||
| 956e214632 | |||
| 974adb4367 | |||
| 00189b992f | |||
| 0f0967f893 | |||
| 56165f5037 | |||
| 0b707117c6 | |||
| 5186a530f8 | |||
| b3ed2dd497 | |||
| 5cfa209cc2 | |||
| ca5accfaa0 | |||
| f192219621 | |||
| 4b0d6fe8b9 | |||
| bb6dc19924 | |||
| ec9af97742 | |||
| a5472e1509 | |||
| a1bb730cfe | |||
| 1aa411c0f8 | |||
| 10de82132d | |||
| db11656862 | |||
| a47ac76729 | |||
| f86a88332c | |||
| f6be5e4355 | |||
| 8deeb0290a | |||
| fb6231373b | |||
| a407313a95 | |||
| b1806d2eff | |||
| 19351f34e1 | |||
| e0f708082d | |||
| 44464a809d | |||
| c7c01b7ba3 | |||
| 38b71d5267 | |||
| 3950a3453a | |||
| 7aa59da586 | |||
| 9b2fbdb13f | |||
| c98b9e1bd4 | |||
| 9522461508 | |||
| 5bb99180b6 | |||
| 62ec1e4955 | |||
| 58e1af24c9 | |||
| a7394e7119 | |||
| a93d81de0d | |||
| 6aafe02c6c | |||
| 1511ef1608 | |||
| 1141439c8e | |||
| 559663082b | |||
| 3a298518f9 | |||
| 7f20232401 | |||
| 20b0849b40 | |||
| db951e9195 | |||
| d5d78a99d2 | |||
| 1609a7a88a | |||
| 289831fce8 | |||
| dde058be18 | |||
| be8b730ee4 | |||
| 28360861aa | |||
| 3e097fa42b | |||
| b8a7cd6ebc | |||
| a9aefaf240 | |||
| 266a0c5dd5 | |||
| 54822ae038 | |||
| 05203d6716 | |||
| 2ce8edde80 | |||
| 3c30f5dc14 | |||
| e4ad1c0653 | |||
| 84df49ca07 | |||
| 400edd0b70 | |||
| c4add1ecc8 | |||
| d5879e28d7 | |||
| 37e083face | |||
| 290506a060 | |||
| 1b4bc3690a | |||
| 6374781d26 | |||
| b28013a02f | |||
| fe429d2bdc | |||
| d63af2ed20 | |||
| cebf9875b1 | |||
| 131681a0b3 | |||
| f833adc710 | |||
| df80d1e551 | |||
| 82dc092247 | |||
| 44894fcaa9 | |||
| 083bebdc03 | |||
| e808764dd6 | |||
| 77d198cb09 | |||
| 180b02b28c | |||
| c49a74d742 | |||
| c76fc8f052 | |||
| 14875dfacc | |||
| 0a68788c0f | |||
| b17e5d9ff3 | |||
| 05ce4b7155 | |||
| c8bbb3da48 | |||
| 65de108ecd | |||
| d20c306219 | |||
| e69991ae37 | |||
| e1e2544ee3 | |||
| 318333bae4 | |||
| d569de4dfe | |||
| 05627ff126 | |||
| 627618c854 | |||
| 2711c5eb04 | |||
| a6982f79c3 | |||
| 2a542949cd | |||
| a8ccbce76f | |||
| df7cf30aed | |||
| 0664fbdfb7 | |||
| 0a6ee05417 | |||
| f9bd8c3f5c | |||
| cb83c2a737 | |||
| fdd9afd4f0 | |||
| 53d26c0445 | |||
| 40d035e7a7 | |||
| a13807ae5f | |||
| 9d5aaf1e26 | |||
| c347d08e2b | |||
| 87f2d0e429 | |||
| 89d009fcbf | |||
| 7d65cf5051 | |||
| e74427c45c | |||
| e8825c7efa | |||
| 628e0ad034 | |||
| 2f3f639918 | |||
| 87caf24dd1 |
@@ -19,7 +19,7 @@
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.2.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="Minio" Version="6.0.4" />
|
||||
<PackageReference Include="Minio" Version="6.0.3" />
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.3.0">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
|
||||
@@ -22,6 +22,7 @@ using SharpCompress.Common;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using FellowOakDicom.IO.Buffer;
|
||||
|
||||
namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
@@ -40,7 +41,9 @@ namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
private IServiceProvider _serviceProvider { get; set; }
|
||||
|
||||
private List<Guid> _SCPStudyIdList { get; set; } = new List<Guid>();
|
||||
private List<Guid> _SCPStudyIdList => _ImageUploadList.Where(t => t.SCPStudyId != Guid.Empty).Select(t => t.SCPStudyId).ToList();
|
||||
|
||||
private List<ImageUploadInfo> _ImageUploadList { get; set; } = new List<ImageUploadInfo>();
|
||||
|
||||
private SCPImageUpload _upload { get; set; }
|
||||
|
||||
@@ -163,27 +166,48 @@ namespace IRaCIS.Core.SCP.Service
|
||||
|
||||
public async Task OnReceiveAssociationReleaseRequestAsync()
|
||||
{
|
||||
await DataMaintenanceAsaync();
|
||||
var _distributedLockProvider = _serviceProvider.GetService<IDistributedLockProvider>();
|
||||
|
||||
var @lock = _distributedLockProvider.CreateLock($"{_upload.CallingAE}");
|
||||
|
||||
using (await @lock.AcquireAsync())
|
||||
{
|
||||
|
||||
await DataMaintenanceAsaync();
|
||||
|
||||
//记录监控
|
||||
|
||||
await AddUploadLogAsync();
|
||||
|
||||
|
||||
|
||||
var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
||||
//将检查设置为传输结束
|
||||
await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true });
|
||||
|
||||
await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
||||
|
||||
}
|
||||
|
||||
await SendAssociationReleaseResponseAsync();
|
||||
|
||||
}
|
||||
|
||||
private async Task AddUploadLogAsync()
|
||||
{
|
||||
//记录监控
|
||||
|
||||
var _SCPImageUploadRepository = _serviceProvider.GetService<IRepository<SCPImageUpload>>();
|
||||
|
||||
_upload.EndTime = DateTime.Now;
|
||||
_upload.StudyCount = _SCPStudyIdList.Count;
|
||||
_upload.StudyCount = _ImageUploadList.Count;
|
||||
_upload.TrialId = _trialId;
|
||||
_upload.TrialSiteId = _trialSiteId;
|
||||
|
||||
await _SCPImageUploadRepository.AddAsync(_upload, true);
|
||||
_upload.UploadJsonStr = (new SCPImageLog() { UploadList = _ImageUploadList }).ToJsonStr();
|
||||
|
||||
|
||||
var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
||||
//将检查设置为传输结束
|
||||
await _studyRepository.BatchUpdateNoTrackingAsync(t => _SCPStudyIdList.Contains(t.Id), u => new SCPStudy() { IsUploadFinished = true });
|
||||
|
||||
await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
||||
|
||||
await SendAssociationReleaseResponseAsync();
|
||||
//可能是测试echo 导致记录了
|
||||
await _SCPImageUploadRepository.AddAsync(_upload, _upload.FileCount > 0 ? true : false);
|
||||
}
|
||||
|
||||
|
||||
@@ -249,6 +273,11 @@ namespace IRaCIS.Core.SCP.Service
|
||||
|
||||
//await _studyRepository.SaveChangesAndClearAllTrackingAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
//记录日志
|
||||
await AddUploadLogAsync();
|
||||
}
|
||||
|
||||
Log.Logger.Warning($"连接关闭 {exception?.Message} {exception?.InnerException?.Message}");
|
||||
}
|
||||
@@ -259,17 +288,24 @@ namespace IRaCIS.Core.SCP.Service
|
||||
public async Task<DicomCStoreResponse> OnCStoreRequestAsync(DicomCStoreRequest request)
|
||||
{
|
||||
|
||||
string studyInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.StudyInstanceUID,string.Empty);
|
||||
string studyInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.StudyInstanceUID, string.Empty);
|
||||
string seriesInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.SeriesInstanceUID, string.Empty);
|
||||
string sopInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.SOPInstanceUID, string.Empty);
|
||||
string patientIdStr = request.Dataset.GetSingleValueOrDefault(DicomTag.PatientID, string.Empty);
|
||||
|
||||
if(studyInstanceUid.IsNullOrEmpty() || seriesInstanceUid.IsNullOrEmpty() || sopInstanceUid.IsNullOrEmpty())
|
||||
if (studyInstanceUid.IsNullOrEmpty() || seriesInstanceUid.IsNullOrEmpty() || sopInstanceUid.IsNullOrEmpty())
|
||||
{
|
||||
Log.Logger.Error($"接收数据读取StudyInstanceUID:{studyInstanceUid}、SeriesInstanceUID:{seriesInstanceUid}、SOPInstanceUID:{sopInstanceUid}有空 ");
|
||||
|
||||
return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||
}
|
||||
|
||||
//确保来了影像集合存在
|
||||
if (!_ImageUploadList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
||||
{
|
||||
_ImageUploadList.Add(new ImageUploadInfo() { StudyInstanceUid = studyInstanceUid });
|
||||
}
|
||||
|
||||
//Guid studyId = IdentifierHelper.CreateGuid(studyInstanceUid, trialId.ToString());
|
||||
Guid seriesId = IdentifierHelper.CreateGuid(studyInstanceUid, seriesInstanceUid, _trialId.ToString());
|
||||
Guid instanceId = IdentifierHelper.CreateGuid(studyInstanceUid, seriesInstanceUid, sopInstanceUid, _trialId.ToString());
|
||||
@@ -288,11 +324,70 @@ namespace IRaCIS.Core.SCP.Service
|
||||
long fileSize = 0;
|
||||
try
|
||||
{
|
||||
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
await request.File.SaveAsync(ms);
|
||||
|
||||
#region 1帧拆成多个固定大小的,方便移动端浏览
|
||||
|
||||
// 回到开头,读取 dicom
|
||||
ms.Position = 0;
|
||||
var dicomFile = DicomFile.Open(ms);
|
||||
|
||||
var pixelData = DicomPixelData.Create(dicomFile.Dataset);
|
||||
var syntax = pixelData.Syntax;
|
||||
|
||||
// 每个 fragment 固定大小 (64KB 示例,可以自己调整)
|
||||
int fragmentSize = 20 * 1024;
|
||||
|
||||
if (syntax.IsEncapsulated)
|
||||
{
|
||||
var newFragments = new DicomOtherByteFragment(DicomTag.PixelData);
|
||||
|
||||
for (int n = 0; n < pixelData.NumberOfFrames; n++)
|
||||
{
|
||||
var frameData = pixelData.GetFrame(n); // 获取完整一帧
|
||||
var data = frameData.Data;
|
||||
int offset = 0;
|
||||
|
||||
while (offset < data.Length)
|
||||
{
|
||||
int size = Math.Min(fragmentSize, data.Length - offset);
|
||||
var buffer = new byte[size];
|
||||
Buffer.BlockCopy(data, offset, buffer, 0, size);
|
||||
|
||||
newFragments.Fragments.Add(new MemoryByteBuffer(buffer));
|
||||
offset += size;
|
||||
}
|
||||
}
|
||||
|
||||
// 替换原 PixelData
|
||||
dicomFile.Dataset.AddOrUpdate(newFragments);
|
||||
|
||||
|
||||
// 重新保存 dicom 到流
|
||||
ms.SetLength(0);
|
||||
dicomFile.Save(ms);
|
||||
}
|
||||
|
||||
|
||||
ms.Position = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 本地测试
|
||||
//// --- 保存到本地文件测试 ---
|
||||
//var localPath = @"D:\TestDicom.dcm";
|
||||
//using (var fs = new FileStream(localPath, FileMode.Create, FileAccess.Write))
|
||||
//{
|
||||
// ms.CopyTo(fs);
|
||||
//}
|
||||
//return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//irc 从路径最后一截取Guid
|
||||
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false);
|
||||
|
||||
@@ -315,12 +410,8 @@ namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
try
|
||||
{
|
||||
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, _trialId, _trialSiteId, storeRelativePath, Association.CallingAE, Association.CalledAE,fileSize);
|
||||
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.File, _trialId, _trialSiteId, storeRelativePath, Association.CallingAE, Association.CalledAE,fileSize);
|
||||
|
||||
if (!_SCPStudyIdList.Contains(scpStudyId))
|
||||
{
|
||||
_SCPStudyIdList.Add(scpStudyId);
|
||||
}
|
||||
|
||||
var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
||||
|
||||
@@ -349,12 +440,40 @@ namespace IRaCIS.Core.SCP.Service
|
||||
|
||||
|
||||
await _seriesRepository.SaveChangesAsync();
|
||||
|
||||
if (_ImageUploadList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
||||
{
|
||||
var find = _ImageUploadList.FirstOrDefault(t => t.StudyInstanceUid.Equals(studyInstanceUid));
|
||||
|
||||
|
||||
find.SuccessImageCount++;
|
||||
|
||||
if (!find.PatientNameList.Any(t => t == patientIdStr) && patientIdStr.IsNotNullOrEmpty())
|
||||
{
|
||||
find.PatientNameList.Add(patientIdStr);
|
||||
}
|
||||
|
||||
//首次 (默认是Guid 空,数据库归档出了Id)
|
||||
if (find.SCPStudyId != scpStudyId)
|
||||
{
|
||||
find.SCPStudyId = scpStudyId;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 传输处理异常:{ex.ToString()}");
|
||||
|
||||
if (_ImageUploadList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
||||
{
|
||||
var find = _ImageUploadList.FirstOrDefault(t => t.StudyInstanceUid.Equals(studyInstanceUid));
|
||||
|
||||
find.FailedImageCount++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using IRaCIS.Core.Infra.EFCore;
|
||||
using MassTransit;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
using Serilog.Sinks.File;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
|
||||
namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
@@ -52,8 +53,10 @@ namespace IRaCIS.Core.SCP.Service
|
||||
/// <param name="dataset"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<Guid> ArchiveDicomFileAsync(DicomDataset dataset, Guid trialId, Guid trialSiteId, string fileRelativePath, string callingAE, string calledAE,long fileSize)
|
||||
public async Task<Guid> ArchiveDicomFileAsync(DicomFile dicomFile, Guid trialId, Guid trialSiteId, string fileRelativePath, string callingAE, string calledAE,long fileSize)
|
||||
{
|
||||
var dataset = dicomFile.Dataset;
|
||||
|
||||
string studyInstanceUid = dataset.GetString(DicomTag.StudyInstanceUID);
|
||||
string seriesInstanceUid = dataset.GetString(DicomTag.SeriesInstanceUID);
|
||||
string sopInstanceUid = dataset.GetString(DicomTag.SOPInstanceUID);
|
||||
@@ -82,7 +85,7 @@ namespace IRaCIS.Core.SCP.Service
|
||||
DateTime? studyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty) == string.Empty ? null : dataset.GetSingleValue<DateTime>(DicomTag.StudyDate).Add(dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty) == string.Empty ? TimeSpan.Zero : dataset.GetSingleValue<DateTime>(DicomTag.StudyTime).TimeOfDay);
|
||||
|
||||
//先传输了修改了患者编号的,又传输了没有修改患者编号的,导致后传输的没有修改患者编号的下面的检查为0
|
||||
if (findPatient == null && findStudy==null)
|
||||
if (findPatient == null /*&& findStudy==null*/)
|
||||
{
|
||||
isPatientNeedAdd = true;
|
||||
|
||||
@@ -151,6 +154,32 @@ namespace IRaCIS.Core.SCP.Service
|
||||
}
|
||||
|
||||
findPatient.LatestPushTime = DateTime.Now;
|
||||
findPatient.PatientName = dataset.GetSingleValueOrDefault(DicomTag.PatientName, string.Empty);
|
||||
findPatient.PatientSex = dataset.GetSingleValueOrDefault(DicomTag.PatientSex, string.Empty);
|
||||
findPatient.PatientAge = dataset.GetSingleValueOrDefault(DicomTag.PatientAge, string.Empty);
|
||||
findPatient.PatientBirthDate = dataset.GetSingleValueOrDefault(DicomTag.PatientBirthDate, string.Empty);
|
||||
|
||||
if (findPatient.PatientBirthDate.Length == 8)
|
||||
{
|
||||
var birthDateStr = $"{findPatient.PatientBirthDate[0]}{findPatient.PatientBirthDate[1]}{findPatient.PatientBirthDate[2]}{findPatient.PatientBirthDate[3]}-{findPatient.PatientBirthDate[4]}{findPatient.PatientBirthDate[5]}-{findPatient.PatientBirthDate[6]}{findPatient.PatientBirthDate[7]}";
|
||||
|
||||
var yearStr = $"{findPatient.PatientBirthDate[0]}{findPatient.PatientBirthDate[1]}{findPatient.PatientBirthDate[2]}{findPatient.PatientBirthDate[3]}";
|
||||
|
||||
int year = 0;
|
||||
|
||||
var canParse = int.TryParse(yearStr, out year);
|
||||
|
||||
if (canParse && year > 1900)
|
||||
{
|
||||
findPatient.PatientBirthDate = birthDateStr;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
findPatient.PatientBirthDate = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (findStudy == null)
|
||||
@@ -167,6 +196,9 @@ namespace IRaCIS.Core.SCP.Service
|
||||
TrialSiteId = trialSiteId,
|
||||
StudyInstanceUid = studyInstanceUid,
|
||||
StudyTime = studyTime,
|
||||
DicomStudyDate = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty),
|
||||
DicomStudyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty),
|
||||
|
||||
Modalities = dataset.GetSingleValueOrDefault(DicomTag.Modality, string.Empty),
|
||||
//ModalityForEdit = modalityForEdit,
|
||||
Description = dataset.GetSingleValueOrDefault(DicomTag.StudyDescription, string.Empty),
|
||||
@@ -201,6 +233,19 @@ namespace IRaCIS.Core.SCP.Service
|
||||
findStudy.PatientBirthDate = $"{findStudy.PatientBirthDate[0]}{findStudy.PatientBirthDate[1]}{findStudy.PatientBirthDate[2]}{findStudy.PatientBirthDate[3]}-{findStudy.PatientBirthDate[4]}{findStudy.PatientBirthDate[5]}-{findStudy.PatientBirthDate[6]}{findStudy.PatientBirthDate[7]}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
findStudy.DicomStudyDate = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty);
|
||||
findStudy.DicomStudyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty);
|
||||
findStudy.CalledAE = calledAE;
|
||||
findStudy.CallingAE = callingAE;
|
||||
findStudy.PatientName = dataset.GetSingleValueOrDefault(DicomTag.PatientName, string.Empty);
|
||||
findStudy.PatientSex = dataset.GetSingleValueOrDefault(DicomTag.PatientSex, string.Empty);
|
||||
findStudy.PatientAge = dataset.GetSingleValueOrDefault(DicomTag.PatientAge, string.Empty);
|
||||
findStudy.UpdateTime = DateTime.Now;
|
||||
|
||||
await _patientRepository.BatchUpdateNoTrackingAsync(t => t.Id == findStudy.PatientId, u => new SCPPatient() { LatestPushTime = DateTime.Now });
|
||||
}
|
||||
|
||||
|
||||
if (findSerice == null)
|
||||
@@ -218,6 +263,9 @@ namespace IRaCIS.Core.SCP.Service
|
||||
//SeriesTime = dataset.GetSingleValueOrDefault(DicomTag.SeriesDate, DateTime.Now).Add(dataset.GetSingleValueOrDefault(DicomTag.SeriesTime, DateTime.Now).TimeOfDay),
|
||||
//SeriesTime = DateTime.TryParse(dataset.GetSingleValue<string>(DicomTag.SeriesDate) + dataset.GetSingleValue<string>(DicomTag.SeriesTime), out DateTime dt) ? dt : null,
|
||||
SeriesTime = dataset.GetSingleValueOrDefault(DicomTag.SeriesDate, string.Empty) == string.Empty ? null : dataset.GetSingleValue<DateTime>(DicomTag.SeriesDate).Add(dataset.GetSingleValueOrDefault(DicomTag.SeriesTime, string.Empty) == string.Empty ? TimeSpan.Zero : dataset.GetSingleValue<DateTime>(DicomTag.SeriesTime).TimeOfDay),
|
||||
DicomSeriesDate = dataset.GetSingleValueOrDefault(DicomTag.SeriesDate, string.Empty),
|
||||
DicomSeriesTime = dataset.GetSingleValueOrDefault(DicomTag.SeriesTime, string.Empty),
|
||||
|
||||
Modality = dataset.GetSingleValueOrDefault(DicomTag.Modality, string.Empty),
|
||||
Description = dataset.GetSingleValueOrDefault(DicomTag.SeriesDescription, string.Empty),
|
||||
SliceThickness = dataset.GetSingleValueOrDefault(DicomTag.SliceThickness, string.Empty),
|
||||
@@ -239,7 +287,20 @@ namespace IRaCIS.Core.SCP.Service
|
||||
|
||||
++findStudy.SeriesCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
findSerice.DicomSeriesDate = dataset.GetSingleValueOrDefault(DicomTag.SeriesDate, string.Empty);
|
||||
findSerice.DicomSeriesTime = dataset.GetSingleValueOrDefault(DicomTag.SeriesTime, string.Empty);
|
||||
findSerice.UpdateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
var transferSyntaxUID = dicomFile.FileMetaInfo.GetSingleValueOrDefault(DicomTag.TransferSyntaxUID, string.Empty);
|
||||
|
||||
var isEncapsulated = false;
|
||||
if (transferSyntaxUID.IsNotNullOrEmpty())
|
||||
{
|
||||
isEncapsulated = DicomTransferSyntax.Lookup(DicomUID.Parse(transferSyntaxUID)).IsEncapsulated;
|
||||
}
|
||||
|
||||
if (findInstance == null)
|
||||
{
|
||||
@@ -280,6 +341,15 @@ namespace IRaCIS.Core.SCP.Service
|
||||
++findStudy.InstanceCount;
|
||||
++findSerice.InstanceCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
findInstance.SOPClassUID = dataset.GetSingleValueOrDefault(DicomTag.SOPClassUID, string.Empty);
|
||||
findInstance.MediaStorageSOPClassUID = dataset.GetSingleValueOrDefault(DicomTag.MediaStorageSOPClassUID, string.Empty);
|
||||
findInstance.TransferSytaxUID = transferSyntaxUID;
|
||||
findInstance.MediaStorageSOPInstanceUID = dataset.GetSingleValueOrDefault(DicomTag.MediaStorageSOPInstanceUID, string.Empty);
|
||||
findInstance.IsEncapsulated = isEncapsulated;
|
||||
findInstance.UpdateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
if (isPatientNeedAdd)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace IRaCIS.Core.SCP.Service
|
||||
{
|
||||
public interface IDicomArchiveService
|
||||
{
|
||||
Task<Guid> ArchiveDicomFileAsync(DicomDataset dicomDataset,Guid trialId,Guid trialSiteId, string fileRelativePath,string callingAE,string calledAE,long fileSize);
|
||||
Task<Guid> ArchiveDicomFileAsync(DicomFile dicomFile, Guid trialId,Guid trialSiteId, string fileRelativePath,string callingAE,string calledAE,long fileSize);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,6 +273,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
public List<OSSFileDTO> UploadedFileList { get; set; } = new List<OSSFileDTO>();
|
||||
|
||||
public bool? IsImageSegmentLabel { get; set; }
|
||||
|
||||
public class OSSFileDTO
|
||||
{
|
||||
@@ -521,7 +522,17 @@ namespace IRaCIS.Core.API.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId.Value, FileType = item.FileType, FileSize = item.FileFize });
|
||||
if (incommand.IsImageSegmentLabel == true)
|
||||
{
|
||||
await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, ImageLabelNoneDicomStudyId = noneDicomStudyId.Value, FileType = item.FileType, FileSize = item.FileFize });
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId.Value, FileType = item.FileType, FileSize = item.FileFize });
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,51 @@ namespace IRaCIS.Core.API
|
||||
}
|
||||
|
||||
|
||||
public class DateOnlyUniversalJsonConverter : JsonConverter
|
||||
{
|
||||
private readonly string _format;
|
||||
|
||||
public DateOnlyUniversalJsonConverter(string format = "yyyy-MM-dd")
|
||||
{
|
||||
_format = format;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(DateOnly) || objectType == typeof(DateOnly?);
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
writer.WriteValue(""); // null -> 空字符串
|
||||
return;
|
||||
}
|
||||
|
||||
var date = (DateOnly)value;
|
||||
if (date == default)
|
||||
{
|
||||
writer.WriteValue(""); // default(DateOnly) -> 空字符串
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteValue(date.ToString(_format));
|
||||
}
|
||||
}
|
||||
|
||||
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
|
||||
{
|
||||
var str = reader.TokenType == JsonToken.Null ? null : reader.Value?.ToString();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(str) || !DateOnly.TryParse(str, out var date))
|
||||
{
|
||||
return objectType == typeof(DateOnly?) ? null : default(DateOnly);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
#region 废弃
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace IRaCIS.Core.API
|
||||
//必须放在后面
|
||||
options.SerializerSettings.Converters.Add(services.BuildServiceProvider().GetService<JSONTimeZoneConverter>());
|
||||
|
||||
//options.SerializerSettings.Converters.Add(new DateOnlyUniversalJsonConverter("yyyy-MM-dd"));
|
||||
|
||||
|
||||
})
|
||||
.AddControllersAsServices()//动态webApi属性注入需要
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
"RegionId": "cn-shanghai",
|
||||
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
|
||||
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
|
||||
"AccessKeyId": "LTAI5tNRTsqL6aWmHkDmTwoH",
|
||||
"AccessKeySecret": "7mtGz3qrYWI6JMMBZiLeC119VWicZH",
|
||||
"RoleArn": "acs:ram::1899121822495495:role/irc-oss-access",
|
||||
"BucketName": "zy-irc-store",
|
||||
"ViewEndpoint": "https://zy-irc-cache.oss-cn-shanghai.aliyuncs.com",
|
||||
"AccessKeyId": "LTAI5tFUCCmz5TwghZHsj45Y",
|
||||
"AccessKeySecret": "8evrBy1fVfzJG25i67Jm0xqn9Xcw2T",
|
||||
"RoleArn": "acs:ram::1078130221702011:role/uat-oss-access",
|
||||
"BucketName": "tl-med-irc-event-store",
|
||||
"ViewEndpoint": "https://tl-med-irc-event-store.oss-cn-shanghai.aliyuncs.com",
|
||||
"Region": "oss-cn-shanghai",
|
||||
"DurationSeconds": 7200
|
||||
},
|
||||
|
||||
@@ -13,6 +13,9 @@ namespace IRaCIS.Core.Application.Helper
|
||||
|
||||
public class StudyDIRInfo
|
||||
{
|
||||
public Guid SubjectId { get; set; }
|
||||
public bool IsTaskStudy { get; set; }
|
||||
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
// Study
|
||||
public Guid DicomStudyId { get; set; }
|
||||
|
||||
+12
@@ -60,4 +60,16 @@ namespace IRaCIS.Core.Application.Helper
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
public class DateTimeTranaslateAttribute : Attribute
|
||||
{
|
||||
public string Formart { get; set; }
|
||||
|
||||
public DateTimeTranaslateAttribute(string formart)
|
||||
{
|
||||
Formart = formart;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using FellowOakDicom.Imaging.LUT;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Application.Interfaces;
|
||||
using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Migrations;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MiniExcelLibs;
|
||||
using MiniExcelLibs.OpenXml;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using NPOI.SS.UserModel;
|
||||
@@ -681,9 +685,45 @@ public static class ExcelExportHelper
|
||||
if (itemDicName.IsNotNullOrEmpty())
|
||||
{
|
||||
|
||||
var translatedItemData = dynamicTranslateDataList[itemDicName].Where(t => t.Code.ToLower() == itemValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
var optionTypeEnumStr = iteObjDic.ContainsKey("OptionTypeEnum") ? iteObjDic["OptionTypeEnum"]?.ToString() : "0";
|
||||
|
||||
var translatedItemData = "";
|
||||
//多选
|
||||
if (optionTypeEnumStr == "1")
|
||||
{
|
||||
int[] enumValues = new int[0];
|
||||
// 1. 反序列化 JSON 数组 (字符串枚举)
|
||||
if (!itemValue.StartsWith("[") || !itemValue.EndsWith("]"))
|
||||
{
|
||||
enumValues = new int[1] { int.Parse(itemValue) };
|
||||
}
|
||||
else
|
||||
{
|
||||
enumValues = JsonConvert.DeserializeObject<int[]>(itemValue)?? new int[0];
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 2. 翻译每一项并输出逗号拼接字符串
|
||||
translatedItemData = string.Join(",",
|
||||
enumValues.Select(code =>
|
||||
dynamicTranslateDataList[itemDicName]
|
||||
.FirstOrDefault(t =>
|
||||
string.Equals(code.ToString(),t.Code, StringComparison.OrdinalIgnoreCase)
|
||||
) is var r && r != null
|
||||
? (isEn_US ? r.Value : r.ValueCN)
|
||||
: string.Empty
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
translatedItemData = dynamicTranslateDataList[itemDicName].Where(t => t.Code.ToLower() == itemValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
|
||||
}
|
||||
|
||||
row.GetCell(writeIndex).SetCellValue(translatedItemData);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -294,7 +294,7 @@ public class OSSService : IOSSService
|
||||
GetObjectStoreTempToken();
|
||||
}
|
||||
//token 过期了
|
||||
else if (AliyunOSSTempToken.Expiration.AddSeconds(10) <= DateTime.Now)
|
||||
if (AliyunOSSTempToken?.Expiration.AddSeconds(10) <= DateTime.Now)
|
||||
{
|
||||
GetObjectStoreTempToken();
|
||||
}
|
||||
@@ -308,7 +308,7 @@ public class OSSService : IOSSService
|
||||
GetObjectStoreTempToken();
|
||||
}
|
||||
//token 过期了
|
||||
else if (AWSTempToken.Expiration?.AddSeconds(10) <= DateTime.Now)
|
||||
if (AWSTempToken.Expiration?.AddSeconds(10) <= DateTime.Now)
|
||||
{
|
||||
GetObjectStoreTempToken();
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
<PackageReference Include="FreeSpire.Doc" Version="12.2.0" />
|
||||
<PackageReference Include="ExcelDataReader" Version="3.7.0" />
|
||||
<PackageReference Include="ExcelDataReader.DataSet" Version="3.7.0" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.3" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.1.0" />
|
||||
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.6" />
|
||||
<PackageReference Include="fo-dicom" Version="5.2.2" />
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.2.2" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.16.3" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.16.4" />
|
||||
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
|
||||
<PackageReference Include="MailKit" Version="4.11.0" />
|
||||
<PackageReference Include="Masa.Contrib.Service.MinimalAPIs" Version="1.0.0" />
|
||||
@@ -53,7 +53,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
|
||||
<PackageReference Include="MimeKit" Version="4.11.0" />
|
||||
<PackageReference Include="MiniExcel" Version="1.41.2" />
|
||||
<PackageReference Include="Minio" Version="6.0.5" />
|
||||
<PackageReference Include="Minio" Version="6.0.3" />
|
||||
<PackageReference Include="MiniWord" Version="0.9.2" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.3.0">
|
||||
@@ -62,9 +62,9 @@
|
||||
<PackageReference Include="NPOI" Version="2.7.4" />
|
||||
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.2" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.10" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||
<PackageReference Include="ZiggyCreatures.FusionCache" Version="2.3.0" />
|
||||
<PackageReference Include="ZiggyCreatures.FusionCache" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -86,7 +86,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
|
||||
|
||||
var noneDicomQuey = from sv in _subjectVisitRepository.Where(subjectVisitLambda)
|
||||
join subject in _subjectRepository.AsQueryable() on sv.SubjectId equals subject.Id
|
||||
join noneDicomStudy in _noneDicomStudyRepository.AsQueryable() on sv.Id equals noneDicomStudy.SubjectVisitId
|
||||
join noneDicomStudy in _noneDicomStudyRepository.Where(t => t.FileCount > 0) on sv.Id equals noneDicomStudy.SubjectVisitId
|
||||
select new CheckDBModel()
|
||||
{
|
||||
SubjectVisitId = sv.Id,
|
||||
|
||||
@@ -25,9 +25,11 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
|
||||
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig) : IConsumer<QCImageQuestionRecurringEvent>
|
||||
{
|
||||
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
||||
public async Task Consume(ConsumeContext<QCImageQuestionRecurringEvent> context)
|
||||
{
|
||||
var trialId = context.Message.TrialId;
|
||||
@@ -64,8 +66,9 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
user.FullName, DateTime.Now, sendStat.ToBeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
var htmlContent = isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN;
|
||||
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent),
|
||||
user.FullName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sendStat.ToBeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
|
||||
return (topicStr, htmlBodyStr, isEn_us, userId);
|
||||
};
|
||||
@@ -91,8 +94,10 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig) : IConsumer<CRCImageQuestionRecurringEvent>
|
||||
{
|
||||
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
||||
public async Task Consume(ConsumeContext<CRCImageQuestionRecurringEvent> context)
|
||||
{
|
||||
var trialId = context.Message.TrialId;
|
||||
@@ -131,9 +136,10 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
var htmlContent = isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN;
|
||||
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent),
|
||||
|
||||
user.FullName, DateTime.Now, sendStat.ToBeDealedCount - sendStat.ReUploadTobeDealedCount, sendStat.ReUploadTobeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
user.FullName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sendStat.ToBeDealedCount - sendStat.ReUploadTobeDealedCount, sendStat.ReUploadTobeDealedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
|
||||
|
||||
return (topicStr, htmlBodyStr, false, userId);
|
||||
@@ -158,8 +164,11 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig) : IConsumer<ImageQCRecurringEvent>
|
||||
{
|
||||
|
||||
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
|
||||
public async Task Consume(ConsumeContext<ImageQCRecurringEvent> context)
|
||||
{
|
||||
var trialId=context.Message.TrialId;
|
||||
@@ -199,9 +208,12 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
||||
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc = trialEmailConfig =>
|
||||
{
|
||||
|
||||
var topicStr = string.Format(isEn_us ? trialEmailConfig.EmailTopic : trialEmailConfig.EmailTopicCN, trialInfo.ResearchProgramNo);
|
||||
var htmlBodyStr = string.Format(isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN,
|
||||
user.FullName, DateTime.Now, sendStat.ToBeClaimedCount, sendStat.ToBeReviewedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
|
||||
var htmlContent = isEn_us ? trialEmailConfig.EmailHtmlContent : trialEmailConfig.EmailHtmlContentCN;
|
||||
var htmlBodyStr = string.Format(CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, htmlContent),
|
||||
user.FullName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), sendStat.ToBeClaimedCount, sendStat.ToBeReviewedCount, _SystemEmailSendConfig.CurrentValue.SiteUrl);
|
||||
|
||||
return (topicStr, htmlBodyStr, false, userId);
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ using MassTransit;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MimeKit;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -57,17 +58,15 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||
|
||||
join trialIdentityUser in _trialIdentityUserRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
||||
join trialUserRole in _trialUserRoleRepository.Where(x => x.IsDeleted == false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
||||
from identityUser in _identityUserRepository.AsQueryable(false)
|
||||
|
||||
.Where(t => t.Status == UserStateEnum.Enable &&
|
||||
t.Id == trialIdentityUser.IdentityUserId &&
|
||||
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
||||
.Any(t => trialDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable)
|
||||
on trialIdentityUser.IdentityUserId equals identityUser.Id
|
||||
|
||||
|
||||
join confirm in _trialDocConfirmedUserRepository.Where() on
|
||||
new { trialIdentityUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
||||
select new TrialSignDocView()
|
||||
{
|
||||
TrialCode = trialDoc.Trial.TrialCode,
|
||||
@@ -191,12 +190,10 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
||||
join trialIdentityUser in _trialIdentityUserRepository.Where(x=>x.IsDeleted==false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
||||
join trialUserRole in _trialUserRoleRepository.Where(x => x.IsDeleted == false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
||||
from identityUser in _identityUserRepository.AsQueryable(false)
|
||||
.Where(t => t.Status == UserStateEnum.Enable &&
|
||||
t.Id == trialIdentityUser.IdentityUserId &&
|
||||
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
||||
.Any(t => context.Message.NewUserTypeIds.Contains(t.UserTypeId) &&
|
||||
trialDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable)
|
||||
on trialIdentityUser.IdentityUserId equals identityUser.Id
|
||||
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && context.Message.NewUserTypeIds.Contains(ur.UserRole.UserTypeId) && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
||||
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = true,
|
||||
@@ -222,11 +219,11 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
||||
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(x => context.Message.Ids.Contains(x.Id))
|
||||
join trialIdentityUser in _trialIdentityUserRepository.Where(x => x.IsDeleted == false) on trialDoc.TrialId equals trialIdentityUser.TrialId
|
||||
join trialUserRole in _trialUserRoleRepository.Where(x=>x.IsDeleted==false) on trialIdentityUser.Id equals trialUserRole.TrialUserId
|
||||
from identityUser in _identityUserRepository.AsQueryable(false)
|
||||
.Where(t => t.Status == UserStateEnum.Enable &&
|
||||
t.Id== trialIdentityUser.IdentityUserId&&
|
||||
t.UserRoleList.Where(t => t.IsUserRoleDisabled == false)
|
||||
.Any(t => trialDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||
join identityUser in _identityUserRepository.AsQueryable(false).Where(u => u.Status == UserStateEnum.Enable)
|
||||
on trialIdentityUser.IdentityUserId equals identityUser.Id
|
||||
where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted &&trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId))
|
||||
|
||||
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = false,
|
||||
|
||||
@@ -490,6 +490,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public int? RandomOrder { get; set; }
|
||||
public bool? IsRandomOrderList { get; set; }
|
||||
|
||||
public CriterionType? CriterionType { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1027,8 +1027,8 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
||||
//满足前序访视不存在 需要签署但是未签署 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(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate));
|
||||
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate))
|
||||
;
|
||||
|
||||
var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
|
||||
|
||||
@@ -1171,7 +1171,9 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
||||
|
||||
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect)
|
||||
.WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId)
|
||||
.WhereIf(!string.IsNullOrEmpty(subjectCode), t => (t.Subject.Code.Contains(subjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(subjectCode!) && t.IsAnalysisCreate));
|
||||
.WhereIf(!string.IsNullOrEmpty(subjectCode), t => (t.Subject.Code.Contains(subjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(subjectCode!) && t.IsAnalysisCreate))
|
||||
.WhereIf(critrion.CriterionType == CriterionType.OCT, t => t.ReadingCategory == ReadingCategory.Visit ? t.SourceSubjectVisit.NoneDicomStudyList.SelectMany(t => t.ImageLabelNoneDicomFileList).Any() : true)
|
||||
.WhereIf(critrion.CriterionType == CriterionType.IVUS, t => t.ReadingCategory == ReadingCategory.Visit ? t.SourceSubjectVisit.TaskStudyList.Any() : true);
|
||||
|
||||
var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
QuestionAnswerList = g.Select(t => new QCQuestionAnswerExport() { Answer = t.Answer, QuestionName = t.QuesitonName, ShowOrder = t.ShowOrder, QuestionId = t.QuestionId }).OrderBy(t => t.ShowOrder).ToList()
|
||||
|
||||
|
||||
}).OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ThenBy(t=>t.CurrentQCEnum).ThenBy(t=>t.AuditTime).ToList();
|
||||
}).OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ThenBy(t => t.CurrentQCEnum).ThenBy(t => t.AuditTime).ToList();
|
||||
|
||||
|
||||
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
@@ -1619,7 +1619,6 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
|
||||
|
||||
|
||||
if (inQuery.IsRandomOrderList == true)
|
||||
{
|
||||
list = list.OrderBy(t => t.RandomOrder).ToList();
|
||||
@@ -2311,263 +2310,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
#region 通用阅片结果导出
|
||||
|
||||
/// <summary>
|
||||
/// 一致性分析结果导出 7 8 分别是自身 和组件一致性
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <param name="_commonDocumentRepository"></param>
|
||||
/// <param name="_dictionaryService"></param>
|
||||
/// <param name="_trialRepository"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> GetAnalysisTaskList_Export(VisitTaskQuery inQuery,
|
||||
[FromServices] IRepository<CommonDocument> _commonDocumentRepository,
|
||||
[FromServices] IDictionaryService _dictionaryService,
|
||||
[FromServices] IRepository<Trial> _trialRepository)
|
||||
{
|
||||
//每次查询必须是单标准的
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName, t.ArbitrationRule }).FirstNotNullAsync();
|
||||
|
||||
|
||||
var query = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskAllocationState == TaskAllocationState.Allocated && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze))
|
||||
|
||||
//一致性分析
|
||||
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == true || t.IsSelfAnalysis == null)
|
||||
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults, t => t.IsSelfAnalysis == null ? t.Subject.SubjectVisitTaskList.Any(u => u.IsSelfAnalysis == true && u.VisitTaskNum == t.VisitTaskNum && u.DoctorUserId == t.DoctorUserId && u.TrialReadingCriterionId == t.TrialReadingCriterionId) : true)
|
||||
.WhereIf(inQuery.ReadingExportType == ExportResult.DetailedTableOfInterReaderAnalysisResults, t => t.IsSelfAnalysis == false || t.IsSelfAnalysis == null)
|
||||
|
||||
//访视和全局查询已签名完成的,裁判可以是未签名,未完成的
|
||||
.Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || t.ReadingCategory == ReadingCategory.Judge)
|
||||
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
|
||||
.WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent)
|
||||
.WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId)
|
||||
.WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory)
|
||||
//.WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState)
|
||||
.WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState)
|
||||
.WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate)
|
||||
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate);
|
||||
|
||||
var list = await query.ProjectTo<AnalysisDynamicCommonExport>(_mapper.ConfigurationProvider,
|
||||
new
|
||||
{
|
||||
readingExportType = inQuery.ReadingExportType,
|
||||
criterionType = criterion.CriterionType,
|
||||
trialReadingCriterionId = inQuery.TrialReadingCriterionId,
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
}).ToListAsync();
|
||||
|
||||
list = list.OrderBy(t => t.SubjectCode).ThenBy(t => t.ArmEnum).ThenBy(t => t.VisitTaskNum).ToList();
|
||||
|
||||
|
||||
var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo<ExcelExportInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
exportInfo.CriterionName = criterion.CriterionName;
|
||||
|
||||
#region 处理系统标准存在疾病和整体肿瘤合并
|
||||
|
||||
//如果是以合并后的找翻译字典,会少,所以必须放在前面
|
||||
var translateDicNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.TranslateDicName.IsNotNullOrEmpty()).Select(t => t.TranslateDicName).Distinct().ToList();
|
||||
|
||||
//针对1.1 整体肿瘤评估 有的两列要合并一列
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
//处理合并表头
|
||||
|
||||
var questionType = item.IsBaseline == true ? QuestionType.ExistDisease : QuestionType.Tumor;
|
||||
|
||||
var findItem = item.QuestionAnswerList.Where(t => t.QuestionType == questionType).FirstOrDefault();
|
||||
|
||||
if (findItem != null)
|
||||
{
|
||||
findItem.QuestionName = _userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估";
|
||||
}
|
||||
|
||||
|
||||
if (item.IsBaseline == true)
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.Tumor).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ExistDisease).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
//处理合并表头
|
||||
|
||||
var questionType = item.IsBaseline == true ? QuestionType.ExistDisease : QuestionType.ImgOncology;
|
||||
|
||||
var findItem = item.QuestionAnswerList.Where(t => t.QuestionType == questionType).FirstOrDefault();
|
||||
|
||||
if (findItem != null)
|
||||
{
|
||||
findItem.QuestionName = _userInfo.IsEn_Us ? "Overall Response" : "整体肿瘤评估";
|
||||
}
|
||||
|
||||
if (item.IsBaseline == true)
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ImgOncology).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Where(t => t.QuestionType != QuestionType.ExistDisease).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.PCWG3)
|
||||
{
|
||||
|
||||
}
|
||||
else if (criterion.CriterionType == CriterionType.SelfDefine)
|
||||
{
|
||||
//自定义的又问题名称重复 所以统一加上组名
|
||||
|
||||
//有重复的就加,没有重复的就不加
|
||||
if (list.Any(t => t.QuestionAnswerList.Select(t => t.QuestionName).Count() != t.QuestionAnswerList.Select(t => t.QuestionName).Distinct().Count()))
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
foreach (var qs in item.QuestionAnswerList)
|
||||
{
|
||||
qs.QuestionName = qs.Group + "_" + qs.QuestionName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
var export_Template = StaticData.Export.TrialSelfAnalysisList_Export;
|
||||
|
||||
#region 自身一致性分析和组间一致性分析
|
||||
|
||||
if (inQuery.ReadingExportType == ExportResult.DetailedTableOfIntraReaderAnalysisResults)
|
||||
{
|
||||
//找到非一致性分析的任务
|
||||
var selfExportList = list.Where(t => t.IsSelfAnalysis == null).ToList();
|
||||
|
||||
//处理一致性分析结果是否和原始阅片是否一致
|
||||
foreach (var item in selfExportList)
|
||||
{
|
||||
//找到一致性分析的结果
|
||||
var selfAnalysisTask = list.Where(t => t.IsSelfAnalysis == true && t.SubjectCode == item.SubjectCode && t.VisitTaskNum == item.VisitTaskNum && t.TaskName == t.TaskName && t.UserName == item.UserName).FirstOrDefault();
|
||||
|
||||
//将自身一致性分析的字段 赋值到访视任务这个字段
|
||||
item.IsAnalysisDiffToOriginalData = selfAnalysisTask?.IsAnalysisDiffToOriginalData;
|
||||
|
||||
//处理再次阅片人的结果
|
||||
if (selfAnalysisTask != null)
|
||||
{
|
||||
var cloneQuestionAnswerList = selfAnalysisTask.QuestionAnswerList.Clone();
|
||||
|
||||
foreach (var qItem in cloneQuestionAnswerList)
|
||||
{
|
||||
qItem.QuestionName = qItem.QuestionName + $"{(_userInfo.IsEn_Us ? "(Again)" : "(再次)")}";
|
||||
}
|
||||
|
||||
item.QuestionAnswerList = item.QuestionAnswerList.Union(cloneQuestionAnswerList).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
list = selfExportList;
|
||||
}
|
||||
else
|
||||
{
|
||||
export_Template = StaticData.Export.TrialGroupAnalysisList_Export;
|
||||
|
||||
var newList = new List<AnalysisDynamicCommonExport>();
|
||||
|
||||
foreach (var group in list.GroupBy(t => new { t.SubjectCode, t.VisitTaskNum, t.TaskName }).OrderBy(g => g.Key.SubjectCode).ThenBy(g => g.Key.VisitTaskNum))
|
||||
{
|
||||
var subjectVisitGroupList = group.ToList();
|
||||
|
||||
|
||||
//找到当前访视组间一致性分析的任务结果
|
||||
|
||||
var groupOtherTaskList = subjectVisitGroupList.Where(t => t.IsSelfAnalysis == false).ToList();
|
||||
|
||||
foreach (var subjectVisitTaskArm in subjectVisitGroupList.Where(t => t.IsSelfAnalysis == null).OrderBy(t => t.ArmEnum))
|
||||
{
|
||||
foreach (var otherTask in groupOtherTaskList)
|
||||
{
|
||||
//非一致性分析任务
|
||||
var cloneObj = subjectVisitTaskArm.Clone();
|
||||
|
||||
var otherTaskQuestionAnserList = otherTask.QuestionAnswerList.Clone();
|
||||
|
||||
foreach (var qItem in otherTaskQuestionAnserList)
|
||||
{
|
||||
qItem.QuestionName = qItem.QuestionName + $"{(_userInfo.IsEn_Us ? "(Again)" : "(再次)")}";
|
||||
}
|
||||
|
||||
//处理 再次阅片人,再次阅片人角色 两列
|
||||
var addQuestionList = new List<CommonQuesionInfo>();
|
||||
|
||||
addQuestionList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Reviwer(Again)" : "阅片人(再次)", QuestionValue = otherTask.UserName });
|
||||
addQuestionList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Reviwer Role(Again)" : "阅片人角色(再次)", QuestionValue = ((int)otherTask.ArmEnum).ToString(), TranslateDicName = "ArmEnum" });
|
||||
|
||||
|
||||
cloneObj.QuestionAnswerList = cloneObj.QuestionAnswerList.Union(addQuestionList).Union(otherTaskQuestionAnserList).ToList();
|
||||
|
||||
|
||||
cloneObj.IsGroupAnalysisDiffToOriginalData = cloneObj.ArmEnum == Arm.DoubleReadingArm1 ? otherTask.IsGroupDiffArm1 : otherTask.IsGroupDiffArm2;
|
||||
|
||||
newList.Add(cloneObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
translateDicNameList.Add("ArmEnum");
|
||||
|
||||
list = newList;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
var columNameList = list.SelectMany(t => t.QuestionAnswerList).Where(t => t.QuestionName.IsNotNullOrEmpty()).Select(t => t.QuestionName).Distinct().ToList();
|
||||
|
||||
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list.Where(t => t.ReadingCategory != ReadingCategory.Global).ToList(), _userInfo.TimeZoneId);
|
||||
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
|
||||
|
||||
var dynamicColumnConfig = new DynamicColumnConfig()
|
||||
{
|
||||
//可读的列表名行索引,不是{{}} 模板行索引
|
||||
AutoColumnTitleRowIndex = 2,
|
||||
AutoColumnStartIndex = 5,
|
||||
TempalteLastColumnIndex = 4,
|
||||
DynamicItemDicName = "TranslateDicName",
|
||||
DynamicItemValueName = "QuestionValue",
|
||||
DynamicItemTitleName = "QuestionName",
|
||||
DynamicListName = "QuestionAnswerList",
|
||||
RemoveColunmIndexList = new List<int>() { },
|
||||
ColumnIdNameList = columNameList.Select(t => new DynamicColumnConfig.ColumItem() { Id = Guid.Empty, Name = t }).ToList(),
|
||||
TranslateDicNameList = translateDicNameList ?? new List<string>()
|
||||
};
|
||||
|
||||
|
||||
var (memoryStream, fileName) = await ExcelExportHelper.DataExport_NpoiTestAsync(export_Template, exportInfo, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(AnalysisDynamicCommonExport), criterion.CriterionType, dynamicColumnConfig);
|
||||
|
||||
return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
{
|
||||
FileDownloadName = $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}_{fileName}_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片标准可以导出的列表
|
||||
@@ -2600,6 +2344,11 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
if (criterion.CriterionType == CriterionType.OCT)
|
||||
{
|
||||
list.Add(new ExportDocumentDes() { Code = StaticData.Export.OCT_ReadingLession_Export, ExportCatogory = ExportResult.OCT_ReadingLession_Export });
|
||||
list.Add(new ExportDocumentDes() { Code = StaticData.Export.OCT_CDISC_Export, ExportCatogory = ExportResult.OCT_CDISC_Export });
|
||||
}
|
||||
if (criterion.CriterionType == CriterionType.IVUS)
|
||||
{
|
||||
list.Add(new ExportDocumentDes() { Code = StaticData.Export.IVUS_CDISC_Export, ExportCatogory = ExportResult.IVUS_CDISC_Export });
|
||||
}
|
||||
//else if (criterion.CriterionType == CriterionType.SelfDefine)
|
||||
{
|
||||
@@ -2898,7 +2647,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
{
|
||||
#region 外层问题处理
|
||||
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.mRECISTHCC)
|
||||
{
|
||||
|
||||
fistLeveLNameList = trialConfigQuestionList.Select(t => new DynamicColumnConfig.ColumItem()
|
||||
@@ -2941,7 +2691,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var extralNameList = new List<DynamicColumnConfig.ColumItem>();
|
||||
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.mRECISTHCC
|
||||
|| criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
|
||||
//if(inQuery.ReadingExportType == ExportResult.DetailedTableOfLesions)
|
||||
@@ -2982,7 +2733,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var addLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.mRECISTHCC
|
||||
|| criterion.CriterionType == CriterionType.Lugano2014 || criterion.CriterionType == CriterionType.Lugano2014WithoutPET)
|
||||
{
|
||||
//病灶编号 和病灶类型没有配置,但是需要有的
|
||||
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion ID" : "病灶编号", QuestionValue = lession.LessionCode });
|
||||
@@ -2994,7 +2746,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionName = _userInfo.IsEn_Us ? "Lesion Type" : "病灶类型", QuestionValue = lession.LessionType, TranslateDicName = "LesionType" });
|
||||
}
|
||||
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName });
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionName = t.QuestionName, OptionTypeEnum = t.OptionTypeEnum, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName });
|
||||
|
||||
//有三部分组成 外层问题+ 没有配置病灶编号和类型+ 动态的表格问题
|
||||
var dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
@@ -3022,7 +2774,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
#endregion
|
||||
|
||||
#region 不管是list 还是taskList 最终处理的数据都是list 处理好数据后合并
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB || criterion.CriterionType == CriterionType.IRECIST1Point1)
|
||||
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.RECIST1Pointt1_MB
|
||||
|| criterion.CriterionType == CriterionType.IRECIST1Point1 || criterion.CriterionType == CriterionType.mRECISTHCC)
|
||||
{
|
||||
//针对1.1 整体肿瘤评估 有的两列要合并一列
|
||||
foreach (var item in list)
|
||||
@@ -3141,14 +2894,14 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
addLessionInfoList.Add(new CommonQuesionInfo() { QuestionId = Guid.Empty, QuestionName = _userInfo.IsEn_Us ? "Table Name" : "表格名称", QuestionValue = firstLessionAnser.TableName });
|
||||
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionId = t.TableQuesionId, QuestionName = t.TableName + "_" + t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionId = t.TableQuesionId, OptionTypeEnum = t.OptionTypeEnum, QuestionName = t.TableName + "_" + t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
|
||||
//有三部分组成 外层问题+ 固定列表格名称 + 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionId = t.TableQuesionId, QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionId = t.TableQuesionId, OptionTypeEnum = t.OptionTypeEnum, QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
|
||||
//两部分组成 外层问题+ 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
|
||||
@@ -3214,7 +2967,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var trialConfigTableQuestionList = _trialReadingTableQuestionRepository.Where(t => t.TrialId == trialId && t.TrialCriterionId == trialReadingCriterionId).Where(t => t.ExportResultStr.Contains(((int)inQuery.ReadingExportType).ToString()))
|
||||
.Select(t => new ExportQuestionBasicInfo()
|
||||
{
|
||||
QuestionId = t.Id,
|
||||
QuestionId = t.Id,
|
||||
TableName = _userInfo.IsEn_Us ? t.ReadingQuestionTrial.QuestionEnName : t.ReadingQuestionTrial.QuestionName,
|
||||
QuestionName = _userInfo.IsEn_Us ? t.QuestionEnName : t.QuestionName,
|
||||
CDISCCode = t.CDISCCode,
|
||||
@@ -3258,7 +3011,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var dynamicLessionInfoList = new List<CommonQuesionInfo>();
|
||||
|
||||
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionId = t.TableQuesionId, QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
var dynamicPartialLessionInfoList = lession.LessionAnswerList.Select(t => new CommonQuesionInfo() { QuestionId = t.TableQuesionId,OptionTypeEnum=t.OptionTypeEnum, QuestionName = t.QuestionName, QuestionValue = t.QuestionValue, TranslateDicName = t.TranslateDicName, CDISCCode = t.CDISCCode });
|
||||
|
||||
//两部分组成 外层问题+ 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
|
||||
|
||||
@@ -0,0 +1,517 @@
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.Common;
|
||||
|
||||
public class TumorCommonQustionInfo
|
||||
{
|
||||
//问题标识,肿瘤评估用于区分是什么问题
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
|
||||
public OptionType OptionTypeEnum { get; set; }
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public string QuestionValue { get; set; }
|
||||
|
||||
public string TranslateDicName { get; set; }
|
||||
|
||||
public ValueUnit? Unit { get; set; }
|
||||
|
||||
public ValueOfType? ValueType { get; set; }
|
||||
}
|
||||
|
||||
public class TumorLessionInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid? OrganInfoId { get; set; }
|
||||
//病灶编号
|
||||
public string LessionCode { get; set; }
|
||||
|
||||
public LesionType? LessionType { get; set; }
|
||||
|
||||
public Guid? SplitRowId { get; set; }
|
||||
|
||||
public string? DicomModality { get; set; }
|
||||
|
||||
public string? NoneDicomModality { get; set; }
|
||||
|
||||
//病灶答案
|
||||
public List<TumorLessionAnswerInfo> LessionAnswerList { get; set; }
|
||||
}
|
||||
|
||||
public class TumorLessionAnswerInfo
|
||||
{
|
||||
public QuestionMark? QuestionMark { get; set; }
|
||||
|
||||
public OptionType OptionTypeEnum { get; set; }
|
||||
|
||||
//病灶Id
|
||||
public Guid RowId { get; set; }
|
||||
|
||||
//如果是4 就取CustomUnit 否则就是字典翻译
|
||||
[Comment("单位")]
|
||||
public ValueUnit? Unit { get; set; }
|
||||
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
public Guid TableQuesionId { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public string QuestionValue { get; set; }
|
||||
|
||||
public string TranslateDicName { get; set; }
|
||||
}
|
||||
|
||||
public class TumorGlobalQuestionAnserInfo
|
||||
{
|
||||
[Comment("原任务ID")]
|
||||
public Guid TaskId { get; set; }
|
||||
|
||||
public GlobalAnswerType GlobalAnswerType { get; set; }
|
||||
|
||||
[Comment("问题答案")]
|
||||
public string Answer { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class TumorExportBaseModel : TU_TR_RSBaseModel
|
||||
{
|
||||
public List<TumorLessionInfo> LesionList { get; set; } = new List<TumorLessionInfo>();
|
||||
|
||||
public List<TumorCommonQustionInfo> QuestionAnswerList { get; set; }
|
||||
|
||||
public List<TumorGlobalQuestionAnserInfo> GlobalResultList { get; set; }
|
||||
|
||||
#region 后续处理额外添加字段
|
||||
|
||||
|
||||
|
||||
public DateTime? JudgeSignTime { get; set; }
|
||||
|
||||
public Guid? SourceSubjectVisitId { get; set; }
|
||||
|
||||
public List<decimal> SubjectCriterionReadingPeriodVisitNumList { get; set; }
|
||||
|
||||
public decimal VisitTaskNum { get; set; }
|
||||
|
||||
public ReadingTaskState ReadingTaskState { get; set; }
|
||||
|
||||
public ReadingCategory ReadingCategory { get; set; }
|
||||
|
||||
//裁判结果选择的访视或者全局任务Id
|
||||
public Arm? JudgeArmEnum { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
//在当前访视触发裁判,或者在截止日期小于等于当前访视的阅片期触发裁判
|
||||
[DictionaryTranslateAttribute("YesOrNoAudit")]
|
||||
public bool? IsTrigerJudge { get; set; }
|
||||
|
||||
//(如果是访视点裁判,则仅在所选阅片人对应访视 显示;如果是阅片期裁判,则在所选阅片人 阅片期内的所有访视 显示此原因)
|
||||
public string JudgeNote { get; set; } = string.Empty;
|
||||
|
||||
public string VisitNote { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TU_TR_RSBaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 方案编号 STUDYID
|
||||
/// </summary>
|
||||
public string ResearchProgramNo { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 域 DOMAIN TU TR RS
|
||||
/// </summary>
|
||||
public string Domain { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取值类型 TUSPID TRSPID RSSPID
|
||||
/// </summary>
|
||||
public string ValueType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 受试者编号 USUBJID 实际展示TrialSiteSubjectCode
|
||||
/// </summary>
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 供应商 TUNAM (Extensive Imaging)
|
||||
/// </summary>
|
||||
public string Vendor { get; set; } = "Extensive Imaging";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 阅片人 TUEVAL TREVAL RSEVAL
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阅片人标识 TUEVALID TREVALID RSEVALID
|
||||
/// </summary>
|
||||
public Arm ArmEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访视编号 VISITNUM
|
||||
/// </summary>
|
||||
public decimal? VisitNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访视名称 VISIT
|
||||
/// </summary>
|
||||
public string? VisitName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拍片日期 TUDTC TRDTC RSDTC
|
||||
/// </summary>
|
||||
public DateTime? LatestScanDate { get; set; }
|
||||
|
||||
public DateTime? EarliestScanDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// eCRF标识 TUREFID TRREFID RSREFID
|
||||
/// </summary>
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
|
||||
#region 移动位置
|
||||
|
||||
/// <summary>
|
||||
/// RSCAT 阅片标准
|
||||
/// </summary>
|
||||
public string CriterionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RSACPTFL 裁定标记 TUACPTFL
|
||||
/// </summary>
|
||||
//裁判选择标记
|
||||
//根据裁判的任务结果 设置访视任务的这个字段 该字段表示 裁判认同该任务的结果
|
||||
public bool? IsJudgeSelect { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DateTime? SignTime { get; set; }
|
||||
|
||||
public string TaskName { get; set; }
|
||||
|
||||
#region 额外翻译字段
|
||||
|
||||
|
||||
|
||||
public string IsJudgeSelectStr => IsJudgeSelect == true ? "Y" : "";
|
||||
|
||||
public bool IsTargetPD { get; set; } = false;
|
||||
|
||||
public bool IsOverallResponsePD { get; set; } = false;
|
||||
|
||||
//TR表 靶病灶PD了,访视层级的都是最早拍片日期 RS表 整体肿瘤评估PD了,那么疗效评估的拍片日期都给最早的
|
||||
public bool IsPD => Domain == "TR" ? IsTargetPD : IsOverallResponsePD;
|
||||
|
||||
public string ArmEnumStr { get; set; }
|
||||
public string LatestScanDateStr
|
||||
{
|
||||
get
|
||||
{
|
||||
var date = IsPD ? EarliestScanDate : LatestScanDate;
|
||||
return date?.ToString("yyyy-MM-dd") ?? "";
|
||||
}
|
||||
}
|
||||
public string TrialSiteSubjectCode => ResearchProgramNo + SubjectCode;
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public class TU_Export : TU_TR_RSBaseModel
|
||||
{
|
||||
|
||||
///// <summary>
|
||||
///// 取值类型 TUSPID
|
||||
///// </summary>
|
||||
//public string TUValueType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 序号 TUSEQ (同一个访视,所有阅片人选择病灶给个顺序号)
|
||||
/// </summary>
|
||||
public int No { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 链接ID TULNKID (阅片人角色_病灶编号)不同访视可以重复
|
||||
/// </summary>
|
||||
public string ARM_TumorNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤识别简称 TUTESTCD
|
||||
/// </summary>
|
||||
public string TumorIdentificationSimple { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤识别全称 TUTEST
|
||||
/// </summary>
|
||||
public string TumorIdentificationFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤鉴定结果 TUORRES
|
||||
/// </summary>
|
||||
public string TumorIdentificationResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤识别结果类型 TUSTRESC
|
||||
/// </summary>
|
||||
public string TumorIdentificationResultType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 部位 TULOC (对应病灶表的部位,需要国际化)
|
||||
/// </summary>
|
||||
public string BodyPart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴定方法 TUMETHOD (Modality?)
|
||||
/// </summary>
|
||||
public string IdentificationMethod { get; set; }
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 裁定标记 TUACPTFL
|
||||
///// </summary>
|
||||
//public bool? IsJudgeSelect { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 部位描述 LOCTEXT
|
||||
/// </summary>
|
||||
public string BodyPartDes { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TR_Export : TU_TR_RSBaseModel
|
||||
{
|
||||
|
||||
///// <summary>
|
||||
///// 取值类型 TRSPID
|
||||
///// </summary>
|
||||
//public string TRValueType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 每个subject 按照顺序编号 TRSEQ
|
||||
/// </summary>
|
||||
public int TRSEQ { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
///TRGRPID 组ID 对应TU表肿瘤鉴定结果 TumorIdentificationResult
|
||||
/// </summary>
|
||||
public string TRGRPID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TRLNKID 链接ID 对应TU表的链接ID TumorNo(阅片人角色_病灶编号)
|
||||
/// </summary>
|
||||
public string ARM_TumorNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///TRLNKGRP 链接组 ARM-任务名(访视名) 对应RS的链接组
|
||||
/// </summary>
|
||||
public string ARM_VisitName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤评估简称 TRTESTCD
|
||||
/// </summary>
|
||||
public string TumorAssessmentSimpleName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 肿瘤评估全称 TRTEST
|
||||
/// </summary>
|
||||
public string TumorAssessmentFullName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 原始测量 TRORRES
|
||||
/// </summary>
|
||||
public string OriginalMeasurements { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原始单位 TRORRESU
|
||||
/// </summary>
|
||||
public string OriginalUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准结果(字符) TRSTRESC
|
||||
/// </summary>
|
||||
public string StandardResult_Character => OriginalMeasurements;
|
||||
|
||||
/// <summary>
|
||||
/// 标准结果(数值) TRORRESU
|
||||
/// </summary>
|
||||
public string StandardResult_Numeric => double.TryParse(OriginalMeasurements, out _) ||
|
||||
(OriginalMeasurements?.EndsWith("%") == true &&
|
||||
double.TryParse(OriginalMeasurements.TrimEnd('%'), out _))
|
||||
? OriginalMeasurements
|
||||
: "";
|
||||
|
||||
/// <summary>
|
||||
/// 标准单位 TRSTRESU
|
||||
/// </summary>
|
||||
public string StandardUnit => OriginalUnit;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 完成状态 TRSTAT
|
||||
/// </summary>
|
||||
public string CompletionStatus { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 完成状态 TRMETHOD
|
||||
/// </summary>
|
||||
public string IdentificationMethod { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 无法测量原因 TRREASND
|
||||
/// </summary>
|
||||
public string NotMeasuredReason { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RS_Export : TU_TR_RSBaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// RSSEQ 按照subject 的数据顺序编号
|
||||
/// </summary>
|
||||
public int RSSEQ { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RSLNKGRP 链接组 ARM_任务名(访视名)
|
||||
/// </summary>
|
||||
public string ARM_VisitName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RSTESTCD 疗效评估简称
|
||||
/// </summary>
|
||||
public string EfficacyEvaluationSimpleName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RSTEST 疗效评估全称
|
||||
/// </summary>
|
||||
public string EfficacyEvaluationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// RSORRES 响应评估原始结果
|
||||
/// </summary>
|
||||
public string RespondEfficacyAssessment { get; set; }
|
||||
/// <summary>
|
||||
/// RSSTRESC 标准疗效评估
|
||||
/// </summary>
|
||||
public string StandardEfficacyAssessment => RespondEfficacyAssessment;
|
||||
|
||||
/// <summary>
|
||||
/// RSSTAT 完成状态
|
||||
/// </summary>
|
||||
public string CompletionStatus { get; set; }
|
||||
/// <summary>
|
||||
/// RSREASND 无法评估原因
|
||||
/// </summary>
|
||||
public string NotAssessmentReason { get; set; }
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 裁定标记 RSACPTFL
|
||||
///// </summary>
|
||||
//public bool? IsJudgeSelect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// REASASM 评估原因
|
||||
/// </summary>
|
||||
public string AssessmentReason { get; set; }
|
||||
/// <summary>
|
||||
/// REASOVR 重新评估原因
|
||||
/// </summary>
|
||||
public string ReAssessmentReason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// REASUPD 更新评估原因
|
||||
/// </summary>
|
||||
public string UpdateAssessmentReason { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public bool? IsOveralResponse { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class CO_Export : TU_TR_RSBaseModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联域 RS:(访视点备注) 空:裁判选择原因
|
||||
/// </summary>
|
||||
public string RDOMAIN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// COSEQ 序号
|
||||
/// </summary>
|
||||
public int COSEQ { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IDVAR 标识变量 RSSEQ 空:裁判选择原因
|
||||
/// </summary>
|
||||
public string IdentificationVariable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标识 IDVARVAL RSSEQ具体的值 空:裁判选择原因
|
||||
/// </summary>
|
||||
public string Identification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// COREF 备注引用
|
||||
/// </summary>
|
||||
public string RemarksQuote { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注 COVAL
|
||||
/// </summary>
|
||||
public string Remarks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 裁决日期 CODTC
|
||||
/// </summary>
|
||||
public string CODTC { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -760,7 +760,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (feedBack.VisitTaskId != null)
|
||||
{
|
||||
|
||||
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "Email_BusinessScenario" && t.ParentId != null && t.Code == ((int)EmailBusinessScenario.IRImageError).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
|
||||
var emailType = await _dictionaryRepository.Where(t => t.Parent.Code == "FeedBackTypeToIR" && t.ParentId != null && t.Code == ((int)feedBack.QuestionType).ToString()).Select(t => _userInfo.IsEn_Us ? t.Value : t.ValueCN).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var info = await _visitTaskRepository.Where(t => t.Id == feedBack.VisitTaskId).Select(t => new { t.Trial.ResearchProgramNo, t.Trial.TrialCode, SubejctCode = t.Subject.Code, t.SourceSubjectVisit.VisitName }).FirstNotNullAsync();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Service.Common;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
@@ -104,6 +105,14 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));
|
||||
|
||||
|
||||
CreateMap<TumorExportBaseModel , TU_Export>();
|
||||
CreateMap<TumorExportBaseModel, TR_Export>();
|
||||
CreateMap<TumorExportBaseModel, RS_Export>();
|
||||
CreateMap<TumorExportBaseModel, CO_Export>();
|
||||
|
||||
CreateMap<IVUS_OCTBaseDto, IvusExportDto>();
|
||||
CreateMap<IVUS_OCTBaseDto, OctExportDto>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,95 @@ using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
|
||||
public class AuditRecordView : AuditRecordAddOrEdit
|
||||
{
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
|
||||
public new List<Guid> IdnetityUserIdList => IdentityUserList.Select(t => t.Id).ToList();
|
||||
public List<AuditIdentiUserInfo> IdentityUserList { get; set; }
|
||||
}
|
||||
|
||||
public class AuditIdentiUserInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
|
||||
public class AuditRecordAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
public string AuditContent { get; set; }
|
||||
|
||||
public DateOnly AuditTime { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginTime { get; set; }
|
||||
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
public AuditState AuditState { get; set; }
|
||||
|
||||
public AuditType AuditType { get; set; }
|
||||
|
||||
//public List<Guid> IdnetityUserIdList { get; set; }
|
||||
}
|
||||
|
||||
public class AddOrDeleteAuditUserCommand
|
||||
{
|
||||
public Guid AuditRecordId { get; set; }
|
||||
|
||||
public List<Guid> IdentityUserIdList { get; set; }
|
||||
|
||||
public bool IsAdd { get; set; }
|
||||
}
|
||||
|
||||
public class AuditRecordQuery : PageInput
|
||||
{
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
public string? AuditContent { get; set; }
|
||||
|
||||
public DateOnly? BeginAuditTime { get; set; }
|
||||
public DateOnly? EndAuditTime { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginTime { get; set; }
|
||||
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
public AuditState? AuditState { get; set; }
|
||||
|
||||
public AuditType? AuditType { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginCreateTime { get; set; }
|
||||
|
||||
public DateTime? EndCreateTime { get; set; }
|
||||
|
||||
public string? IdentityUserName { get; set; }
|
||||
}
|
||||
|
||||
public class SetAuditRecordPermissionCommand
|
||||
{
|
||||
|
||||
public List<Guid> AuditDocumentIdList { get; set; }
|
||||
|
||||
public Guid AuditRecordId { get; set; }
|
||||
|
||||
public bool IsAuthorization { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class DeleteAudit
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
@@ -24,16 +113,21 @@ public class DeleteAuditDocumentInDto
|
||||
public List<Guid> Ids { get; set; }
|
||||
}
|
||||
|
||||
public class GetAuditDocumentDataInDto:PageInput
|
||||
public class GetAuditDocumentDataInDto : PageInput
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
public Guid? SelfId { get; set; }
|
||||
|
||||
|
||||
public bool? IsAuthorization { get; set; }
|
||||
|
||||
public bool? IsCurrentAuditRecordAuthorization { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
//当前稽查记录Id
|
||||
public Guid? AuditRecordId { get; set; }
|
||||
}
|
||||
|
||||
public class GetAuditDocumentDataOutDto
|
||||
@@ -53,17 +147,20 @@ public class AuditDocumentData : AuditDocumentUpdateDto
|
||||
public int? Version { get; set; }
|
||||
|
||||
public int HistoricalVersionsCount { get; set; }
|
||||
public List<AuditDocumentData> Children { get; set; }=new List<AuditDocumentData> (){ };
|
||||
public List<AuditDocumentData> Children { get; set; } = new List<AuditDocumentData>() { };
|
||||
|
||||
|
||||
public bool? IsCurrentAuditRecordAuthorization { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class AuditDocumentView : AuditDocumentAddOrEdit
|
||||
{
|
||||
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SetIsAuthorizationInDto
|
||||
@@ -80,7 +177,7 @@ public class SetCurrentVersionInDto
|
||||
|
||||
public class GetHistoricalVersionInDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public class GetHistoricalVersionOutDto
|
||||
@@ -93,10 +190,10 @@ public class MovieFileOrFolderInDto
|
||||
{
|
||||
public List<Guid> Ids { get; set; }
|
||||
|
||||
public Guid ParentId { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
}
|
||||
|
||||
public class HistoricalVersionDto: AuditDocumentUpdateDto
|
||||
public class HistoricalVersionDto : AuditDocumentUpdateDto
|
||||
{
|
||||
public bool IsCurrentVersion { get; set; } = false;
|
||||
|
||||
@@ -113,7 +210,7 @@ public class AuditDocumentUpdateDto
|
||||
|
||||
public AuditDocumentType AuditDocumentTypeEnum { get; set; }
|
||||
|
||||
public string? FileFormat { get; set; }
|
||||
public string? FileFormat { get; set; }
|
||||
|
||||
public string? FilePath { get; set; }
|
||||
|
||||
@@ -133,34 +230,34 @@ public class GetBreadcrumbDataInDto
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public class AuditDocumentAddOrEdit: AuditDocumentUpdateDto
|
||||
public class AuditDocumentAddOrEdit : AuditDocumentUpdateDto
|
||||
{
|
||||
|
||||
|
||||
public List<AuditDocumentAddOrEdit> Children { get; set; }=new List<AuditDocumentAddOrEdit>() { };
|
||||
|
||||
public List<AuditDocumentAddOrEdit> Children { get; set; } = new List<AuditDocumentAddOrEdit>() { };
|
||||
|
||||
public bool IsUpdate { get; set; } = true;
|
||||
}
|
||||
|
||||
public class AuditDocumentQuery:PageInput
|
||||
public class AuditDocumentQuery : PageInput
|
||||
{
|
||||
public AuditDocumentType? AuditDocumentTypeEnum { get; set; }
|
||||
|
||||
|
||||
public string? FileFormat { get; set; }
|
||||
|
||||
|
||||
public string? FilePath { get; set; }
|
||||
|
||||
public decimal? FileSize { get; set; }
|
||||
|
||||
|
||||
public decimal? FileSize { get; set; }
|
||||
|
||||
public bool? IsAuthorization { get; set; }
|
||||
|
||||
public Guid? MainFileId { get; set; }
|
||||
|
||||
|
||||
public Guid? MainFileId { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
var beforeUserTypeIds = document.NeedConfirmedUserTypeList.Select(x => x.NeedConfirmUserTypeId).ToList();
|
||||
|
||||
_mapper.Map(addOrEditSystemDocument, document);
|
||||
|
||||
document.UpdateTime = DateTime.Now;
|
||||
#region 之前区分路径文件夹 现在不区分废弃
|
||||
|
||||
//if (document.FileTypeId != addOrEditSystemDocument.FileTypeId)
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试定时发送
|
||||
/// 测试邮件定时发送
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> TestPush()
|
||||
@@ -139,6 +139,22 @@ namespace IRaCIS.Core.Application.Services
|
||||
return ResponseOutput.Result(true);
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> TestSendEmail()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
// 创建独立作用域
|
||||
using (var scope = serviceScopeFactory.CreateScope())
|
||||
{
|
||||
// 从新作用域解析服务
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
await mediator.Publish(new ImageQCRecurringEvent { TrialId= Guid.Parse("08de2254-5d7d-581a-0242-0a0001000000") });
|
||||
}
|
||||
});
|
||||
return ResponseOutput.Result(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting 界面的 项目所有文档列表
|
||||
/// </summary>
|
||||
@@ -900,7 +916,12 @@ namespace IRaCIS.Core.Application.Services
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> GetSysDocSignUserList()
|
||||
{
|
||||
var list = _systemDocConfirmedUserRepository.Where(t => t.ConfirmTime != null).Select(t => new { t.ConfirmUserId, t.ConfirmUser.UserName, t.ConfirmUser.FullName }).Distinct().ToList();
|
||||
//EA 只能查看内部人员文档
|
||||
var isEA = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.EA;
|
||||
|
||||
var list = _systemDocConfirmedUserRepository.Where(t => t.ConfirmTime != null)
|
||||
.WhereIf(isEA, t => t.ConfirmUser.IsZhiZhun == true)
|
||||
.Select(t => new { t.ConfirmUserId, t.ConfirmUser.UserName, t.ConfirmUser.FullName }).Distinct().ToList();
|
||||
|
||||
return ResponseOutput.Ok(list);
|
||||
}
|
||||
@@ -911,12 +932,15 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
var isInternal = _userInfo.IsZhiZhun;
|
||||
|
||||
var isEA = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.EA;
|
||||
|
||||
var systemDocQuery =
|
||||
from sysDoc in _systemDocumentRepository.AsQueryable(false)
|
||||
.Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true)
|
||||
from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.Status == UserStateEnum.Enable && t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId)))
|
||||
.Where(t => inQuery.UserId != null ? t.Id == inQuery.UserId : true)
|
||||
.Where(t => inQuery.UserTypeId != null ? t.UserRoleList.Any(t => t.UserTypeId == inQuery.UserTypeId && t.IsUserRoleDisabled == false) : true)
|
||||
.Where(t => isEA ? t.IsZhiZhun == true : true) //EA 只能查看内部人员文档
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = identityUser.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
@@ -942,7 +966,14 @@ namespace IRaCIS.Core.Application.Services
|
||||
//UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
FullFilePath = sysDoc.Path
|
||||
FullFilePath = sysDoc.Path,
|
||||
|
||||
AttachmentCount = sysDoc.SystemDocumentAttachmentList.Where(t => t.OffLine == false).Count(),
|
||||
|
||||
DocNeedSignUserTypeList = sysDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
||||
|
||||
IdentityUserTypeList = identityUser.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Select(c => c.UserTypeRole.UserTypeShortName).ToList()
|
||||
|
||||
};
|
||||
|
||||
var unionQuery = systemDocQuery.IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmTime == null))
|
||||
@@ -956,44 +987,44 @@ namespace IRaCIS.Core.Application.Services
|
||||
.WhereIf(inQuery.EndCreateTime != null, t => t.CreateTime <= inQuery.EndCreateTime)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.UserName), t => t.UserName.Contains(inQuery.UserName))
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
||||
.WhereIf(isInternal == false, t => t.ConfirmTime != null);
|
||||
.WhereIf(isInternal == false, t => t.ConfirmTime != null); //不是内部的人,看有签名时间的
|
||||
|
||||
var result = await unionQuery.ToPagedListAsync(inQuery);
|
||||
|
||||
#region 处理文档 需要签署的角色类型 和每个人的角色信息
|
||||
|
||||
var trialDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
|
||||
//var trialDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
|
||||
|
||||
var sysDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
|
||||
//var sysDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
|
||||
|
||||
var identityUserIdList = result.CurrentPageData.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||
//var identityUserIdList = result.CurrentPageData.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||
|
||||
|
||||
var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
|
||||
//var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
|
||||
|
||||
var identityUserUserTypeList = _identityUserRepository.Where(t => identityUserIdList.Contains(t.Id)).IgnoreQueryFilters().Select(t => new { IdentityUserId = t.Id, UserTypeList = t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Select(c => c.UserTypeRole.UserTypeShortName).ToList() });
|
||||
//var identityUserUserTypeList = _identityUserRepository.Where(t => identityUserIdList.Contains(t.Id)).IgnoreQueryFilters().Select(t => new { IdentityUserId = t.Id, UserTypeList = t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Select(c => c.UserTypeRole.UserTypeShortName).ToList() });
|
||||
|
||||
//Concat 不能用导航属性
|
||||
var sysids = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
|
||||
////Concat 不能用导航属性
|
||||
//var sysids = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
|
||||
|
||||
var sysDataList = await _systemDocumentRepository.Where(x => sysids.Contains(x.Id)).Include(x => x.SystemDocumentAttachmentList).ToListAsync();
|
||||
//var sysDataList = await _systemDocumentRepository.Where(x => sysids.Contains(x.Id)).Include(x => x.SystemDocumentAttachmentList).ToListAsync();
|
||||
|
||||
foreach (var item in result.CurrentPageData)
|
||||
{
|
||||
//foreach (var item in result.CurrentPageData)
|
||||
//{
|
||||
|
||||
if (sysDataList.Any(y => y.Id == item.Id))
|
||||
{
|
||||
item.AttachmentCount = sysDataList.Where(y => y.Id == item.Id).Select(x => x.SystemDocumentAttachmentList.Where(z => !z.OffLine).Count()).FirstOrDefault();
|
||||
}
|
||||
// if (sysDataList.Any(y => y.Id == item.Id))
|
||||
// {
|
||||
// item.AttachmentCount = sysDataList.Where(y => y.Id == item.Id).Select(x => x.SystemDocumentAttachmentList.Where(z => !z.OffLine).Count()).FirstOrDefault();
|
||||
// }
|
||||
|
||||
if (item.IsSystemDoc)
|
||||
{
|
||||
item.DocNeedSignUserTypeList = sysDocUserTypeList.Where(t => t.SystemDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
|
||||
}
|
||||
// if (item.IsSystemDoc)
|
||||
// {
|
||||
// item.DocNeedSignUserTypeList = sysDocUserTypeList.Where(t => t.SystemDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
|
||||
// }
|
||||
|
||||
|
||||
item.IdentityUserTypeList = identityUserUserTypeList.Where(t => t.IdentityUserId == item.ConfirmUserId).SelectMany(c => c.UserTypeList).ToList();
|
||||
}
|
||||
// item.IdentityUserTypeList = identityUserUserTypeList.Where(t => t.IdentityUserId == item.ConfirmUserId).SelectMany(c => c.UserTypeList).ToList();
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -1064,7 +1095,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
var beforeUserTypeIds = document.NeedConfirmedUserTypeList.Select(x => x.NeedConfirmUserTypeId).ToList();
|
||||
|
||||
_mapper.Map(addOrEditTrialDocument, document);
|
||||
|
||||
document.UpdateTime = DateTime.Now;
|
||||
#region 不区分路径了
|
||||
|
||||
//if (document.FileTypeId != addOrEditTrialDocument.FileTypeId)
|
||||
|
||||
@@ -1763,22 +1763,22 @@ x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && x.Readi
|
||||
|
||||
await _trialEmailNoticeConfigRepository.SaveChangesAsync();
|
||||
|
||||
var cronInfo = await _trialEmailNoticeConfigRepository.Where(t => t.Id == addOrEditTrialEmailNoticeConfig.Id)
|
||||
.Select(t => new { t.Id, t.Code, TrialCode = t.Trial.TrialCode, t.EmailCron, t.BusinessScenarioEnum, t.TrialId })
|
||||
.FirstAsync();
|
||||
// var cronInfo = await _trialEmailNoticeConfigRepository.Where(t => t.Id == addOrEditTrialEmailNoticeConfig.Id)
|
||||
//.Select(t => new { t.Id, t.Code, TrialCode = t.Trial.TrialCode, t.EmailCron, t.BusinessScenarioEnum, t.TrialId })
|
||||
//.FirstAsync();
|
||||
|
||||
var jobId = $"{cronInfo.TrialId}({cronInfo.TrialCode})_({cronInfo.BusinessScenarioEnum})";
|
||||
// var jobId = $"{cronInfo.TrialId}({cronInfo.TrialCode})_({cronInfo.BusinessScenarioEnum})";
|
||||
|
||||
|
||||
if (addOrEditTrialEmailNoticeConfig.IsAutoSend)
|
||||
{
|
||||
HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, addOrEditTrialEmailNoticeConfig.TrialId, addOrEditTrialEmailNoticeConfig.BusinessScenarioEnum, addOrEditTrialEmailNoticeConfig.EmailCron);
|
||||
// if (addOrEditTrialEmailNoticeConfig.IsAutoSend)
|
||||
// {
|
||||
// HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, addOrEditTrialEmailNoticeConfig.TrialId, addOrEditTrialEmailNoticeConfig.BusinessScenarioEnum, addOrEditTrialEmailNoticeConfig.EmailCron);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
HangfireJobHelper.RemoveCronJob(jobId);
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// HangfireJobHelper.RemoveCronJob(jobId);
|
||||
// }
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<AuditDocument, AuditDocumentUpdateDto>();
|
||||
CreateMap<AuditDocument, HistoricalVersionDto>();
|
||||
CreateMap<AuditDocumentUpdateDto, AuditDocumentAddOrEdit>();
|
||||
CreateMap<AuditDocument, AuditDocumentData>();
|
||||
CreateMap<AuditDocument, AuditDocumentData>()
|
||||
.ForMember(d => d.HistoricalVersionsCount, u => u.MapFrom(s => s.AuditDocumentOldVersionList.Count()));
|
||||
CreateMap<AuditDocument, AuditDocumentAddOrEdit>().ReverseMap();
|
||||
CreateMap<SystemDocument, SystemDocumentView>()
|
||||
.ForMember(d => d.AttachmentCount, u => u.MapFrom(s => s.SystemDocumentAttachmentList.Count()))
|
||||
@@ -43,7 +44,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<TrialDocument, TrialDocumentView>()
|
||||
.ForMember(d => d.AttachmentCount, u => u.MapFrom(s =>s.TrialDocumentAttachmentList.Count()))
|
||||
.ForMember(d => d.AttachmentCount, u => u.MapFrom(s => s.TrialDocumentAttachmentList.Count()))
|
||||
.ForMember(d => d.FileType, u => u.MapFrom(s => isEn_Us ? s.FileType.Value : s.FileType.ValueCN))
|
||||
.ForMember(d => d.IsSomeUserSigned, u => u.MapFrom(s => s.TrialDocConfirmedUserList.Any(t => t.ConfirmTime != null)))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path));
|
||||
@@ -81,7 +82,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<BatchAddTrialEmailNoticeConfig, TrialEmailNoticeConfig>();
|
||||
|
||||
CreateMap<TrialSelectEmailNoticeConfigView, BatchAddTrialEmailNoticeConfig > ();
|
||||
CreateMap<TrialSelectEmailNoticeConfigView, BatchAddTrialEmailNoticeConfig>();
|
||||
|
||||
|
||||
CreateMap<AddOrEditTrialDocument, TrialDocument>()
|
||||
@@ -94,13 +95,14 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
CreateMap<AddOrEditSystemDocument, SystemDocument>().ForMember(d => d.NeedConfirmedUserTypeList, c => c.MapFrom(t => t.NeedConfirmedUserTypeIdList));
|
||||
CreateMap<Guid, SystemDocNeedConfirmedUserType>().EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId)
|
||||
CreateMap<Guid, SystemDocNeedConfirmedUserType>()
|
||||
.EqualityComparison((odto, o) => odto == o.NeedConfirmUserTypeId)
|
||||
.ForMember(d => d.NeedConfirmUserTypeId, c => c.MapFrom(t => t))
|
||||
.ForMember(d => d.SystemDocumentId, c => c.Ignore());
|
||||
|
||||
|
||||
CreateMap<TrialEmailNoticeConfig, TrialEmailNoticeConfigView>()
|
||||
.ForMember(d => d.SysCriterionTypeList, c => c.MapFrom(t => t.SysEmailNoticeConfig.CriterionTypeList))
|
||||
.ForMember(d => d.SysCriterionTypeList, c => c.MapFrom(t => t.SysEmailNoticeConfig.CriterionTypeList))
|
||||
.ForMember(d => d.TrialCriterionName, c => c.MapFrom(t => t.TrialReadingCriterion.CriterionName))
|
||||
.ForMember(d => d.TrialEmailNoticeUserList, c => c.MapFrom(t => t.TrialEmailNoticeUserList));
|
||||
|
||||
@@ -146,6 +148,26 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<TrialHistoryRecordFile, TrialHistoryRecordFileView>();
|
||||
CreateMap<TrialHistoryRecordFile, TrialHistoryRecordFileAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
|
||||
CreateMap<AuditRecord, AuditRecordView>()
|
||||
.ForMember(d => d.IdentityUserList, c => c.MapFrom(t => t.AuditRecordIdentityUserList));
|
||||
|
||||
CreateMap<AuditRecordAddOrEdit, AuditRecord>()
|
||||
/* .ForMember(d => d.AuditRecordIdentityUserList, c => c.MapFrom(t => t.IdnetityUserIdList))*/;
|
||||
|
||||
CreateMap<Guid, AuditRecordIdentityUser>()
|
||||
.EqualityComparison((odto, o) => odto == o.IdentityUserId)
|
||||
.ForMember(d => d.AuditRecordId, c => c.Ignore())
|
||||
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t));
|
||||
|
||||
|
||||
CreateMap<AuditRecordIdentityUser, AuditIdentiUserInfo>()
|
||||
.ForMember(d => d.Id, c => c.MapFrom(t => t.IdentityUser.Id))
|
||||
.ForMember(d => d.UserName, c => c.MapFrom(t => t.IdentityUser.UserName))
|
||||
.ForMember(d => d.FullName, c => c.MapFrom(t => t.IdentityUser.FullName));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
{
|
||||
@@ -27,6 +28,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
|
||||
public List<StudyBasicInfo> UploadStudyList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<StudyBasicInfo> OriginalTaskStudyList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +106,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
|
||||
public string BodyPartForEdit { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
public DateTime? StudyTime { get; set; }
|
||||
|
||||
public string Modalities { get; set; }
|
||||
@@ -114,6 +120,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
public int ReadingSeriesCount { get; set; }
|
||||
|
||||
public int ReadingInstanceCount { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
}
|
||||
|
||||
public class NoneDicomStudyBasicInfo
|
||||
@@ -126,6 +134,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
|
||||
public string BodyPart { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
public string Modality { get; set; }
|
||||
|
||||
public DateTime ImageDate { get; set; }
|
||||
@@ -136,5 +146,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
public int ReadingFileCount { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ImageMarkNoneDicomStudyBasicInfo: NoneDicomStudyBasicInfo
|
||||
{
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
public int FileCount { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class PreArchiveDicomStudyCommand
|
||||
@@ -237,6 +238,9 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
|
||||
public bool? IsImageSegmentLabel { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class TaskStudyArchiveConfirmResult
|
||||
@@ -265,8 +269,9 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public AddOrUpdateStudyDto Study { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
public bool? IsImageSegmentLabel { get; set; }
|
||||
}
|
||||
|
||||
public class NewArchiveStudyCommand
|
||||
@@ -440,12 +445,17 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string? SubjectCode { get; set; }
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
public bool? IsImageSegmentLabel { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
}
|
||||
|
||||
public class IRTaskUploadedDicomStudyQuery
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
}
|
||||
|
||||
public class IRUploadTaskDicomStudyDto : DicomStudyBasicInfo
|
||||
@@ -519,6 +529,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string TaskBlindName { get; set; }
|
||||
|
||||
public string TaskName { get; set; }
|
||||
|
||||
public string VisitName { get; set; }
|
||||
public Guid? SourceSubjectVisitId { get; set; }
|
||||
|
||||
public ReadingTaskState ReadingTaskState { get; set; }
|
||||
@@ -540,7 +552,11 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public Guid VisitId { get; set; }
|
||||
|
||||
public List<DownloadDicomStudyDto> StudyList { get; set; }
|
||||
public List<DownloadNoneDicomStudyDto> NoneDicomStudyList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<DownloadDicomStudyDto> TaskStudyList { get; set; }
|
||||
|
||||
public List<DownloadNoneDicomStudyDto> NoneDicomStudyList { get; set; }
|
||||
}
|
||||
|
||||
public class DownloadDicomStudyDto
|
||||
@@ -609,6 +625,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string? SubjectCode { get; set; }
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
public bool? IsImageSegmentLabel { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -629,6 +647,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public List<Guid> NoneDicomStudyIdList { get; set; }
|
||||
|
||||
public bool? IsImageSegmentLabel { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class TrialKeyImageExportDTO
|
||||
@@ -878,4 +898,88 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public Guid TaskId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SubjectVisitMarkQuery:PageInput
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
public string? SubjectCode { get; set; }
|
||||
|
||||
public bool? IsUrgent { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SubjectVisitMarkDTO
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public bool IsUrgent { get; set; }
|
||||
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
|
||||
public int? VisitCount { get; set; }
|
||||
|
||||
|
||||
public int? MarkVisitCount { get; set; }
|
||||
|
||||
|
||||
public int? DicomStudyCount { get; set; }
|
||||
|
||||
public int? MarkDicomStudyCount { get; set; }
|
||||
|
||||
public int? NoneDicomStudyCount { get; set; }
|
||||
|
||||
public int? MarkNoneDicomStudyCount { get; set; }
|
||||
}
|
||||
|
||||
public class SubjectVisitMarkStudyDto
|
||||
{
|
||||
public bool IsDicom => DicomStudyList.Count() > 0;
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
|
||||
public string VisitName { get; set; }
|
||||
|
||||
public Guid SourceSubjectVisitId { get; set; }
|
||||
|
||||
|
||||
public List<DicomStudyBasicInfo> DicomStudyList { get; set; } = new List<DicomStudyBasicInfo>();
|
||||
|
||||
public List<NoneDicomStudyBasicInfo> NoneDicomStudyList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SubjectVisitMarkUploadDto
|
||||
{
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubejctId { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
|
||||
public string VisitName { get; set; }
|
||||
|
||||
public Guid? SourceSubjectVisitId => SubjectVisitId;
|
||||
|
||||
//防止前端null 故意返回
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public List<StudyBasicInfo> OrginalStudyList { get; set; }
|
||||
|
||||
public List<StudyBasicInfo> UploadStudyList { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,9 @@
|
||||
// 生成时间 2021-12-06 10:54:55
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Medallion.Threading;
|
||||
@@ -34,7 +36,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
[FromQuery] Guid? nonedicomStudyId,
|
||||
[FromQuery] bool isFilterZip,
|
||||
[FromQuery] Guid? visitTaskId,
|
||||
[FromQuery] bool isReading)
|
||||
[FromQuery] bool isReading,
|
||||
[FromQuery] bool? isImageSegmentLabel)
|
||||
{
|
||||
var qcAuditState = await _subjectVisitRepository.Where(s => s.Id == subjectVisitId).Select(t => t.AuditState).FirstOrDefaultAsync();
|
||||
|
||||
@@ -45,30 +48,65 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
var isViewDelete = !isQCFinished;
|
||||
|
||||
IQueryable<NoneDicomStudyView> noneDicomStudyQueryable = default;
|
||||
if (visitTaskId == null)
|
||||
if (visitTaskId == null || visitTaskId == Guid.Empty)
|
||||
{
|
||||
//质控过程中,需要忽略过滤质控设置删除的检查,以及设置删除的文件,质控通过后才
|
||||
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId, ignoreQueryFilters: isViewDelete)
|
||||
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
|
||||
.WhereIf(isReading, t => t.IsReading && t.IsDeleted == false)
|
||||
if (visitTaskId == null)
|
||||
{
|
||||
|
||||
//质控过程中,需要忽略过滤质控设置删除的检查,以及设置删除的文件,质控通过后才
|
||||
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId, ignoreQueryFilters: isViewDelete)
|
||||
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
|
||||
.WhereIf(isReading, t => t.IsReading && t.IsDeleted == false)
|
||||
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, isReading = isReading });
|
||||
}
|
||||
else
|
||||
{
|
||||
//靶段标注上传后查看影像
|
||||
|
||||
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId, ignoreQueryFilters: isViewDelete)
|
||||
.WhereIf(isReading, t => t.IsReading && t.IsDeleted == false)
|
||||
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
|
||||
.ProjectTo<ImageLabelNoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, isReading = isReading });
|
||||
|
||||
}
|
||||
|
||||
|
||||
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, isReading = isReading });
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(t => new { t.BlindSubjectCode, t.TrialReadingCriterionId, t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys }).FirstNotNullAsync();
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(t => new { t.BlindSubjectCode, t.TrialReadingCriterionId, t.TrialReadingCriterion.CriterionType, t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys }).FirstNotNullAsync();
|
||||
|
||||
if ((taskinfo.CriterionType == CriterionType.IVUS || taskinfo.CriterionType == CriterionType.OCT) && isImageSegmentLabel == false)
|
||||
{
|
||||
//后处理原始影像预览
|
||||
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId, ignoreQueryFilters: isViewDelete)
|
||||
.WhereIf(isReading, t => t.IsReading && t.IsDeleted == false)
|
||||
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
|
||||
.Where(t => taskinfo.IsImageFilter ? ("|" + taskinfo.CriterionModalitys + "|").Contains("|" + t.Modality + "|") : true)
|
||||
.ProjectTo<ImageLabelNoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visitTaskId, isReading = isReading });
|
||||
}
|
||||
else
|
||||
{
|
||||
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == visitTaskId), ignoreQueryFilters: isViewDelete)
|
||||
.WhereIf(isReading, t => t.IsReading && t.IsDeleted == false)
|
||||
.Where(t => taskinfo.IsImageFilter ? ("|" + taskinfo.CriterionModalitys + "|").Contains("|" + t.Modality + "|") : true)
|
||||
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
|
||||
.ProjectTo<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visitTaskId, isReading = isReading });
|
||||
}
|
||||
|
||||
|
||||
noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.TaskNoneDicomFileList.Any(t => t.VisitTaskId == visitTaskId), ignoreQueryFilters: isViewDelete)
|
||||
.WhereIf(isReading, t => t.IsReading && t.IsDeleted == false)
|
||||
.Where(t => taskinfo.IsImageFilter ? ("|" + taskinfo.CriterionModalitys + "|").Contains("|" + t.Modality + "|") : true)
|
||||
.WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
|
||||
.ProjectTo<TaskDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip, visiTaskId = visitTaskId, isReading = isReading });
|
||||
}
|
||||
|
||||
var isFilterIVUSNoneDicom = false;
|
||||
if (_subjectVisitRepository.Where(t => t.Id == subjectVisitId).SelectMany(t => t.Trial.TrialReadingCriterionList)
|
||||
.Where(t => t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT).Distinct().Count() == 2
|
||||
)
|
||||
{
|
||||
isFilterIVUSNoneDicom = true;
|
||||
}
|
||||
|
||||
var list = await noneDicomStudyQueryable.OrderBy(x => x.ImageDate).ThenBy(x => x.CreateTime).ToListAsync();
|
||||
var list = await noneDicomStudyQueryable.Where(t => isFilterIVUSNoneDicom ? t.Modality != "IVUS" : true)
|
||||
.OrderBy(x => x.ImageDate).ThenBy(x => x.CreateTime).ToListAsync();
|
||||
|
||||
var config = await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).Select(t => new { t.Trial.ImageFormatList, t.Trial.StudyNameList, t.Trial.IsShowStudyName, AuditState = qcAuditState }).FirstOrDefaultAsync();
|
||||
return ResponseOutput.Ok(list, config);
|
||||
|
||||
@@ -323,18 +323,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
}
|
||||
|
||||
#region 只配置单个部位自动赋值
|
||||
//项目配置的影像部位
|
||||
var trialBodyParts = _trialRepository.Where(t => t.Id == trialId).Select(t => t.BodyPartTypes).FirstOrDefault();
|
||||
|
||||
var trialBodyPartList = trialBodyParts.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (trialBodyPartList.Count() == 1)
|
||||
{
|
||||
var first = trialBodyPartList.First();
|
||||
findStudy.BodyPartForEdit = first;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
var @lock2 = _distributedLockProvider.CreateLock($"StudyCommit");
|
||||
@@ -579,7 +568,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
/// <returns></returns>
|
||||
[HttpGet("{subjectVisitId:guid}")]
|
||||
[AllowAnonymous]
|
||||
public IResponseOutput<List<RelationStudyDTO>> GetAllRelationStudyList(Guid subjectVisitId,bool? isReading)
|
||||
public IResponseOutput<List<RelationStudyDTO>> GetAllRelationStudyList(Guid subjectVisitId, bool? isReading)
|
||||
{
|
||||
#region 废弃
|
||||
//var studylist = _studyRepository.Where(u => u.SubjectVisitId == subjectVisitId && u.IsDeleted == false).Select(t => new { StudyId = t.Id, t.SubjectId, t.TrialId }).ToList();
|
||||
@@ -608,17 +597,17 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
var studyInfo = _dicomStudyRepository.Where(u => u.SubjectVisitId == subjectVisitId).Select(t => new { t.SubjectId, t.TrialId }).FirstOrDefault().IfNullThrowException();
|
||||
|
||||
var list = _dicomStudyRepository.Where(t => t.SubjectVisitId != subjectVisitId && t.TrialId == studyInfo.TrialId && t.SubjectId == studyInfo.SubjectId)
|
||||
.Select(t=> new RelationStudyDTO()
|
||||
.Select(t => new RelationStudyDTO()
|
||||
{
|
||||
StudyId = t.Id,
|
||||
StudyCode = t.StudyCode,
|
||||
VisitName = t.SubjectVisit.VisitName,
|
||||
Modalities = t.Modalities,
|
||||
Description = t.Description,
|
||||
SeriesCount = t.SeriesList.Where(t=> isReading==true? t.IsReading==true:true).Count()
|
||||
}) .ToList();
|
||||
SeriesCount = t.SeriesList.Where(t => isReading == true ? t.IsReading == true : true).Count()
|
||||
}).ToList();
|
||||
|
||||
list = list.Where(t=>t.SeriesCount>0).OrderBy(u => u.VisitName).ThenBy(s => s.StudyCode).ToList();
|
||||
list = list.Where(t => t.SeriesCount > 0).OrderBy(u => u.VisitName).ThenBy(s => s.StudyCode).ToList();
|
||||
|
||||
return ResponseOutput.Ok(list);
|
||||
}
|
||||
@@ -628,7 +617,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
/// <param name="studyId"> Dicom检查的Id </param>
|
||||
[HttpGet, Route("{studyId:guid}")]
|
||||
[AllowAnonymous]
|
||||
public IResponseOutput<DicomStudyDTO> Item(Guid studyId,bool? isPacs)
|
||||
public IResponseOutput<DicomStudyDTO> Item(Guid studyId, bool? isPacs)
|
||||
{
|
||||
if (isPacs == true)
|
||||
{
|
||||
@@ -861,7 +850,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
|
||||
|
||||
var verifyStudyInfo = _dicomStudyRepository.Where(t => t.TrialId == trialId && t.Id == expectStudyId,false,true).ProjectTo<VerifyStudyDto>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
var verifyStudyInfo = _dicomStudyRepository.Where(t => t.TrialId == trialId && t.Id == expectStudyId, false, true).ProjectTo<VerifyStudyDto>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
result.StudyInfo = verifyStudyInfo;
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<DicomStudy, DicomStudyDTO>();
|
||||
CreateMap<DicomSeries, DicomSeriesDTO>()
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.SubjectVisit.Subject.Code))
|
||||
.ForMember(o => o.VisitName, t => t.MapFrom(u => u.SubjectVisit.VisitName));
|
||||
.ForMember(o => o.VisitName, t => t.MapFrom(u => u.SubjectVisit.VisitName));
|
||||
CreateMap<SCPSeries, DicomSeriesDTO>();
|
||||
|
||||
|
||||
@@ -136,6 +136,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.ReadingSeriesCount, u => u.MapFrom(s => s.SeriesList.Where(t => t.IsReading).Count()))
|
||||
.ForMember(d => d.ReadingInstanceCount, u => u.MapFrom(s => s.InstanceList.Where(t => t.IsReading && t.DicomSerie.IsReading).Count()));
|
||||
|
||||
CreateMap<TaskStudy, DicomStudyBasicInfo>()
|
||||
//.ForMember(d => d.SubjectVisitId, u => u.MapFrom(s => s.SubjectVisitId))
|
||||
.ForMember(d => d.ReadingSeriesCount, u => u.MapFrom(s => s.SeriesCount))
|
||||
.ForMember(d => d.ReadingInstanceCount, u => u.MapFrom(s => s.InstanceCount));
|
||||
|
||||
CreateMap<NoneDicomStudy, NoneDicomStudyBasicInfo>()
|
||||
.ForMember(d => d.ReadingFileCount, u => u.MapFrom(s => s.NoneDicomFileList.Where(t => t.IsReading).Count()));
|
||||
|
||||
@@ -145,7 +150,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.CriterionModalitys, u => u.MapFrom(s => s.TrialReadingCriterion.CriterionModalitys))
|
||||
.ForMember(d => d.SubjectCode, u => u.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindSubjectCode : u.Subject.Code))
|
||||
.ForMember(d => d.DicomStudyList, u => u.MapFrom(s => s.SourceSubjectVisit.StudyList))
|
||||
.ForMember(d => d.NoneDicomStudyList, u => u.MapFrom(s => s.SourceSubjectVisit.NoneDicomStudyList.Where(t => t.IsReading)));
|
||||
.ForMember(d => d.NoneDicomStudyList, u => u.MapFrom(s => s.SourceSubjectVisit.NoneDicomStudyList.Where(t => t.IsReading)));
|
||||
|
||||
CreateMap<TrialImageDownload, TrialImageDownloadView>()
|
||||
.ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName))
|
||||
@@ -158,7 +163,25 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<SCPSeries, DicomSeriesDTO>();
|
||||
|
||||
CreateMap<NoneDicomEdit, NoneDicomStudy>();
|
||||
|
||||
|
||||
|
||||
CreateMap<SubjectVisit, SubjectVisitMarkStudyDto>()
|
||||
.ForMember(d => d.SourceSubjectVisitId, u => u.MapFrom(u => u.Id))
|
||||
.ForMember(d => d.SubjectCode, u => u.MapFrom(u => u.Subject.Code))
|
||||
.ForMember(d => d.DicomStudyList, u => u.MapFrom(s => s.StudyList))
|
||||
.ForMember(d => d.NoneDicomStudyList, u => u.MapFrom(s => s.NoneDicomStudyList.Where(t => t.IsReading)));
|
||||
|
||||
|
||||
|
||||
CreateMap<NoneDicomStudy, ImageMarkNoneDicomStudyBasicInfo>()
|
||||
.ForMember(d => d.SubjectVisitId, u => u.MapFrom(s => s.SubjectVisitId))
|
||||
.ForMember(d => d.FileCount, u => u.MapFrom(s => s.ImageLabelNoneDicomFileList.Count()))
|
||||
.ForMember(d => d.ReadingFileCount, u => u.MapFrom(s => s.ImageLabelNoneDicomFileList.Count()));
|
||||
|
||||
CreateMap<ImageMarkNoneDicomStudyBasicInfo, NoneDicomStudyBasicInfo>();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -846,10 +846,26 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (jsonObject["DictionaryCode"] != null && jsonObject["DictionaryCode"].ToString() != string.Empty)
|
||||
{
|
||||
|
||||
jsonObject[item.Code] = await _dictionaryRepository.Where(x => x.Code == jsonObject["DictionaryCode"].ToString()).Join(_dictionaryRepository.Where(x => x.Code == jsonObject[item.Code].ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
|
||||
if (jsonObject[item.Code].ToString().Contains(","))
|
||||
{
|
||||
value = _userInfo.IsEn_Us ? b.Value : b.ValueCN
|
||||
}).Select(x => x.value).FirstOrDefaultAsync();
|
||||
var data = jsonObject[item.Code].ToString().Split(',').ToList();
|
||||
|
||||
var codeList = await _dictionaryRepository.Where(x => x.Code == jsonObject["DictionaryCode"].ToString()).Join(_dictionaryRepository.Where(x => data.Contains(x.Code)), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value = _userInfo.IsEn_Us ? b.Value : b.ValueCN
|
||||
}).Select(x => x.value).ToListAsync();
|
||||
jsonObject[item.Code] = string.Join(",", codeList);
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonObject[item.Code] = await _dictionaryRepository.Where(x => x.Code == jsonObject["DictionaryCode"].ToString()).Join(_dictionaryRepository.Where(x => x.Code == jsonObject[item.Code].ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value = _userInfo.IsEn_Us ? b.Value : b.ValueCN
|
||||
}).Select(x => x.value).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
jsonList.Add(jsonObject);
|
||||
@@ -917,10 +933,25 @@ namespace IRaCIS.Core.Application.Service
|
||||
//通过字典项的code 翻译 枚举或者 bool
|
||||
else
|
||||
{
|
||||
jsonDataDic[item.Key] = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => x.Code == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
if (value.ToString().Contains(","))
|
||||
{
|
||||
value = _userInfo.IsEn_Us ? b.Value : b.ValueCN
|
||||
}).Select(x => x.value).FirstOrDefaultAsync();
|
||||
var data = value.ToString().Split(',').ToList();
|
||||
|
||||
var codeList = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => data.Contains(x.Code)), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value = _userInfo.IsEn_Us ? b.Value : b.ValueCN
|
||||
}).Select(x => x.value).ToListAsync();
|
||||
jsonDataDic[item.Key] = string.Join(",", codeList);
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonDataDic[item.Key] = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => x.Code == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value = _userInfo.IsEn_Us ? b.Value : b.ValueCN
|
||||
}).Select(x => x.value).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,8 @@ namespace IRaCIS.Application.Contracts
|
||||
public string OrganizationName { get; set; } = string.Empty;
|
||||
public Guid? UserType { get; set; }
|
||||
|
||||
public UserTypeEnum? UserTypeEnum { get; set; }
|
||||
|
||||
public bool? IsTestUser { get; set; }
|
||||
|
||||
public bool? IsZhiZhun { get; set; }
|
||||
@@ -313,6 +315,10 @@ namespace IRaCIS.Application.Contracts
|
||||
public DateTime? EndLastChangePassWordTime { get; set; }
|
||||
|
||||
public UserCeateSource? UserCeateSource { get; set; }
|
||||
|
||||
public Guid? AuditRecordId { get; set; }
|
||||
|
||||
public bool? IsAuditRecordUserSelect { get; set; }
|
||||
}
|
||||
|
||||
public class UserRoleInfoDTO
|
||||
@@ -352,6 +358,9 @@ namespace IRaCIS.Application.Contracts
|
||||
#endregion
|
||||
|
||||
public int JoinedTrialCount { get; set; }
|
||||
|
||||
|
||||
public bool IsAuditRecordUserSelect { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
Task<IResponseOutput<UserAddedReturnDTO>> AddUser(UserCommand userAddModel);
|
||||
//Task<IResponseOutput> DeleteUser(Guid userId);
|
||||
//Task<UserDetailDTO> GetUser(Guid id);
|
||||
Task<PageOutput<UserListDTO>> GetUserList(UserListQueryDTO param);
|
||||
//Task<PageOutput<UserListDTO>> GetUserList(UserListQueryDTO param);
|
||||
//Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password);
|
||||
Task<IResponseOutput> VerifyMFACodeAsync(string Code);
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<UserListDTO>> GetUserList(UserListQueryDTO inQuery)
|
||||
public async Task<PageOutput<UserListDTO>> GetUserList(UserListQueryDTO inQuery, [FromServices] IRepository<AuditRecordIdentityUser> _auditRecordIdentityUserRepository)
|
||||
{
|
||||
|
||||
var userQueryable = _identityUserRepository.Where(x => x.UserRoleList.Any(x => x.UserTypeEnum != UserTypeEnum.SuperAdmin))
|
||||
@@ -510,14 +510,36 @@ namespace IRaCIS.Core.Application.Service
|
||||
.WhereIf(inQuery.EndLastLoginTime != null, t => t.LastLoginTime <= inQuery.EndLastLoginTime)
|
||||
.WhereIf(inQuery.BeginLastChangePassWordTime != null, t => t.LastChangePassWordTime >= inQuery.BeginLastChangePassWordTime)
|
||||
.WhereIf(inQuery.EndLastChangePassWordTime != null, t => t.LastChangePassWordTime <= inQuery.EndLastChangePassWordTime)
|
||||
.WhereIf(inQuery.UserType != null, t => t.UserRoleList.Any(t => t.UserTypeId == inQuery.UserType && t.IsUserRoleDisabled==false))
|
||||
.WhereIf(inQuery.UserType != null, t => t.UserRoleList.Any(t => t.UserTypeId == inQuery.UserType && t.IsUserRoleDisabled == false))
|
||||
.WhereIf(inQuery.UserTypeEnum != null, t => t.UserRoleList.Any(t => t.UserTypeRole.UserTypeEnum == inQuery.UserTypeEnum && t.IsUserRoleDisabled == false))
|
||||
.WhereIf(inQuery.UserState != null, t => t.Status == inQuery.UserState)
|
||||
.WhereIf(inQuery.IsTestUser != null, t => t.IsTestUser == inQuery.IsTestUser)
|
||||
.WhereIf(inQuery.IsZhiZhun != null, t => t.IsZhiZhun == inQuery.IsZhiZhun)
|
||||
.WhereIf(inQuery.UserCeateSource != null, t => t.UserCeateSource == inQuery.UserCeateSource)
|
||||
.WhereIf(inQuery.AuditRecordId != null && inQuery.IsAuditRecordUserSelect == true, t => t.AuditRecordList.Any(t => t.AuditRecordId == inQuery.AuditRecordId))
|
||||
.WhereIf(inQuery.AuditRecordId != null && inQuery.IsAuditRecordUserSelect == false, t => !t.AuditRecordList.Any(t => t.AuditRecordId == inQuery.AuditRecordId))
|
||||
.ProjectTo<UserListDTO>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await userQueryable.ToPagedListAsync(inQuery);
|
||||
var pageList = await userQueryable.ToPagedListAsync(inQuery);
|
||||
|
||||
|
||||
if (inQuery.AuditRecordId != null)
|
||||
{
|
||||
var selectIdList = _auditRecordIdentityUserRepository.Where(t => t.AuditRecordId == inQuery.AuditRecordId).Select(t => t.IdentityUserId).ToList();
|
||||
|
||||
foreach (var item in selectIdList)
|
||||
{
|
||||
var find = pageList.CurrentPageData.Where(t => t.Id == item).FirstOrDefault();
|
||||
|
||||
if (find != null)
|
||||
{
|
||||
find.IsAuditRecordUserSelect = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pageList;
|
||||
|
||||
}
|
||||
|
||||
@@ -863,8 +885,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
.WhereIf(inQuery.OptTypeList != null && inQuery.OptTypeList.Count > 0, t => inQuery.OptTypeList.Contains(t.OptType))
|
||||
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
|
||||
.WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate)
|
||||
.WhereIf(inQuery.IsLoginUncommonly != null , t => t.IsLoginUncommonly== inQuery.IsLoginUncommonly)
|
||||
|
||||
.WhereIf(inQuery.IsLoginUncommonly != null, t => t.IsLoginUncommonly == inQuery.IsLoginUncommonly)
|
||||
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.ActionUserName.Contains(inQuery.LoginFaildName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!))
|
||||
@@ -922,7 +944,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
var password = loginDto.Password;
|
||||
|
||||
var emailConfig = _emailConfig.CurrentValue;
|
||||
var companyInfo = new SystemEmailSendConfigView() { CompanyName = emailConfig.CompanyName, CompanyNameCN = emailConfig.CompanyNameCN, CompanyShortName = emailConfig.CompanyShortName, CompanyShortNameCN = emailConfig.CompanyShortNameCN,SystemShortName=emailConfig.SystemShortName ,EmailRegexStr=emailConfig.EmailRegexStr};
|
||||
var companyInfo = new SystemEmailSendConfigView() { CompanyName = emailConfig.CompanyName, CompanyNameCN = emailConfig.CompanyNameCN, CompanyShortName = emailConfig.CompanyShortName, CompanyShortNameCN = emailConfig.CompanyShortNameCN, SystemShortName = emailConfig.SystemShortName, EmailRegexStr = emailConfig.EmailRegexStr };
|
||||
|
||||
|
||||
int maxFailures = _verifyConfig.CurrentValue.LoginMaxFailCount;
|
||||
@@ -991,7 +1013,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
//超过90天没修改密码
|
||||
|
||||
if (loginUser!= null&&_verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value)
|
||||
if (loginUser != null && _verifyConfig.CurrentValue.IsNeedChangePassWord && loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-_verifyConfig.CurrentValue.ChangePassWordDays) > loginUser.LastChangePassWordTime.Value)
|
||||
{
|
||||
loginUser.NeedChangePassWord = true;
|
||||
}
|
||||
@@ -1002,7 +1024,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
UserOptType.LoginLockedAccount
|
||||
};
|
||||
|
||||
var actionUserName= loginUser!= null ? loginUser.UserName : userName;
|
||||
var actionUserName = loginUser != null ? loginUser.UserName : userName;
|
||||
|
||||
var lastLoginIPRegion = await _userLogRepository.Where(t => t.ActionUserName == actionUserName && userOptTypes.Contains(t.OptType))
|
||||
.OrderByDescending(t => t.CreateTime).Select(t => t.IPRegion).FirstOrDefaultAsync();
|
||||
@@ -1022,7 +1044,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
//异地登录
|
||||
loginUser.LoginState = 2;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
}
|
||||
|
||||
public class ImageLabelNoneDicomStudyView : NoneDicomStudyView
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///<summary>NoneDicomStudyQuery 列表查询参数模型</summary>
|
||||
public class NoneDicomStudyQuery
|
||||
{
|
||||
@@ -55,6 +60,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string Modality { get; set; } = string.Empty;
|
||||
public DateTime ImageDate { get; set; }
|
||||
public string ModifyReason { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
}
|
||||
|
||||
///<summary> NoneDicomStudyAddOrEdit 列表查询参数模型</summary>
|
||||
@@ -81,6 +88,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public string VideoUrl { get; set; } = string.Empty;
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
||||
public string BodyPart { get; set; } = String.Empty;
|
||||
|
||||
public string ModifyReason { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +41,8 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
||||
|
||||
public string BodyPart { get; set; } = String.Empty;
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class QCQuestionAnswerCommand
|
||||
@@ -427,6 +431,8 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
||||
|
||||
public bool IsCompleteClinicalData { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class QASeriesInfoDto
|
||||
|
||||
@@ -518,7 +518,11 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public int? CheckWaitReplyCount { get; set; }
|
||||
|
||||
public string SuspendReason { get; set; }
|
||||
|
||||
public string Reason { get; set; }
|
||||
|
||||
public string ExportReason => Status == SubjectStatus.OutOfVisit ? Reason : (Status == SubjectStatus.EndOfVisit ? SuspendReason : "");
|
||||
}
|
||||
|
||||
|
||||
@@ -1242,6 +1246,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
//问题标识,肿瘤评估用于区分是什么问题
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
|
||||
public OptionType OptionTypeEnum { get; set; }
|
||||
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
public string QuestionName { get; set; }
|
||||
@@ -1407,6 +1413,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string TableName { get; set; }
|
||||
#endregion
|
||||
|
||||
public OptionType OptionTypeEnum { get; set; }
|
||||
|
||||
public Guid TableQuesionId { get; set; }
|
||||
|
||||
@@ -1795,7 +1802,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
[DictionaryTranslateAttribute("Subject_Visit_Status")]
|
||||
public SubjectStatus SubjectStatus { get; set; }
|
||||
public SubjectStatus SubjectStatus { get; set; }
|
||||
public string SubjectCode { get; set; } = String.Empty;
|
||||
|
||||
public String TrialSiteCode { get; set; } = String.Empty;
|
||||
|
||||
@@ -541,6 +541,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
|
||||
sv.CheckUserId = _userInfo.UserRoleId;
|
||||
sv.CheckState = CheckStateEnum.CVPassed;
|
||||
sv.CheckTime = DateTime.Now;
|
||||
|
||||
sv.ReadingStatus = ReadingStatusEnum.TaskAllocate;
|
||||
|
||||
@@ -1049,11 +1050,15 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
}
|
||||
else
|
||||
{
|
||||
if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted && !t.QCChallengeList.Any(c => c.ReuploadEnum == QCChanllengeReuploadEnum.QCAgreeUpload)))
|
||||
if (!_dicomStudyRepository.Where(t => t.Id == updateModalityCommand.Id).Any(t => t.CreateTime > t.SubjectVisit.SubmitTime))
|
||||
{
|
||||
//---提交之后,不允许修改!
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_NoModifyAfterSubmit"]);
|
||||
if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted && !t.QCChallengeList.Any(c => c.ReuploadEnum == QCChanllengeReuploadEnum.QCAgreeUpload)))
|
||||
{
|
||||
//---提交之后,不允许修改!
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_NoModifyAfterSubmit"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1066,6 +1071,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
|
||||
|
||||
study.BodyPartForEdit = updateModalityCommand.BodyPart;
|
||||
study.BodyPartForEditOther = updateModalityCommand.BodyPartForEditOther;
|
||||
|
||||
study.ModalityForEdit = updateModalityCommand.Modality;
|
||||
study.StudyName = updateModalityCommand.StudyName;
|
||||
@@ -1126,13 +1132,19 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
public async Task<IResponseOutput> DeleteStudyList(Guid[] ids, Guid subjectVisitId, Guid trialId)
|
||||
{
|
||||
|
||||
//提交了 但是IQC同意的时候 是可以删除的 | 普通提交后也不能删除
|
||||
if (await _subjectVisitRepository.AnyAsync(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.Submitted &&
|
||||
(!t.QCChallengeList.Any(u => u.ReuploadEnum == QCChanllengeReuploadEnum.QCAgreeUpload))))
|
||||
if (!_dicomStudyRepository.Where(t => ids.Contains(t.Id)).All(t => t.CreateTime > t.SubjectVisit.SubmitTime))
|
||||
{
|
||||
//---CRC已经提交,不允许删除。
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_CrcNoDelete"]);
|
||||
//提交了 但是IQC同意的时候 是可以删除的 | 普通提交后也不能删除
|
||||
if (await _subjectVisitRepository.AnyAsync(t => t.Id == subjectVisitId && t.SubmitState == SubmitStateEnum.Submitted &&
|
||||
(!t.QCChallengeList.Any(u => u.ReuploadEnum == QCChanllengeReuploadEnum.QCAgreeUpload))))
|
||||
{
|
||||
//---CRC已经提交,不允许删除。
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_CrcNoDelete"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var waitDeleteStudyList = await _dicomStudyRepository.Where(x => ids.Contains(x.Id), false, true).ToListAsync();
|
||||
|
||||
foreach (var item in waitDeleteStudyList)
|
||||
|
||||
@@ -245,6 +245,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.OrderBy(k => k.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(c => new CommonQuesionInfo()
|
||||
{
|
||||
OptionTypeEnum=c.ReadingQuestionTrial.OptionTypeEnum,
|
||||
QuestionType = c.ReadingQuestionTrial.QuestionType,
|
||||
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
|
||||
QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer,
|
||||
@@ -285,6 +286,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.Select(c => new CommonQuesionInfo()
|
||||
{
|
||||
QuestionType = c.ReadingQuestionTrial.QuestionType,
|
||||
OptionTypeEnum=c.ReadingQuestionTrial.OptionTypeEnum,
|
||||
QuestionId = c.ReadingQuestionTrial.Id,
|
||||
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
|
||||
QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer,
|
||||
@@ -303,9 +305,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(o => o.LessionAnswerList, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString()))));
|
||||
|
||||
CreateMap<ReadingTableQuestionAnswer, CommonLessionQuestionAnswerInfo>()
|
||||
//.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark))
|
||||
//.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType))
|
||||
.ForMember(o => o.ShowOrder, t => t.MapFrom(u => u.ReadingTableQuestionTrial.ShowOrder))
|
||||
//.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark))
|
||||
//.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType))
|
||||
.ForMember(o => o.OptionTypeEnum, t => t.MapFrom(u => u.ReadingTableQuestionTrial.OptionTypeEnum))
|
||||
.ForMember(o => o.ShowOrder, t => t.MapFrom(u => u.ReadingTableQuestionTrial.ShowOrder))
|
||||
.ForMember(o => o.CustomUnit, t => t.MapFrom(u => u.ReadingTableQuestionTrial.CustomUnit))
|
||||
.ForMember(o => o.Unit, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Unit))
|
||||
.ForMember(o => o.TableQuesionId, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Id))
|
||||
@@ -755,6 +758,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
.OrderBy(t => t.CreateTime).ThenBy(t => t.FileName)))
|
||||
.ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode));
|
||||
|
||||
CreateMap<NoneDicomStudy, ImageLabelNoneDicomStudyView>()
|
||||
.ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s =>
|
||||
s.ImageLabelNoneDicomFileList.Where(t => isFilterZip ? !t.FileType.Contains(StaticData.FileType.Zip) : true)
|
||||
.Where(t => isReading ? t.IsReading && t.IsDeleted == false : true)
|
||||
.OrderBy(t => t.CreateTime).ThenBy(t => t.FileName)))
|
||||
.ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode));
|
||||
|
||||
|
||||
CreateMap<SubjectVisitImageBackRecord, ImageBackViewModel>()
|
||||
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.SubjectVisit.Subject.Code))
|
||||
|
||||
@@ -264,6 +264,35 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public int ThirdData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巨噬细胞浸润测量
|
||||
/// </summary>
|
||||
public string MacrophageInfiltrationMeasurement { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 巨噬细胞浸润角度测量
|
||||
/// </summary>
|
||||
public string MacrophageInfiltrationAngle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微通道测量
|
||||
/// </summary>
|
||||
public string MicrochannelMeasurement { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 胆固醇结晶测量
|
||||
/// </summary>
|
||||
public string CholesterolCrystalMeasurement { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 官腔面积测量
|
||||
/// </summary>
|
||||
public string LumenAreaMeasurement { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public decimal Avg { get {
|
||||
|
||||
return ( FirstData*1m + SecondData * 1m + ThirdData * 1m) / 3;
|
||||
@@ -282,6 +311,27 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// 值
|
||||
/// </summary>
|
||||
public decimal Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巨噬细胞浸润测量
|
||||
/// </summary>
|
||||
public string MacrophageInfiltrationMeasurement { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 巨噬细胞浸润角度测量
|
||||
/// </summary>
|
||||
public decimal? MacrophageInfiltrationAngle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微通道测量
|
||||
/// </summary>
|
||||
public string MicrochannelMeasurement { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 胆固醇结晶测量
|
||||
/// </summary>
|
||||
public string CholesterolCrystalMeasurement { get; set; }
|
||||
}
|
||||
|
||||
public class FileToDataTableDto
|
||||
|
||||
@@ -83,6 +83,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public string QuestionEnName { get; set; }
|
||||
|
||||
public bool IsCanEditPosition { get; set; } = false;
|
||||
|
||||
public string BlindName { get; set; }
|
||||
@@ -136,6 +138,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public string? ReportMark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
/// <summary>
|
||||
/// 高亮问题的答案
|
||||
/// </summary>
|
||||
@@ -192,6 +204,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
}
|
||||
|
||||
public class Globalanswer
|
||||
{
|
||||
public Guid TaskId { get; set; }
|
||||
|
||||
public string Answer { get; set; }
|
||||
|
||||
public decimal VisitTaskNum { get; set; }
|
||||
|
||||
public Guid? QuestionId { get; set; }
|
||||
}
|
||||
|
||||
public class LesionDto
|
||||
{
|
||||
@@ -446,6 +468,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
}
|
||||
|
||||
public class ViewStudyPartInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteSingleTableQuestionMarkInDto
|
||||
{
|
||||
[NotDefault]
|
||||
@@ -522,6 +549,42 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public new decimal? RowIndex { get; set; }
|
||||
}
|
||||
|
||||
public class GetReportsChartDataOutDto
|
||||
{
|
||||
public List<string> VisitTaskNameList { get; set; }
|
||||
|
||||
public List<DateTime?> LatestScanDateList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public ValueUnit? Unit { get; set; }
|
||||
|
||||
public List<ReportChartData> ChartDataList { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ReportChartData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public List<string> Value { get; set; }
|
||||
}
|
||||
|
||||
public class GetReportsChartDataInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? QuestionId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
public decimal? RowIndex { get; set; }
|
||||
|
||||
public ReportChartType? ReportChartTypeEnum { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class GetPreviousOtherPicturePathInDto
|
||||
@@ -855,12 +918,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public string? PicturePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 第一次添加的任务ID
|
||||
/// </summary>
|
||||
public decimal FristAddTaskNum { get; set; } = 0;
|
||||
|
||||
|
||||
public SplitOrMergeType? SplitOrMergeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -1006,6 +1063,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public int? PageShowOrder { get; set; }
|
||||
|
||||
public bool IsPreinstall { get {
|
||||
return this.TableQuestions.Questions.Any(x => x.IsPreinstall);
|
||||
} }
|
||||
|
||||
|
||||
|
||||
public List<TrialReadQuestionData> Childrens { get; set; }
|
||||
@@ -1033,6 +1094,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public string MergeName { get; set; }
|
||||
|
||||
public decimal FristAddTaskNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 病灶类型
|
||||
/// </summary>
|
||||
@@ -1867,6 +1930,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public int? DigitPlaces { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看检查部位
|
||||
/// </summary>
|
||||
public bool IsViewStudyPart { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标准类型
|
||||
@@ -2350,8 +2418,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public bool? IsCanEditPosition { get; set; }
|
||||
|
||||
public decimal FristAddTaskNum { get; set; } = 0;
|
||||
|
||||
public decimal? WW { get; set; }
|
||||
|
||||
public decimal? WL { get; set; }
|
||||
|
||||
@@ -324,6 +324,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public ImageMark? ImageMarkEnum { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否预设
|
||||
/// </summary>
|
||||
public bool IsPreinstall { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 影像工具
|
||||
/// </summary>
|
||||
@@ -425,6 +431,17 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// 数据来源
|
||||
/// </summary>
|
||||
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
|
||||
@@ -513,6 +530,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public ValueOfType? ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否预设
|
||||
/// </summary>
|
||||
public bool IsPreinstall { get; set; } = false;
|
||||
|
||||
public bool IsCopy { get; set; } = false;
|
||||
|
||||
|
||||
@@ -550,6 +572,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
@@ -1234,6 +1266,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
/// <summary>
|
||||
/// 问题英文名称
|
||||
/// </summary>
|
||||
@@ -1345,6 +1387,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
@@ -1692,6 +1744,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
@@ -1809,6 +1862,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
[Comment("数据来源")]
|
||||
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
[Comment("限制编辑")]
|
||||
public LimitEdit LimitEdit { get; set; } = LimitEdit.None;
|
||||
|
||||
@@ -2215,6 +2278,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
@@ -2627,6 +2700,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
|
||||
@@ -12,6 +12,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public string TaskBlindName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看检查部位
|
||||
/// </summary>
|
||||
public bool IsViewStudyPart { get; set; } = false;
|
||||
|
||||
//任务来源访视Id 方便回更访视读片状态
|
||||
public Guid? SourceSubjectVisitId { get; set; }
|
||||
public Guid? SouceReadModuleId { get; set; }
|
||||
|
||||
@@ -847,7 +847,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增修改想想项目表格问题
|
||||
/// 新增修改项目表格问题
|
||||
/// </summary>
|
||||
/// <param name="indto"></param>
|
||||
/// <returns></returns>
|
||||
@@ -861,6 +861,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
//---问题编号重复
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingQuestion_IdDup"]);
|
||||
}
|
||||
if (indto.IsPreinstall)
|
||||
{
|
||||
if (await _readingTableQuestionTrialRepository.AnyAsync(x => x.ReadingQuestionId == indto.ReadingQuestionId && x.Id != indto.Id && x.IsPreinstall))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingQuestion_OnlyOnePreinstall"]);
|
||||
}
|
||||
}
|
||||
|
||||
indto.ParentTriggerValue = string.Join(',', indto.ParentTriggerValueList);
|
||||
indto.RelevanceValue = string.Join(',', indto.RelevanceValueList);
|
||||
|
||||
+36
-4
@@ -22,6 +22,7 @@ using Newtonsoft.Json.Serialization;
|
||||
using NPOI.POIFS.Properties;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using System.Linq;
|
||||
using ZiggyCreatures.Caching.Fusion;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
@@ -34,6 +35,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TaskInstance> _taskInstanceRepository,
|
||||
IRepository<NoneDicomStudyFile> _noneDicomStudyFileRepository,
|
||||
IRepository<ReadingNoneDicomMark> _readingNoneDicomMarkRepository,
|
||||
IRepository<UserLog> _userLogRepository,
|
||||
@@ -76,6 +78,16 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告图表数据
|
||||
/// </summary>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<GetReportsChartDataOutDto> GetReportsChartData(GetReportsChartDataInDto inDto)
|
||||
{
|
||||
return await _readingCalculateService.GetReportsChartData(inDto);
|
||||
}
|
||||
|
||||
#region 计算
|
||||
|
||||
@@ -92,6 +104,22 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 查看检查部位
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<bool> ViewStudyPart(ViewStudyPartInDto inDto)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
IsViewStudyPart = true,
|
||||
});
|
||||
return await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除单个表格问题标记
|
||||
@@ -2601,7 +2629,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
await VerifyTaskIsSign(inDto.VisitTaskId);
|
||||
if (inDto.InstanceId != null && inDto.IsDicomReading)
|
||||
{
|
||||
if (!(await _dicomInstanceRepository.AnyAsync(x => x.Id == inDto.InstanceId && x.SeriesId == inDto.SeriesId)))
|
||||
if ((!(await _dicomInstanceRepository.AnyAsync(x => x.Id == inDto.InstanceId && x.SeriesId == inDto.SeriesId))) && (!(await _taskInstanceRepository.AnyAsync(x => x.Id == inDto.InstanceId && x.SeriesId == inDto.SeriesId))))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_Idnotcorrespond"]);
|
||||
}
|
||||
@@ -3131,10 +3159,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
.WhereIf(taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyBaseLine)))
|
||||
.WhereIf(!taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyVisit)))
|
||||
.WhereIf(taskInfo.TrialReadingCriterion.CriterionType == CriterionType.PCWG3, x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation)
|
||||
|
||||
//.WhereIf(!criterion.IseCRFShowInDicomReading,x=>x.IsShowInDicom)
|
||||
.ToListAsync();
|
||||
|
||||
// 排除访视
|
||||
readingQuestionList = readingQuestionList.Where(x => !(x.LimitShow == LimitShow.ExcludeSomeVisits && x.ExcludeShowVisitList.Contains(taskInfo.VisitTaskNum))).ToList();
|
||||
|
||||
var answerQuestionIds = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.Answer != string.Empty).Select(x => x.ReadingQuestionTrialId).ToListAsync();
|
||||
|
||||
readingQuestionList = readingQuestionList.Where(x => !answerQuestionIds.Contains(x.Id)).ToList();
|
||||
@@ -3176,7 +3205,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var isBaseline = await _subjectVisitRepository.Where(x => x.Id == taskInfo.SourceSubjectVisitId).Select(x => x.IsBaseLine).FirstOrDefaultAsync();
|
||||
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.Type != "group"
|
||||
|
||||
|
||||
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => !x.ExcludeShowVisitList.Contains(taskInfo.VisitTaskNum) &&x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.Type != "group"
|
||||
&& (x.IsJudgeQuestion || (x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show))
|
||||
).ToListAsync();
|
||||
if (isBaseline)
|
||||
@@ -3620,6 +3651,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
task.ReadingVersionEnum = criterionInfo.ReadingVersionEnum;
|
||||
task.ReadingToolList = criterionInfo.ReadingToolList;
|
||||
task.IsExistUnprocessedFeedback = await _userFeedBackRepository.AnyAsync(x => x.VisitTaskId == task.VisitTaskId && x.State == 0);
|
||||
task.IsViewStudyPart= visitTaskInfo.IsViewStudyPart;
|
||||
// 添加默认答案
|
||||
if (inDto.VisitTaskId == null && visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
{
|
||||
|
||||
@@ -924,7 +924,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
var noteEqual = false;
|
||||
foreach (var item in groupTasks)
|
||||
{
|
||||
if (item.TaskAnswerList.Count() != 2)
|
||||
// 裁判问题可以不必填
|
||||
if(item.TaskAnswerList.Count()==0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (item.TaskAnswerList.Count() != 2)
|
||||
{
|
||||
noteEqual = true;
|
||||
break;
|
||||
@@ -1013,14 +1018,14 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
else
|
||||
{
|
||||
var absoluteValue = (Math.Abs(value1 - value2)*100)/(value1<value2?value1:value2) ;
|
||||
var absoluteValue = (Math.Abs(value1 - value2) * 100) / (value1 < value2 ? value1 : value2);
|
||||
if (item.JudgeDifferenceType == JudgeDifferenceType.Greater)
|
||||
{
|
||||
noteEqual= absoluteValue > item.JudgeDifferenceValue;
|
||||
noteEqual = absoluteValue > item.JudgeDifferenceValue;
|
||||
}
|
||||
else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual)
|
||||
{
|
||||
noteEqual= absoluteValue >= item.JudgeDifferenceValue;
|
||||
noteEqual = absoluteValue >= item.JudgeDifferenceValue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -15,6 +15,16 @@ namespace IRaCIS.Core.Application.Service
|
||||
//是否英文环境
|
||||
var isEn_Us = false;
|
||||
|
||||
CreateMap<ReadingQuestionTrial, ReadingReportDto>()
|
||||
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingReportDto>()
|
||||
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.ReadingQuestionId))
|
||||
.ForMember(d => d.TableQuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
|
||||
|
||||
|
||||
//标准Id
|
||||
List<Guid> CriterionIds = new List<Guid>();
|
||||
|
||||
@@ -280,6 +290,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.ReadingQuestionSystemId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableAnswerRowInfo, TableAnsweRowInfo>()
|
||||
.ForMember(d => d.FristAddTaskNum, u => u.MapFrom(s => s.FristAddTask.VisitTaskNum))
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.MergeName, u => u.MapFrom(s => s.MergeRow == null ? string.Empty : s.MergeRow.ReadingQuestionTrial.OrderMark + s.MergeRow.RowIndex.GetLesionMark()))
|
||||
.ForMember(d => d.SplitName, u => u.MapFrom(s => s.SplitRow == null ? string.Empty : s.SplitRow.ReadingQuestionTrial.OrderMark + s.SplitRow.RowIndex.GetLesionMark()))
|
||||
|
||||
+182
-3
@@ -4,6 +4,7 @@ using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
using MassTransit.Saga;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MiniExcelLibs;
|
||||
@@ -27,7 +28,185 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IOSSService oSSService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IGeneralCalculateService
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构造阅片报告问题
|
||||
/// </summary>
|
||||
/// <param name="questionList"></param>
|
||||
/// <param name="taskInfoList"></param>
|
||||
/// <param name="globalanswerList"></param>
|
||||
/// <param name="answers"></param>
|
||||
/// <param name="tableAnsweRowInfos"></param>
|
||||
/// <param name="tableQuestionList"></param>
|
||||
/// <param name="alltableAnsweRowInfos"></param>
|
||||
/// <param name="tableAnswers"></param>
|
||||
/// <param name="organInfos"></param>
|
||||
/// <param name="needChangeType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ReadingReportDto>> GetReadingReportQuestion(
|
||||
List<ReadingQuestionTrial>? questionList,
|
||||
List<VisitTaskInfo> taskInfoList,
|
||||
List<Globalanswer>? globalanswerList,
|
||||
List<ReadingTaskQuestionAnswer>? answers,
|
||||
List<TableAnsweRowInfo>? tableAnsweRowInfos,
|
||||
List<ReadingTableQuestionTrial> tableQuestionList,
|
||||
List<ReadingTableAnswerRowInfo> alltableAnsweRowInfos,
|
||||
List<ReadingTableQuestionAnswer> tableAnswers,
|
||||
List<OrganInfo> organInfos,
|
||||
List<QuestionMark?> needChangeType
|
||||
)
|
||||
{
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = _mapper.Map<List<ReadingReportDto>>(questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder));
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.QuestionName = item.QuestionName.LanguageName(item.QuestionEnName, _userInfo.IsEn_Us);
|
||||
item.ReportLayType = ReportLayType.Group;
|
||||
|
||||
item.Childrens = _mapper.Map<List<ReadingReportDto>>(questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder));
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
question.QuestionName = question.QuestionName.LanguageName(question.QuestionEnName, _userInfo.IsEn_Us);
|
||||
question.ReportLayType = ReportLayType.Question;
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = _mapper.Map<List<ReadingReportDto>>(tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId));
|
||||
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
tableQuestion.QuestionName = tableQuestion.QuestionName.LanguageName(tableQuestion.QuestionEnName, _userInfo.IsEn_Us);
|
||||
tableQuestion.LesionType = question.LesionType;
|
||||
tableQuestion.RowId = row.RowId;
|
||||
tableQuestion.IsShowInDicom = question.IsShowInDicom;
|
||||
tableQuestion.RowIndex = row.RowIndex;
|
||||
tableQuestion.ReportLayType = ReportLayType.TableQuestion;
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
;
|
||||
}
|
||||
#endregion
|
||||
|
||||
return questions;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -179,7 +358,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == visitTask.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).ToListAsync();
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x=>x.FristAddTask).ToListAsync();
|
||||
|
||||
var baseLinetaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == baseLineVisitId && x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId
|
||||
@@ -228,7 +407,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
RowIndex = x.RowIndex,
|
||||
MeasureData = x.MeasureData,
|
||||
OtherMeasureData = x.OtherMeasureData,
|
||||
FristAddTaskNum = x.FristAddTaskNum,
|
||||
FristAddTaskNum = x.FristAddTask.VisitTaskNum,
|
||||
TableQuestionList = tableQuestion.Where(y => y.QuestionId == item.QuestionId && y.RowId == x.Id).ToList(),
|
||||
|
||||
}).ToList();
|
||||
|
||||
@@ -3,6 +3,7 @@ using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -42,7 +43,173 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{CriterionType.mRECISTHCC,typeof(MRECISTHCCCalculateService) },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告图表数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<GetReportsChartDataOutDto> GetReportsChartData(GetReportsChartDataInDto inDto)
|
||||
{
|
||||
var criterionId = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterionId).Select(x => x.CriterionType).FirstOrDefaultAsync();
|
||||
|
||||
var data = await GetReadingReportEvaluation(new GetReadingReportEvaluationInDto()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
});
|
||||
|
||||
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto()
|
||||
{
|
||||
VisitTaskNameList = data.VisitTaskList.Select(x => x.BlindName).ToList(),
|
||||
LatestScanDateList = data.VisitTaskList.Select(x => x.LatestScanDate).ToList(),
|
||||
ChartDataList = new List<ReportChartData>() { },
|
||||
};
|
||||
|
||||
|
||||
result.VisitTaskNameList = data.VisitTaskList.Select(x => x.BlindName).ToList();
|
||||
|
||||
if (inDto.ReportChartTypeEnum != null)
|
||||
{
|
||||
switch (inDto.ReportChartTypeEnum)
|
||||
{
|
||||
case ReportChartType.Target:
|
||||
{
|
||||
// 这是病灶
|
||||
var target = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.Childrens)
|
||||
.ToList();
|
||||
|
||||
|
||||
foreach (var item in target)
|
||||
{
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = item.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
|
||||
for (var i = 0; i < result.VisitTaskNameList.Count; i++)
|
||||
{
|
||||
|
||||
switch (criterionType)
|
||||
{
|
||||
case CriterionType.RECIST1Point1:
|
||||
case CriterionType.RECIST1Pointt1_MB:
|
||||
case CriterionType.mRECISTHCC:
|
||||
case CriterionType.IRECIST1Point1:
|
||||
// 淋巴结的短径
|
||||
if (item.Childrens.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer[i].Answer.EqEnum(ReadingYesOrNo.Yes)))
|
||||
{
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Unit).FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Unit).FirstOrDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case CriterionType.Lugano2014:
|
||||
case CriterionType.Lugano2014WithoutPET:
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.PPD).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.PPD).Select(x => x.Unit).FirstOrDefault();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case ReportChartType.BaseLineTarget:
|
||||
// 这是病灶
|
||||
var baseTarget = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.LesionType == LesionType.BaselineLesions).SelectMany(x => x.Childrens)
|
||||
.ToList();
|
||||
|
||||
foreach (var item in baseTarget)
|
||||
{
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = item.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
|
||||
for (var i = 0; i < result.VisitTaskNameList.Count; i++)
|
||||
{
|
||||
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.LesionNumber).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.LesionNumber).Select(x => x.Unit).FirstOrDefault();
|
||||
|
||||
|
||||
}
|
||||
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (inDto.QuestionId != null)
|
||||
{
|
||||
var question = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.QuestionId == inDto.QuestionId.Value).FirstOrDefault();
|
||||
if (question != null)
|
||||
{
|
||||
result.Unit = question.Unit;
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = question.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
foreach (var answer in question.Answer)
|
||||
{
|
||||
chartData.Value.Add(answer.Answer);
|
||||
}
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var lesion = data.TaskQuestions
|
||||
// 问题 靶病灶
|
||||
.SelectMany(x => x.Childrens)
|
||||
// 病灶
|
||||
.SelectMany(x => x.Childrens).Where(x => x.RowIndex == inDto.RowIndex)
|
||||
// 表格问题
|
||||
.SelectMany(x => x.Childrens).Where(x => x.TableQuestionId == inDto.TableQuestionId)
|
||||
|
||||
.FirstOrDefault();
|
||||
|
||||
if (lesion != null)
|
||||
{
|
||||
result.Unit = lesion.Unit;
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = lesion.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
foreach (var answer in lesion.Answer)
|
||||
{
|
||||
chartData.Value.Add(answer.Answer);
|
||||
}
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 阅片导入
|
||||
|
||||
+18
-216
@@ -146,12 +146,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId= x.TaskId,
|
||||
VisitTaskNum= x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId= x.QuestionId,
|
||||
Answer= x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -165,217 +165,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -166,12 +166,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -185,217 +185,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -702,7 +504,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = questionInfo.OrderMark,
|
||||
FristAddTaskNum = taskinfo.VisitTaskNum,
|
||||
FristAddTaskId = taskinfo.Id,
|
||||
RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
|
||||
});
|
||||
@@ -842,7 +643,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = inDto.BlindName,
|
||||
OrderMark = questionInfo.OrderMark,
|
||||
FristAddTaskNum = inDto.VisitTaskNum,
|
||||
FristAddTaskId = inDto.VisitTaskId,
|
||||
RowMark = questionInfo.OrderMark + decimal.Parse(item.ToString()).GetLesionMark()
|
||||
});
|
||||
@@ -903,7 +703,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = inDto.BlindName,
|
||||
OrderMark = pAVquestionInfo.OrderMark,
|
||||
FristAddTaskNum = inDto.VisitTaskNum,
|
||||
FristAddTaskId = inDto.VisitTaskId,
|
||||
RowMark = pAVquestionInfo.OrderMark + decimal.Parse(item.ToString()).GetLesionMark()
|
||||
});
|
||||
|
||||
+13
@@ -8,6 +8,19 @@ namespace IRaCIS.Core.Application.Service
|
||||
public interface IGeneralCalculateService
|
||||
{
|
||||
|
||||
Task<List<ReadingReportDto>> GetReadingReportQuestion(
|
||||
List<ReadingQuestionTrial>? questionList,
|
||||
List<VisitTaskInfo> taskInfoList,
|
||||
List<Globalanswer>? globalanswerList,
|
||||
List<ReadingTaskQuestionAnswer>? answers,
|
||||
List<TableAnsweRowInfo>? tableAnsweRowInfos,
|
||||
List<ReadingTableQuestionTrial> tableQuestionList,
|
||||
List<ReadingTableAnswerRowInfo> alltableAnsweRowInfos,
|
||||
List<ReadingTableQuestionAnswer> tableAnswers,
|
||||
List<OrganInfo> organInfos,
|
||||
List<QuestionMark?> needChangeType
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// 获取ReadingCalculateDto
|
||||
/// </summary>
|
||||
|
||||
+6
-1
@@ -14,8 +14,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <returns></returns>
|
||||
Task CalculateTask(CalculateTaskInDto inDto);
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告图表数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetReportsChartDataOutDto> GetReportsChartData(GetReportsChartDataInDto inDto);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 验证访视提交
|
||||
|
||||
@@ -133,12 +133,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
@@ -153,207 +153,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
+18
-206
@@ -134,12 +134,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
@@ -154,207 +154,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -106,12 +106,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}).ToList();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -125,207 +125,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -867,30 +679,59 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
TrialId = x.TrialId,
|
||||
}).ToListAsync();
|
||||
|
||||
foreach (var item in recistTableAnswers)
|
||||
{
|
||||
|
||||
// 肛门淋巴结
|
||||
var portalOrgan = await _organInfoRepository.Where(x => x.SystemCriterionId == trialReadingCriterion.ReadingQuestionCriterionSystemId &&
|
||||
|
||||
x.Part == "肝门淋巴结" &&
|
||||
|
||||
item.QuestionId = tableRowAnswers.Where(y => y.OriginalId == item.RowId).Select(x => x.QuestionId).FirstOrDefault();
|
||||
item.TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == item.QuestionId && x.QuestionMark == item.QuestionMark).Select(x => x.Id).FirstOrDefault();
|
||||
}
|
||||
x.IsLymphNodes == IsLymph.Yes
|
||||
).FirstOrDefaultAsync();
|
||||
|
||||
foreach (var item in recistTableAnswers)
|
||||
{
|
||||
var rowinfo = tableRowAnswers.Where(y => y.OriginalId == item.RowId).FirstOrDefault();
|
||||
if (rowinfo != null)
|
||||
{
|
||||
item.QuestionId = rowinfo.QuestionId;
|
||||
|
||||
|
||||
if (portalOrgan != null && rowinfo.OrganInfoId == portalOrgan.Id)
|
||||
{
|
||||
var IslymphNode = recistTableAnswers.Where(x => x.RowId == item.RowId && x.QuestionMark == QuestionMark.IsLymph).Select(x => x.Answer).FirstIsNullReturnEmpty().EqEnum(YesOrNoOrNa.Yes);
|
||||
var minorAxis = recistTableAnswers.Where(x => x.RowId == item.RowId && x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturn0();
|
||||
|
||||
var iSbetween15and20 = minorAxis >= 15 && minorAxis < 20;
|
||||
if (item.QuestionMark == QuestionMark.State && IslymphNode && iSbetween15and20 && rowinfo.LesionType == LesionType.TargetLesion)
|
||||
{
|
||||
item.Answer = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
item.TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == item.QuestionId && x.QuestionMark == item.QuestionMark).Select(x => x.Id).FirstOrDefault();
|
||||
}
|
||||
|
||||
recistTableAnswers = recistTableAnswers.Where(x => x.TableQuestionId != default(Guid)).ToList();
|
||||
|
||||
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
|
||||
{
|
||||
|
||||
};
|
||||
var tableAnswers = recistTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
|
||||
QuestionId = x.QuestionId,
|
||||
RowIndex = x.RowIndex,
|
||||
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
|
||||
TableQuestionId = x.TableQuestionId,
|
||||
TrialId = x.TrialId,
|
||||
VisitTaskId = visitTaskId,
|
||||
}).ToList();
|
||||
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
var tableAnswers = recistTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
|
||||
QuestionId = x.QuestionId,
|
||||
RowIndex = x.RowIndex,
|
||||
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
|
||||
TableQuestionId = x.TableQuestionId,
|
||||
TrialId = x.TrialId,
|
||||
VisitTaskId = visitTaskId,
|
||||
}).ToList();
|
||||
|
||||
// 添加 典型肝内病灶 默认值
|
||||
tableRowAnswers.ForEach(x =>
|
||||
|
||||
@@ -108,12 +108,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -127,227 +127,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionType = x.QuestionType,
|
||||
DataSource = x.DataSource,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
DataSource = x.DataSource,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
GroupEnName = x.GroupEnName,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
RowId = row.RowId,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -414,7 +206,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
rowlist.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
FristAddTaskId = visitTaskId,
|
||||
FristAddTaskNum = taskinfo.VisitTaskNum,
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = tableQuestion.OrderMark,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
@@ -160,12 +161,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -177,219 +178,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
QuestionMark.Part,
|
||||
};
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -526,6 +327,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
FirstData = int.Parse(dataTable.Rows[i]["B"].ToString()),
|
||||
SecondData = int.Parse(dataTable.Rows[i]["C"].ToString()),
|
||||
ThirdData = int.Parse(dataTable.Rows[i]["D"].ToString()),
|
||||
MacrophageInfiltrationMeasurement= dataTable.Rows[i]["E"].ToString()??string.Empty,
|
||||
MacrophageInfiltrationAngle = dataTable.Rows[i]["F"].ToString() ?? string.Empty,
|
||||
MicrochannelMeasurement = dataTable.Rows[i]["G"].ToString() ?? string.Empty,
|
||||
CholesterolCrystalMeasurement = dataTable.Rows[i]["H"].ToString() ?? string.Empty,
|
||||
LumenAreaMeasurement = dataTable.Rows[i]["I"].ToString() ?? string.Empty,
|
||||
});
|
||||
}
|
||||
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
|
||||
@@ -535,6 +341,36 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
|
||||
Dictionary<string, string> isPresent = new Dictionary<string, string>()
|
||||
{
|
||||
{ "有","1"},
|
||||
{ "无","0"},
|
||||
{ "Existence","1"},
|
||||
{ "Non-existence","0"},
|
||||
{ string.Empty,string.Empty},
|
||||
};
|
||||
|
||||
foreach (var item in measuredValueList)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isPresent[item.MacrophageInfiltrationMeasurement] == "1"&& item.MacrophageInfiltrationAngle==string.Empty)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
|
||||
if ((isPresent[item.MacrophageInfiltrationMeasurement] == "0"|| isPresent[item.MacrophageInfiltrationMeasurement]==string.Empty) && item.MacrophageInfiltrationAngle != string.Empty)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
}
|
||||
|
||||
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FCT).FirstNotNullAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
|
||||
List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
|
||||
@@ -542,6 +378,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var maxnum = 0;
|
||||
|
||||
|
||||
|
||||
foreach (var item in measuredValueList)
|
||||
{
|
||||
@@ -558,7 +395,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = questionInfo.OrderMark,
|
||||
FristAddTaskNum = taskinfo.VisitTaskNum,
|
||||
FristAddTaskId = taskinfo.Id,
|
||||
RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
|
||||
});
|
||||
@@ -630,6 +466,75 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.AvgFCT).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
// 新加的5个问题
|
||||
// 巨噬细胞浸润测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = isPresent[item.MacrophageInfiltrationMeasurement.ToString()],
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.MacrophageInfiltrationMeasurement).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 巨噬细胞浸润角度测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.MacrophageInfiltrationAngle.ToString(),
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.MacrophageInfiltrationAngle).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 微通道测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = isPresent[item.MicrochannelMeasurement.ToString()],
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.MicrochannelMeasurement).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 胆固醇结晶测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = isPresent[item.CholesterolCrystalMeasurement.ToString()],
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.CholesterolCrystalMeasurement).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 官腔面积测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = item.LumenAreaMeasurement.ToString(),
|
||||
QuestionId = questionInfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = maxnum,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LumenAreaMeasurement).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
|
||||
}
|
||||
|
||||
|
||||
// 添加其他问题答案
|
||||
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswers.Any(y => y.TableQuestionId == x.Id && y.RowId == newRowId)))
|
||||
@@ -769,7 +674,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = questionInfo.OrderMark,
|
||||
FristAddTaskNum = taskinfo.VisitTaskNum,
|
||||
FristAddTaskId = taskinfo.Id,
|
||||
RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
|
||||
});
|
||||
@@ -985,6 +889,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
PlaqueNum = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => int.Parse(x.Answer)).FirstOrDefault(),
|
||||
Data = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => decimal.Parse(x.Answer)).FirstOrDefault(),
|
||||
MacrophageInfiltrationMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltrationMeasurement).Select(x => x.Answer).FirstOrDefault()??string.Empty,
|
||||
MacrophageInfiltrationAngle = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltrationAngle).Select(x => x.Answer.IsNullOrEmptyReturnNull()).FirstOrDefault(),
|
||||
MicrochannelMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MicrochannelMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||
CholesterolCrystalMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.CholesterolCrystalMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1043,7 +951,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = inDto.BlindName,
|
||||
OrderMark = patchDataStatisticsInfo.OrderMark,
|
||||
FristAddTaskNum = inDto.VisitTaskNum,
|
||||
FristAddTaskId = inDto.VisitTaskId,
|
||||
RowMark = patchDataStatisticsInfo.OrderMark + decimal.Parse(item.ToString()).GetLesionMark()
|
||||
});
|
||||
@@ -1090,6 +997,66 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.AvgMinFCT).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 巨噬细胞浸润测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = oCTFCTInfos.Any(x => x.PlaqueNum == item && x.MacrophageInfiltrationMeasurement != string.Empty) ?
|
||||
oCTFCTInfos.Any(x => x.PlaqueNum == item&&x.MacrophageInfiltrationMeasurement.EqEnum(IsPresent.Existence))? IsPresent.Existence.GetEnumInt(): IsPresent.NonExistence.GetEnumInt()
|
||||
:string.Empty,
|
||||
Id = NewId.NextGuid(),
|
||||
QuestionId = patchDataStatisticsInfo.Id,
|
||||
TrialId = inDto.TrialId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
RowId = newRowId,
|
||||
RowIndex = item,
|
||||
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltration).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 巨噬细胞浸润角度测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = oCTFCTInfos.Where(x => x.PlaqueNum == item&&x.MacrophageInfiltrationAngle!=null).Count() == 0 ? string.Empty : oCTFCTInfos.Where(x => x.PlaqueNum == item).Max(x=>x.MacrophageInfiltrationAngle??0).ToString(),
|
||||
Id = NewId.NextGuid(),
|
||||
QuestionId = patchDataStatisticsInfo.Id,
|
||||
TrialId = inDto.TrialId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
RowId = newRowId,
|
||||
RowIndex = item,
|
||||
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.MacrophageExtensionAngle).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 微通道
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = oCTFCTInfos.Any(x => x.PlaqueNum == item && x.MicrochannelMeasurement != string.Empty) ?
|
||||
oCTFCTInfos.Any(x => x.PlaqueNum == item && x.MicrochannelMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt()
|
||||
:string.Empty,
|
||||
Id = NewId.NextGuid(),
|
||||
QuestionId = patchDataStatisticsInfo.Id,
|
||||
TrialId = inDto.TrialId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
RowId = newRowId,
|
||||
RowIndex = item,
|
||||
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.Microchannels).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 胆固醇结晶测量
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = oCTFCTInfos.Any(x => x.PlaqueNum == item && x.CholesterolCrystalMeasurement != string.Empty) ?
|
||||
oCTFCTInfos.Any(x => x.PlaqueNum == item && x.CholesterolCrystalMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt()
|
||||
:string.Empty,
|
||||
Id = NewId.NextGuid(),
|
||||
QuestionId = patchDataStatisticsInfo.Id,
|
||||
TrialId = inDto.TrialId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
RowId = newRowId,
|
||||
RowIndex = item,
|
||||
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.CholesterolCrystallization).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 脂质角度平均值
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
@@ -1116,7 +1083,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
TableQuestionId = patchDataTableQuestion.Where(x => x.QuestionMark == QuestionMark.MaxAvgLipidAngle).Select(x => x.Id).FirstOrDefault(),
|
||||
});
|
||||
|
||||
// 待定指标
|
||||
// 斑块类型
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = string.Empty,
|
||||
|
||||
@@ -136,6 +136,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
ShowChartTypeEnum=x.ShowChartTypeEnum,
|
||||
OptionTypeEnum= x.OptionTypeEnum,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
@@ -163,6 +165,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionId = x.Id,
|
||||
ShowChartTypeEnum = x.ShowChartTypeEnum,
|
||||
OptionTypeEnum = x.OptionTypeEnum,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
@@ -230,7 +234,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
|
||||
ShowChartTypeEnum = x.ShowChartTypeEnum,
|
||||
OptionTypeEnum = x.OptionTypeEnum,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
|
||||
+22
-206
@@ -1,10 +1,13 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -104,12 +107,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}).ToList();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -123,207 +126,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
+18
-206
@@ -100,12 +100,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -119,207 +119,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
@@ -101,12 +102,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
@@ -120,227 +121,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionType = x.QuestionType,
|
||||
DataSource = x.DataSource,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
DataSource = x.DataSource,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
GroupEnName = x.GroupEnName,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
RowId = row.RowId,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -366,6 +159,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var isReadingTaskViewInOrder = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync();
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
List<ReadingTableAnswerRowInfo> addRowList = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> addTableQuestionAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||
// 判断当前任务是否是基线
|
||||
if (taskinfo.SourceSubjectVisitId != baseLineVisitId && isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
@@ -434,13 +229,64 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
addRowList.AddRange(addList);
|
||||
addTableQuestionAnswerList.AddRange(tableAnswers);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 添加 是否预设
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionTrial.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.IsPreinstall).Include(x=>x.ReadingQuestionTrial).ToListAsync();
|
||||
if (tableQuestionList.Count() > 0)
|
||||
{
|
||||
|
||||
foreach (var tableQuestion in tableQuestionList)
|
||||
{
|
||||
var thisTableQuestionList=await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.ReadingQuestionId).ToListAsync();
|
||||
|
||||
decimal index = 1;
|
||||
|
||||
foreach (var item in tableQuestion.TypeValue.Split('|'))
|
||||
{
|
||||
var newRowId = NewId.NextGuid();
|
||||
addRowList.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
Id = newRowId,
|
||||
QuestionId = tableQuestion.ReadingQuestionId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
RowIndex = index,
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = tableQuestion.ReadingQuestionTrial.OrderMark,
|
||||
FristAddTaskId = taskinfo.Id,
|
||||
RowMark = tableQuestion.ReadingQuestionTrial.OrderMark + decimal.Parse(index.ToString()).GetLesionMark()
|
||||
|
||||
});
|
||||
|
||||
foreach (var thisTableQuestion in thisTableQuestionList)
|
||||
{
|
||||
addTableQuestionAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = thisTableQuestion.Id== tableQuestion.Id? item:string.Empty,
|
||||
QuestionId = tableQuestion.ReadingQuestionId,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = newRowId,
|
||||
RowIndex = index,
|
||||
TableQuestionId = thisTableQuestion.Id,
|
||||
});
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addRowList);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(addTableQuestionAnswerList);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||
{
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
//测试项目 可以加入 测试用户 或者内部正式用户
|
||||
.WhereIf(trialType == TrialType.NoneOfficial, t => t.IdentityUser.IsTestUser == true || (t.IdentityUser.IsTestUser == false && t.IdentityUser.IsZhiZhun))
|
||||
.Where(t => t.IdentityUser.Status == UserStateEnum.Enable && t.IsUserRoleDisabled == false)
|
||||
.Where(t => userTypeEnums.Contains(t.UserTypeEnum))
|
||||
.WhereIf(inQuery.UserTypeEnum != null, t => t.UserTypeEnum == inQuery.UserTypeEnum)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => t.IdentityUser.FullName.Contains(inQuery.UserRealName))
|
||||
|
||||
@@ -62,6 +62,8 @@ namespace IRaCIS.Application.Contracts
|
||||
public Guid? FinalSubjectVisitId { get; set; }
|
||||
|
||||
public bool IsSubjectQuit { get; set; }
|
||||
|
||||
public string SuspendReason { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +138,7 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
public Guid LatestSubmitSubjectVisitId { get; set; }
|
||||
|
||||
|
||||
public string SuspendReason { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1029,6 +1029,8 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
public int StudyCount { get; set; }
|
||||
|
||||
public string UploadJsonStr { get; set; }
|
||||
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
@@ -272,6 +272,10 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public string StudyName { get; set; } = string.Empty;
|
||||
|
||||
public string BodyPartForEdit { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
public List<DicomSeriesDTO> SeriesList { get; set; } = new List<DicomSeriesDTO>();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@ using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Org.BouncyCastle.Asn1.Tsp;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
@@ -19,7 +21,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
||||
//IRepository<ReadingCustomTag> _readingCustomTagRepository,
|
||||
//IRepository<ReadingCustomTag> _readingCustomTagRepository,
|
||||
IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMark,
|
||||
IRepository<NoneDicomStudyFile> _noneDicomStudyFileRepository,
|
||||
IRepository<Subject> _subjectRepository,
|
||||
@@ -222,27 +224,42 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
var isImageFilter = false;
|
||||
var criterionModalitys = "";
|
||||
if (visitTaskId != null)
|
||||
var criterionType = CriterionType.NoCriterion;
|
||||
|
||||
var isVisitTask = false;
|
||||
|
||||
bool? isImageSegmentLabel = null;
|
||||
if (visitTaskId != null && visitTaskId != Guid.Empty)
|
||||
{
|
||||
isVisitTask = true;
|
||||
var info = await _visitTaskRepository.Where(t => t.Id == visitTaskId)
|
||||
.Select(t => new { t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys }).FirstNotNullAsync();
|
||||
.Select(t => new { t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys, t.TrialReadingCriterion.CriterionType }).FirstNotNullAsync();
|
||||
isImageFilter = info.IsImageFilter;
|
||||
criterionModalitys = info.CriterionModalitys;
|
||||
|
||||
criterionType = info.CriterionType;
|
||||
|
||||
if (criterionType == CriterionType.OCT || criterionType == CriterionType.IVUS)
|
||||
{
|
||||
isImageSegmentLabel = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var studyList = await _dicomStudyRepository.Where(t => t.TrialId == trialId && t.SubjectVisitId == sujectVisitId).IgnoreQueryFilters()
|
||||
.Where(t => isImageFilter ? ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|") : true)
|
||||
.WhereIf(isReading == 1 || isQCFinished, s => s.IsDeleted == false)
|
||||
.Select(k => new VisitStudyDTO()
|
||||
{
|
||||
InstanceCount = k.InstanceCount,
|
||||
Modalities = k.Modalities,
|
||||
//SeriesCount = k.SeriesCount,
|
||||
StudyCode = k.StudyCode,
|
||||
StudyId = k.Id
|
||||
}).ToListAsync();
|
||||
.Where(t => isImageFilter ? ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|") : true)
|
||||
.WhereIf(isReading == 1 || isQCFinished, s => s.IsDeleted == false)
|
||||
//预览靶段标注上传的影像 影像后处理 上传了新的影像 还要原始dsa
|
||||
.WhereIf(isImageSegmentLabel == true && isVisitTask && (criterionType == CriterionType.OCT || criterionType == CriterionType.IVUS), t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "OCT")
|
||||
.Select(k => new VisitStudyDTO()
|
||||
{
|
||||
InstanceCount = k.InstanceCount,
|
||||
Modalities = k.Modalities,
|
||||
//SeriesCount = k.SeriesCount,
|
||||
StudyCode = k.StudyCode,
|
||||
StudyId = k.Id
|
||||
}).ToListAsync();
|
||||
|
||||
var studyIds = studyList.Select(t => t.StudyId).ToList();
|
||||
|
||||
@@ -285,12 +302,29 @@ namespace IRaCIS.Core.Application.Services
|
||||
t.InstanceCount = t.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
|
||||
}
|
||||
|
||||
//预览靶段标注上传的影像
|
||||
if (isImageSegmentLabel == true && isVisitTask)
|
||||
{
|
||||
//var taskStudyList = await _taskStudyRepository.Where(t => t.SubjectVisitId == sujectVisitId)
|
||||
// .WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
// .ProjectTo<VisitStudyDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
//foreach (var study in taskStudyList)
|
||||
//{
|
||||
// study.SeriesList = study.SeriesList.OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
|
||||
|
||||
// study.InstanceCount = study.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
|
||||
//}
|
||||
|
||||
//studyList.AddRange(taskStudyList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return studyList.Where(x=>x.SeriesList.Count()>0).ToList();
|
||||
return studyList.Where(x => x.SeriesList.Count() > 0).ToList();
|
||||
|
||||
|
||||
|
||||
//return ResponseOutput.Ok(studyList.Where(t => t.SeriesList.Count > 0).ToList());
|
||||
|
||||
}
|
||||
|
||||
@@ -468,58 +502,71 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
var studyList = new List<VisitStudyDTO>();
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(t => new { t.TrialReadingCriterionId, t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys, t.ReadingTaskState, TaskStudyCount = t.TaskStudyList.Count }).FirstNotNullAsync();
|
||||
|
||||
//影像后处理 上传了新的影像
|
||||
if (taskInfo.TaskStudyCount > 0)
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(t => new
|
||||
{
|
||||
t.TrialReadingCriterionId,
|
||||
t.TrialReadingCriterion.CriterionType,
|
||||
t.TrialReadingCriterion.IsImageFilter,
|
||||
t.TrialReadingCriterion.CriterionModalitys,
|
||||
t.ReadingTaskState,
|
||||
|
||||
var taskStudyList = await _taskStudyRepository.Where(t => t.TrialId == indto.TrialId && t.VisitTaskId == indto.VisitTaskId)
|
||||
.WhereIf(taskInfo.IsImageFilter == true, t => ("|" + taskInfo.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
.ProjectTo<VisitStudyDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
//是否有了后处理的dicom检查
|
||||
IsHaveTaskStudy = t.TaskStudyList.Any(),
|
||||
//是否有了后处理的NoneDicom检查
|
||||
IsHaveTaskNoneDicomStudyFile = t.SourceSubjectVisit.NoneDicomStudyList.SelectMany(c => c.TaskNoneDicomFileList.Where(t => t.VisitTaskId == indto.VisitTaskId)).Any(),
|
||||
//是否有了标注的dicom检查
|
||||
//IsMarkDicomStudy = t.SourceSubjectVisit.TaskStudyList.Any(),
|
||||
//是否有了标注的NoneDicom检查
|
||||
IsMarkNoneDicomStudy = t.SourceSubjectVisit.NoneDicomStudyList.SelectMany(c => c.ImageLabelNoneDicomFileList).Any()
|
||||
|
||||
foreach (var study in taskStudyList)
|
||||
}).FirstNotNullAsync();
|
||||
|
||||
|
||||
|
||||
#region dicom 检查查询
|
||||
|
||||
//如果是手动生成的标准,需要过滤检查和序列数据
|
||||
|
||||
var isManualGenerate = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == taskInfo.TrialReadingCriterionId && t.IsAutoCreate == false);
|
||||
|
||||
var dicomStudyList = await _dicomStudyRepository.Where(t => t.TrialId == indto.TrialId && t.SubjectVisitId == indto.SujectVisitId)
|
||||
.WhereIf(taskInfo.IsImageFilter == true, t => ("|" + taskInfo.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
|
||||
//影像后处理 上传了新的影像 还要原始dsa
|
||||
.WhereIf(taskInfo.IsHaveTaskStudy && taskInfo.CriterionType == CriterionType.OCT,
|
||||
t => t.ModalityForEdit == "XA")
|
||||
|
||||
.WhereIf(taskInfo.CriterionType == CriterionType.IVUS,
|
||||
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "IVUS")
|
||||
|
||||
.WhereIf(taskInfo.IsHaveTaskStudy == false && taskInfo.CriterionType == CriterionType.OCT,
|
||||
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "OCT")
|
||||
|
||||
|
||||
//其他 不应该看原始影像
|
||||
.WhereIf(taskInfo.IsHaveTaskStudy && (taskInfo.CriterionType != CriterionType.OCT && taskInfo.CriterionType != CriterionType.IVUS), t => false)
|
||||
.Select(k => new VisitStudyDTO()
|
||||
{
|
||||
study.SeriesList = study.SeriesList.OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
|
||||
InstanceCount = k.InstanceCount,
|
||||
StudyName = k.StudyName,
|
||||
Modalities = k.Modalities,
|
||||
//SeriesCount = k.SeriesCount,
|
||||
StudyCode = k.StudyCode,
|
||||
StudyId = k.Id,
|
||||
|
||||
//foreach (var series in study.SeriesList)
|
||||
//{
|
||||
// series.WindowCenter = series.InstanceInfoList.FirstOrDefault()!.WindowCenter;
|
||||
// series.WindowWidth = series.InstanceInfoList.FirstOrDefault()!.WindowWidth;
|
||||
//}
|
||||
//study.SeriesCount = study.SeriesList.Count;
|
||||
BodyPartForEdit = k.BodyPartForEdit,
|
||||
BodyPartForEditOther = k.BodyPartForEditOther
|
||||
|
||||
study.InstanceCount = study.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
|
||||
}
|
||||
|
||||
studyList.AddRange(taskStudyList);
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
var studyIds = dicomStudyList.Select(t => t.StudyId).ToList();
|
||||
|
||||
if (studyIds.Count > 0)
|
||||
{
|
||||
#region dicom 检查查询
|
||||
|
||||
//如果是手动生成的标准,需要过滤检查和序列数据
|
||||
|
||||
var isManualGenerate = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == taskInfo.TrialReadingCriterionId && t.IsAutoCreate == false);
|
||||
|
||||
var dicomStudyList = await _dicomStudyRepository.Where(t => t.TrialId == indto.TrialId && t.SubjectVisitId == indto.SujectVisitId)
|
||||
.WhereIf(taskInfo.IsImageFilter == true, t => ("|" + taskInfo.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
|
||||
.Select(k => new VisitStudyDTO()
|
||||
{
|
||||
InstanceCount = k.InstanceCount,
|
||||
StudyName = k.StudyName,
|
||||
Modalities = k.Modalities,
|
||||
//SeriesCount = k.SeriesCount,
|
||||
StudyCode = k.StudyCode,
|
||||
StudyId = k.Id,
|
||||
|
||||
}).ToListAsync();
|
||||
var studyIds = dicomStudyList.Select(t => t.StudyId).ToList();
|
||||
|
||||
var instanceList = await _dicomInstanceRepository.Where(t => studyIds.Contains(t.StudyId) && t.IsReading)
|
||||
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.IsReading, t.FileSize }).ToListAsync();
|
||||
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.IsReading, t.FileSize }).ToListAsync();
|
||||
|
||||
List<DicomSeriesDTO> seriesLists = await _dicomSeriesRepository.Where(s => studyIds.Contains(s.StudyId))
|
||||
.WhereIf(isManualGenerate == false, t => t.IsReading)
|
||||
@@ -557,155 +604,176 @@ namespace IRaCIS.Core.Application.Services
|
||||
}
|
||||
|
||||
studyList.AddRange(dicomStudyList);
|
||||
}
|
||||
|
||||
#endregion
|
||||
//影像后处理 上传了新的影像
|
||||
if (taskInfo.IsHaveTaskStudy /*|| taskInfo.IsMarkDicomStudy*/ || taskInfo.IsMarkNoneDicomStudy)
|
||||
{
|
||||
|
||||
#region dicom 关键序列处理
|
||||
var taskStudyList = await _taskStudyRepository.Where(t => t.TrialId == indto.TrialId)
|
||||
.WhereIf(taskInfo.IsHaveTaskStudy, t => t.VisitTaskId == indto.VisitTaskId)
|
||||
.WhereIf(taskInfo.IsHaveTaskStudy == false && (/*taskInfo.IsMarkDicomStudy ||*/ taskInfo.IsMarkNoneDicomStudy), t => t.SubjectVisitId == indto.SujectVisitId)
|
||||
.WhereIf(taskInfo.IsImageFilter == true, t => ("|" + taskInfo.CriterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
.ProjectTo<VisitStudyDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
//已经签名的任务,加关键序列
|
||||
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||
foreach (var study in taskStudyList)
|
||||
{
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x => x.ReadingQuestionTrial.ShowOrder).ThenBy(x => x.RowIndex).Select(x => new StudyInstanceInfo()
|
||||
study.SeriesList = study.SeriesList.OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
|
||||
|
||||
study.InstanceCount = study.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
|
||||
}
|
||||
|
||||
studyList.AddRange(taskStudyList);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region dicom 关键序列处理
|
||||
|
||||
//已经签名的任务,加关键序列
|
||||
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||
{
|
||||
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x => x.ReadingQuestionTrial.ShowOrder).ThenBy(x => x.RowIndex).Select(x => new StudyInstanceInfo()
|
||||
{
|
||||
ShowOrder = x.ReadingQuestionTrial.ShowOrder,
|
||||
RowIndex = x.RowIndex,
|
||||
SeriesId = x.SeriesId,
|
||||
StudyId = x.StudyId,
|
||||
InstanceId = x.InstanceId,
|
||||
NumberOfFrames = x.NumberOfFrames,
|
||||
CreateTime = x.CreateTime,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
// 这个表的数据已经移动到 _readingTaskQuestionMark 了
|
||||
//var customoList = await _readingCustomTagRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).Select(x => new StudyInstanceInfo()
|
||||
//{
|
||||
// ShowOrder = 0,
|
||||
// RowIndex = 0m,
|
||||
// SeriesId = x.SeriesId,
|
||||
// StudyId = x.StudyId,
|
||||
// InstanceId = x.InstanceId,
|
||||
// NumberOfFrames = x.NumberOfFrames,
|
||||
// CreateTime = x.CreateTime,
|
||||
//}).ToListAsync();
|
||||
//rowInfoList.AddRange(customoList);
|
||||
|
||||
var questionMarkList = await _readingTaskQuestionMark.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).Select(x => new StudyInstanceInfo()
|
||||
{
|
||||
ShowOrder = x.ReadingQuestionTrial == null ? 0 : x.ReadingQuestionTrial.ShowOrder,
|
||||
RowIndex = 0m,
|
||||
SeriesId = x.SeriesId,
|
||||
StudyId = x.StudyId,
|
||||
InstanceId = x.InstanceId,
|
||||
NumberOfFrames = x.NumberOfFrames,
|
||||
CreateTime = x.CreateTime,
|
||||
}).ToListAsync();
|
||||
rowInfoList.AddRange(questionMarkList);
|
||||
|
||||
var thisStudyIds = rowInfoList.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.StudyId).Distinct().ToList();
|
||||
var thisSeriesIdIds = rowInfoList.Where(x => x.SeriesId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.SeriesId).Distinct().ToList();
|
||||
if (rowInfoList.Count > 0)
|
||||
{
|
||||
var thisVisitTaskStudy = await _dicomStudyRepository.Where(t => thisStudyIds.Contains(t.Id)).Select(k => new VisitStudyDTO()
|
||||
{
|
||||
ShowOrder = x.ReadingQuestionTrial.ShowOrder,
|
||||
RowIndex = x.RowIndex,
|
||||
SeriesId = x.SeriesId,
|
||||
StudyId = x.StudyId,
|
||||
InstanceId = x.InstanceId,
|
||||
NumberOfFrames = x.NumberOfFrames,
|
||||
CreateTime=x.CreateTime,
|
||||
|
||||
}).ToListAsync();
|
||||
InstanceCount = k.InstanceCount,
|
||||
|
||||
//SeriesCount = k.SeriesCount,
|
||||
|
||||
// 这个表的数据已经移动到 _readingTaskQuestionMark 了
|
||||
//var customoList = await _readingCustomTagRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).Select(x => new StudyInstanceInfo()
|
||||
//{
|
||||
// ShowOrder = 0,
|
||||
// RowIndex = 0m,
|
||||
// SeriesId = x.SeriesId,
|
||||
// StudyId = x.StudyId,
|
||||
// InstanceId = x.InstanceId,
|
||||
// NumberOfFrames = x.NumberOfFrames,
|
||||
// CreateTime = x.CreateTime,
|
||||
//}).ToListAsync();
|
||||
//rowInfoList.AddRange(customoList);
|
||||
StudyId = k.Id,
|
||||
IsCriticalSequence = true,
|
||||
|
||||
var questionMarkList = await _readingTaskQuestionMark.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).Select(x => new StudyInstanceInfo()
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
if (thisVisitTaskStudy != null)
|
||||
{
|
||||
ShowOrder = x.ReadingQuestionTrial==null?0: x.ReadingQuestionTrial.ShowOrder,
|
||||
RowIndex = 0m,
|
||||
SeriesId = x.SeriesId,
|
||||
StudyId = x.StudyId,
|
||||
InstanceId = x.InstanceId,
|
||||
NumberOfFrames = x.NumberOfFrames,
|
||||
CreateTime = x.CreateTime,
|
||||
}).ToListAsync();
|
||||
rowInfoList.AddRange(questionMarkList);
|
||||
thisVisitTaskStudy.StudyId = default(Guid);
|
||||
var item = await _dicomSeriesRepository.Where(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber).
|
||||
ThenBy(s => s.SeriesTime)
|
||||
.ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
var thisStudyIds = rowInfoList.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.StudyId).Distinct().ToList();
|
||||
var thisSeriesIdIds = rowInfoList.Where(x => x.SeriesId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.SeriesId).Distinct().ToList();
|
||||
if (rowInfoList.Count > 0)
|
||||
{
|
||||
var thisVisitTaskStudy = await _dicomStudyRepository.Where(t => thisStudyIds.Contains(t.Id)).Select(k => new VisitStudyDTO()
|
||||
if (item != null)
|
||||
{
|
||||
InstanceCount = k.InstanceCount,
|
||||
item.SeriesInstanceUid = string.Empty;
|
||||
|
||||
//SeriesCount = k.SeriesCount,
|
||||
var markInstanceIdList = rowInfoList.Where(y => y.InstanceId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(y => y.InstanceId!.Value).Distinct().ToList();
|
||||
|
||||
StudyId = k.Id,
|
||||
IsCriticalSequence = true,
|
||||
item.InstanceInfoList = await _dicomInstanceRepository.Where(t => markInstanceIdList.Contains(t.Id)).OrderBy(s => s.DicomSerie.SeriesNumber).ThenBy(s => s.DicomSerie.SeriesTime).ThenBy(x => x.InstanceTime).Select(k =>
|
||||
new InstanceBasicInfo()
|
||||
{
|
||||
Id = k.Id,
|
||||
NumberOfFrames = k.NumberOfFrames,
|
||||
HtmlPath = k.HtmlPath,
|
||||
Path = k.Path,
|
||||
InstanceNumber = k.InstanceNumber,
|
||||
StudyId = k.StudyId,
|
||||
SeriesId = k.SeriesId,
|
||||
FileSize = k.FileSize
|
||||
}).ToListAsync();
|
||||
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
if (thisVisitTaskStudy != null)
|
||||
{
|
||||
thisVisitTaskStudy.StudyId = default(Guid);
|
||||
var item = await _dicomSeriesRepository.Where(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber).
|
||||
ThenBy(s => s.SeriesTime)
|
||||
.ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
if (item != null)
|
||||
item.InstanceInfoList.ForEach(x =>
|
||||
{
|
||||
item.SeriesInstanceUid = string.Empty;
|
||||
x.RowDate = rowInfoList.FirstOrDefault(y => y.InstanceId == x.Id)?.CreateTime ?? DateTime.Now;
|
||||
var keyFramesList = rowInfoList.Where(y => y.InstanceId == x.Id && y.NumberOfFrames != 0 && y.NumberOfFrames != null).Select(y => y.NumberOfFrames).Distinct().ToList();
|
||||
|
||||
var markInstanceIdList = rowInfoList.Where(y => y.InstanceId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(y => y.InstanceId!.Value).Distinct().ToList();
|
||||
|
||||
item.InstanceInfoList = await _dicomInstanceRepository.Where(t => markInstanceIdList.Contains(t.Id)).OrderBy(s => s.DicomSerie.SeriesNumber).ThenBy(s => s.DicomSerie.SeriesTime).ThenBy(x => x.InstanceTime).Select(k =>
|
||||
new InstanceBasicInfo()
|
||||
{
|
||||
Id = k.Id,
|
||||
NumberOfFrames = k.NumberOfFrames,
|
||||
HtmlPath = k.HtmlPath,
|
||||
Path = k.Path,
|
||||
InstanceNumber = k.InstanceNumber,
|
||||
StudyId = k.StudyId,
|
||||
SeriesId = k.SeriesId,
|
||||
FileSize = k.FileSize
|
||||
}).ToListAsync();
|
||||
|
||||
item.InstanceInfoList.ForEach(x =>
|
||||
if (keyFramesList.Count() > 0)
|
||||
{
|
||||
x.RowDate = rowInfoList.FirstOrDefault(y => y.InstanceId == x.Id)?.CreateTime ?? DateTime.Now;
|
||||
var keyFramesList = rowInfoList.Where(y => y.InstanceId == x.Id && y.NumberOfFrames != 0 && y.NumberOfFrames != null).Select(y => y.NumberOfFrames).Distinct().ToList();
|
||||
x.KeyFramesList = keyFramesList;
|
||||
}
|
||||
|
||||
if (keyFramesList.Count() > 0)
|
||||
{
|
||||
x.KeyFramesList = keyFramesList;
|
||||
}
|
||||
var item = rowInfoList.FirstOrDefault(y => y.InstanceId == x.Id);
|
||||
if (item != null)
|
||||
{
|
||||
x.ShowOrder = item.ShowOrder;
|
||||
x.RowIndex = item.RowIndex;
|
||||
}
|
||||
|
||||
var item = rowInfoList.FirstOrDefault(y => y.InstanceId == x.Id);
|
||||
if (item != null)
|
||||
{
|
||||
x.ShowOrder = item.ShowOrder;
|
||||
x.RowIndex = item.RowIndex;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
item.InstanceInfoList = item.InstanceInfoList.OrderBy(x => x.ShowOrder).ThenBy(x=>x.RowIndex).ThenBy(x=>x.RowDate).ToList();
|
||||
item.InstanceInfoList = item.InstanceInfoList.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).ThenBy(x => x.RowDate).ToList();
|
||||
|
||||
|
||||
item.InstanceCount = item.InstanceInfoList.Count;
|
||||
item.InstanceCount = item.InstanceInfoList.Count;
|
||||
|
||||
item.Description = "Key Series";
|
||||
|
||||
var modalityList = await _dicomSeriesRepository.Where(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).Select(x => x.Modality).Distinct().ToListAsync(); ;
|
||||
item.Modality = string.Join(",", modalityList);
|
||||
thisVisitTaskStudy.SeriesList.Add(item);
|
||||
//thisVisitTaskStudy.SeriesCount = thisVisitTaskStudy.SeriesList.Count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
studyList.Insert(0, thisVisitTaskStudy);
|
||||
item.Description = "Key Series";
|
||||
|
||||
var modalityList = await _dicomSeriesRepository.Where(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).Select(x => x.Modality).Distinct().ToListAsync(); ;
|
||||
item.Modality = string.Join(",", modalityList);
|
||||
thisVisitTaskStudy.SeriesList.Add(item);
|
||||
//thisVisitTaskStudy.SeriesCount = thisVisitTaskStudy.SeriesList.Count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
studyList.Insert(0, thisVisitTaskStudy);
|
||||
|
||||
}
|
||||
|
||||
studyList.ForEach(x =>
|
||||
{
|
||||
x.SeriesList.ForEach(y =>
|
||||
{
|
||||
y.IsBeMark = rowInfoList.Any(z => z.SeriesId == y.Id);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
studyList.ForEach(x =>
|
||||
{
|
||||
x.SeriesList.ForEach(y =>
|
||||
{
|
||||
y.IsBeMark = rowInfoList.Any(z => z.SeriesId == y.Id);
|
||||
});
|
||||
|
||||
#endregion
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 非Dicom 检查查询
|
||||
|
||||
var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId && x.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip)))
|
||||
.Where(t => t.IsReading)
|
||||
.WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality)).ToListAsync();
|
||||
.Where(t => t.IsReading)
|
||||
.WhereIf(taskInfo.IsImageFilter, t => ("|" + taskInfo.CriterionModalitys + "|").Contains("|" + t.Modality + "|"))
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
List<VisitStudyDTO> noDicomStudyList = noDicomList.Select(x => new VisitStudyDTO()
|
||||
@@ -718,17 +786,22 @@ namespace IRaCIS.Core.Application.Services
|
||||
StudyCode = x.StudyCode,
|
||||
IsDicom = false,
|
||||
|
||||
BodyPartForEdit = x.BodyPart,
|
||||
BodyPartForEditOther = x.BodyPartForEditOther
|
||||
|
||||
}).ToList();
|
||||
|
||||
var isExistTaskNoneDicomFile = _noneDicomStudyFileRepository.Any(t => t.VisitTaskId == indto.VisitTaskId);
|
||||
//var isExistTaskNoneDicomFile = _noneDicomStudyFileRepository.Any(t => t.VisitTaskId == indto.VisitTaskId);
|
||||
|
||||
foreach (var item in noDicomStudyList)
|
||||
{
|
||||
var nodicom = noDicomList.Where(x => x.Id == item.StudyId).First();
|
||||
|
||||
var instanceCount = await _noneDicomStudyFileRepository.Where(t => t.IsReading)
|
||||
.WhereIf(isExistTaskNoneDicomFile, x => x.OriginNoneDicomStudyId == item.StudyId)
|
||||
.WhereIf(isExistTaskNoneDicomFile == false, x => x.NoneDicomStudyId == item.StudyId).CountAsync();
|
||||
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile == false && taskInfo.IsMarkNoneDicomStudy == true, x => x.ImageLabelNoneDicomStudyId == item.StudyId)
|
||||
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile && taskInfo.IsMarkNoneDicomStudy, x => x.OriginNoneDicomStudyId == item.StudyId)
|
||||
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile == false && taskInfo.IsMarkNoneDicomStudy == false, x => x.NoneDicomStudyId == item.StudyId)
|
||||
.CountAsync();
|
||||
|
||||
if (instanceCount == 0)
|
||||
{
|
||||
@@ -749,8 +822,10 @@ namespace IRaCIS.Core.Application.Services
|
||||
SubjectVisitId=nodicom.SubjectVisitId,
|
||||
SubjectId=nodicom.SubjectId,
|
||||
SeriesNumber=1,
|
||||
NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.WhereIf(isExistTaskNoneDicomFile,x=>x.OriginNoneDicomStudyId== item.StudyId)
|
||||
.WhereIf(isExistTaskNoneDicomFile==false, x=>x.NoneDicomStudyId == item.StudyId)
|
||||
NoneDicomFileFirstFile=await _noneDicomStudyFileRepository
|
||||
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile == false && taskInfo.IsMarkNoneDicomStudy == true, x => x.ImageLabelNoneDicomStudyId == item.StudyId)
|
||||
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile && taskInfo.IsMarkNoneDicomStudy, x => x.OriginNoneDicomStudyId == item.StudyId)
|
||||
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile == false && taskInfo.IsMarkNoneDicomStudy == false, x => x.NoneDicomStudyId == item.StudyId)
|
||||
.Where(x=> !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(),
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<SCPSeries, DicomSeries>();
|
||||
CreateMap<SCPInstance, DicomInstance>();
|
||||
|
||||
|
||||
CreateMap<DicomStudy, VisitStudyDTO>()
|
||||
.ForMember(d => d.StudyId, u => u.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.SeriesList, u => u.MapFrom(s => s.SeriesList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Aliyun.OSS;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using FellowOakDicom;
|
||||
using FellowOakDicom.Imaging;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.BusinessFilter;
|
||||
@@ -15,7 +16,9 @@ using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Encryption;
|
||||
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
|
||||
using MassTransit;
|
||||
using MassTransit.Caching.Internals;
|
||||
using MassTransit.Mediator;
|
||||
using MathNet.Numerics;
|
||||
using MaxMind.GeoIP2;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -27,18 +30,22 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MiniExcelLibs;
|
||||
using Minio.DataModel;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using NPOI.XWPF.UserModel;
|
||||
using SharpCompress.Common;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
|
||||
|
||||
|
||||
@@ -66,6 +73,72 @@ namespace IRaCIS.Core.Application.Service
|
||||
ILogger<TestService> _logger, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
||||
{
|
||||
public static int IntValue = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 重建闭包表
|
||||
/// </summary>
|
||||
/// <param name="_auditDocumentClosureRepository"></param>
|
||||
/// <param name="_auditDocumentRepository"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> RebuildAuditDocumentClosureAsync([FromServices] IRepository<AuditDocumentClosure> _auditDocumentClosureRepository, [FromServices] IRepository<AuditDocument> _auditDocumentRepository)
|
||||
{
|
||||
|
||||
|
||||
await _auditDocumentClosureRepository.BatchDeleteNoTrackingAsync(t => t.Id != Guid.Empty);
|
||||
|
||||
//过滤版本文件,防止污染闭包表
|
||||
var documents = await _auditDocumentRepository.Where(t => t.MainFileId == null).Select(t => new { t.Id, t.ParentId }).ToListAsync();
|
||||
|
||||
var closures = new List<AuditDocumentClosure>();
|
||||
|
||||
// 建立一个字典,加快查找
|
||||
var lookup = documents.ToDictionary(d => d.Id, d => d.ParentId);
|
||||
|
||||
foreach (var doc in documents)
|
||||
{
|
||||
// 1️ 自己 -> 自己 (depth = 0)
|
||||
closures.Add(new AuditDocumentClosure
|
||||
{
|
||||
AncestorId = doc.Id,
|
||||
DescendantId = doc.Id,
|
||||
Depth = 0
|
||||
});
|
||||
|
||||
// 2️ 递归向上找所有祖先
|
||||
int depth = 1;
|
||||
var currentParentId = doc.ParentId;
|
||||
|
||||
|
||||
//脏数据 parentId==Guid.Empty
|
||||
while (currentParentId.HasValue && currentParentId != Guid.Empty)
|
||||
{
|
||||
closures.Add(new AuditDocumentClosure
|
||||
{
|
||||
AncestorId = currentParentId.Value,
|
||||
DescendantId = doc.Id,
|
||||
Depth = depth
|
||||
});
|
||||
|
||||
depth++;
|
||||
|
||||
// 继续向上查找
|
||||
if (!lookup.TryGetValue(currentParentId.Value, out var nextParent))
|
||||
break;
|
||||
|
||||
currentParentId = nextParent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
await _auditDocumentClosureRepository.AddRangeAsync(closures);
|
||||
await _auditDocumentClosureRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清理一致性分析任务
|
||||
/// </summary>
|
||||
@@ -136,7 +209,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
if (!_readingMedicineSystemQuestion.Any(t => t.CriterionTypeEnum == CriterionType.mRECISTHCC))
|
||||
{
|
||||
var list = _readingMedicineSystemQuestion.Where(t => t.CriterionTypeEnum == CriterionType.RECIST1Point1).OrderBy(t=>t.ShowOrder).ToList();
|
||||
var list = _readingMedicineSystemQuestion.Where(t => t.CriterionTypeEnum == CriterionType.RECIST1Point1).OrderBy(t => t.ShowOrder).ToList();
|
||||
|
||||
var initOrder = 500;
|
||||
foreach (var item in list)
|
||||
@@ -151,10 +224,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
initOrder = initOrder + 1;
|
||||
}
|
||||
|
||||
await _readingMedicineSystemQuestion.AddRangeAsync(list,true);
|
||||
await _readingMedicineSystemQuestion.AddRangeAsync(list, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
@@ -365,6 +438,311 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> RestoreDBOSSDate(
|
||||
[FromServices] IOSSService _oSSService, [FromServices] IWebHostEnvironment _hostEnvironment, [FromServices] IRepository<DicomStudy> _studyRepository)
|
||||
{
|
||||
var folder = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||
|
||||
var outputFile = Path.Combine(folder, $"{Guid.NewGuid()}_deleteKey_info.txt");
|
||||
var outputFile2 = Path.Combine(folder, $"{Guid.NewGuid()}_deleteKeyExport_info.txt");
|
||||
|
||||
var outputErrorFile = Path.Combine(folder, $"{Guid.NewGuid()}_deleteKeyerror.txt");
|
||||
var outputErrorFile2 = Path.Combine(folder, $"{Guid.NewGuid()}_deleteKeyerrorStudy.txt");
|
||||
|
||||
|
||||
var aliConfig = _oSSService.ObjectStoreServiceOptions.AliyunOSS;
|
||||
|
||||
var tempToken = _oSSService.GetObjectStoreTempToken();
|
||||
|
||||
var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint,
|
||||
tempToken.AliyunOSS.AccessKeyId,
|
||||
tempToken.AliyunOSS.AccessKeySecret,
|
||||
tempToken.AliyunOSS.SecurityToken);
|
||||
|
||||
|
||||
var allVersions = new List<ObjectVersionSummary>();
|
||||
var allDeleteMarkers = new List<DeleteMarkerSummary>();
|
||||
|
||||
var request = new ListObjectVersionsRequest(tempToken.AliyunOSS.BucketName)
|
||||
{
|
||||
Prefix = "01000000-ac13-0242-6397-08dcd2d2a091/Image",
|
||||
//Prefix = "01000000-ac13-0242-6397-08dcd2d2a091/Image/08dd9c04-c1b2-c2da-0242-ac1301000000/01000000-ac13-0242-235b-08dd9c04c1b3",
|
||||
MaxKeys = 1000,
|
||||
};
|
||||
|
||||
ObjectVersionList result;
|
||||
do
|
||||
{
|
||||
|
||||
result = _ossClient.ListObjectVersions(request);
|
||||
|
||||
if (result.ObjectVersionSummaries != null)
|
||||
allVersions.AddRange(result.ObjectVersionSummaries);
|
||||
|
||||
if (result.DeleteMarkerSummaries != null)
|
||||
allDeleteMarkers.AddRange(result.DeleteMarkerSummaries);
|
||||
|
||||
request.KeyMarker = result.NextKeyMarker;
|
||||
request.VersionIdMarker = result.NextVersionIdMarker;
|
||||
|
||||
} while (result.IsTruncated);
|
||||
|
||||
Console.WriteLine($"共找到 {allDeleteMarkers.Count} 个删除标记");
|
||||
|
||||
|
||||
|
||||
int total = allDeleteMarkers.Count;
|
||||
|
||||
int processed = 0;
|
||||
double lastPercent = 0;
|
||||
|
||||
|
||||
// 按 Key 分组,找每个删除标记前的最近版本
|
||||
var versionsByKey = allVersions
|
||||
.GroupBy(v => v.Key)
|
||||
.ToDictionary(g => g.Key, g => g.OrderByDescending(x => x.LastModified).ToList());
|
||||
|
||||
foreach (var del in allDeleteMarkers)
|
||||
{
|
||||
#region 防止阿里云过期
|
||||
if (tempToken.AliyunOSS.Expiration.AddSeconds(10) <= DateTime.Now)
|
||||
{
|
||||
tempToken = _oSSService.GetObjectStoreTempToken();
|
||||
|
||||
_ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint,
|
||||
tempToken.AliyunOSS.AccessKeyId,
|
||||
tempToken.AliyunOSS.AccessKeySecret,
|
||||
tempToken.AliyunOSS.SecurityToken);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (!versionsByKey.TryGetValue(del.Key, out var versions))
|
||||
continue; // 没有历史版本无法恢复
|
||||
|
||||
var prevVersion = versions.FirstOrDefault(v => v.LastModified < del.LastModified);
|
||||
if (prevVersion == null)
|
||||
continue; // 没找到可恢复版本
|
||||
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
await File.AppendAllTextAsync(outputFile, $"{prevVersion.Key},{prevVersion.VersionId}" + Environment.NewLine);
|
||||
|
||||
var getReq = new GetObjectRequest(tempToken.AliyunOSS.BucketName, prevVersion.Key)
|
||||
{
|
||||
VersionId = prevVersion.VersionId
|
||||
};
|
||||
|
||||
using (var getResult = _ossClient.GetObject(getReq))
|
||||
using (var memStream = new MemoryStream())
|
||||
{
|
||||
// 先把 OSS 流复制到内存流
|
||||
getResult.Content.CopyTo(memStream);
|
||||
memStream.Position = 0;
|
||||
|
||||
// 读取 DICOM 信息
|
||||
var dicomFile = DicomFile.Open(memStream);
|
||||
var studyInstanceUID = dicomFile.Dataset.GetString(DicomTag.StudyInstanceUID);
|
||||
|
||||
var findInfo = await _studyRepository.Where(t => t.StudyInstanceUid == studyInstanceUID && t.TrialId == Guid.Parse("01000000-ac13-0242-6397-08dcd2d2a091"))
|
||||
.Select(t => new { t.StudyInstanceUid, t.Subject.Code, t.SubjectVisit.VisitName, t.SubjectId, t.SubjectVisitId }).FirstOrDefaultAsync();
|
||||
|
||||
if (findInfo != null)
|
||||
{
|
||||
|
||||
// 再保存到另一个路径(可以使用 fo-dicom 保存)
|
||||
|
||||
var fileName = Path.GetFileNameWithoutExtension(prevVersion.Key);
|
||||
var anotherPath = Path.Combine(folder, findInfo.Code, findInfo.VisitName, studyInstanceUID, fileName);
|
||||
// 去掉 folder 部分,得到相对路径
|
||||
var relativePath = Path.GetRelativePath(folder, anotherPath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(anotherPath));
|
||||
dicomFile.Save(anotherPath);
|
||||
|
||||
await File.AppendAllTextAsync(outputFile2, $"{findInfo.SubjectId},{findInfo.SubjectVisitId},{prevVersion.Key},{prevVersion.VersionId},{relativePath},{findInfo.Code},{findInfo.VisitName},{findInfo.StudyInstanceUid},{fileName}" + Environment.NewLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
await File.AppendAllTextAsync(outputErrorFile2, $"{studyInstanceUID},{prevVersion.Key},{prevVersion.VersionId}" + Environment.NewLine);
|
||||
}
|
||||
|
||||
//Console.WriteLine($"读取到 studyInstanceUID: {studyInstanceUID}");
|
||||
|
||||
//var localPath = Path.Combine(folder, prevVersion.Key.Trim('/').Replace('/', Path.DirectorySeparatorChar));
|
||||
//Directory.CreateDirectory(Path.GetDirectoryName(localPath));
|
||||
//// 保存到原本路径
|
||||
//memStream.Position = 0;
|
||||
//using (var fs = File.Create(localPath))
|
||||
//{
|
||||
// memStream.CopyTo(fs);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Console.WriteLine($"✅ 下载成功: {prevVersion.Key} (version={prevVersion.VersionId})");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"❌ 下载失败: {prevVersion.Key}, 错误: {ex.Message}");
|
||||
|
||||
await File.AppendAllTextAsync(outputErrorFile, $"{prevVersion.Key},{prevVersion.VersionId}" + Environment.NewLine);
|
||||
}
|
||||
finally
|
||||
{
|
||||
processed++;
|
||||
double percent = processed * 100.0 / total;
|
||||
|
||||
// 每提升 5% 或完成时输出
|
||||
if (percent - lastPercent >= 2.0 || processed == total)
|
||||
{
|
||||
lastPercent = percent;
|
||||
Console.WriteLine($"{DateTime.Now} 进度: {processed}/{total} ({percent:F2}%)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 使用 CopyObject 把历史版本拷贝为最新版本(恢复)
|
||||
//var copyReq = new CopyObjectRequest
|
||||
//{
|
||||
// Bucket = bucketName,
|
||||
// Key = prevVersion.Key,
|
||||
// SourceBucket = bucketName,
|
||||
// SourceKey = prevVersion.Key,
|
||||
// SourceVersionId = prevVersion.VersionId
|
||||
//};
|
||||
|
||||
//try
|
||||
//{
|
||||
// var copyResult = client.CopyObject(copyReq);
|
||||
// Console.WriteLine($"✅ 恢复成功: {prevVersion.Key} -> newVersionId={copyResult.VersionId}");
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// Console.WriteLine($"❌ 恢复失败: {prevVersion.Key}, 错误: {ex.Message}");
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<IResponseOutput> OSSDeleteReStorre([FromServices] IOSSService _oSSService, [FromServices] IWebHostEnvironment _hostEnvironment)
|
||||
{
|
||||
var aliConfig = _oSSService.ObjectStoreServiceOptions.AliyunOSS;
|
||||
|
||||
var tempToken = _oSSService.GetObjectStoreTempToken();
|
||||
|
||||
var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint,
|
||||
tempToken.AliyunOSS.AccessKeyId,
|
||||
tempToken.AliyunOSS.AccessKeySecret,
|
||||
tempToken.AliyunOSS.SecurityToken);
|
||||
|
||||
|
||||
var allVersions = new List<ObjectVersionSummary>();
|
||||
var allDeleteMarkers = new List<DeleteMarkerSummary>();
|
||||
|
||||
var request = new ListObjectVersionsRequest(tempToken.AliyunOSS.BucketName)
|
||||
{
|
||||
Prefix = "test-delete-restore",
|
||||
//Prefix = "01000000-ac13-0242-6397-08dcd2d2a091/Image/08dd9c04-c1b2-c2da-0242-ac1301000000/01000000-ac13-0242-235b-08dd9c04c1b3",
|
||||
MaxKeys = 1000,
|
||||
};
|
||||
|
||||
ObjectVersionList result;
|
||||
do
|
||||
{
|
||||
|
||||
result = _ossClient.ListObjectVersions(request);
|
||||
|
||||
if (result.ObjectVersionSummaries != null)
|
||||
allVersions.AddRange(result.ObjectVersionSummaries);
|
||||
|
||||
if (result.DeleteMarkerSummaries != null)
|
||||
allDeleteMarkers.AddRange(result.DeleteMarkerSummaries);
|
||||
|
||||
request.KeyMarker = result.NextKeyMarker;
|
||||
request.VersionIdMarker = result.NextVersionIdMarker;
|
||||
|
||||
} while (result.IsTruncated);
|
||||
|
||||
Console.WriteLine($"共找到 {allDeleteMarkers.Count} 个删除标记");
|
||||
|
||||
var versionsByKey = allVersions
|
||||
.GroupBy(v => v.Key)
|
||||
.ToDictionary(g => g.Key, g => g.OrderByDescending(x => x.LastModified).ToList());
|
||||
|
||||
|
||||
foreach (var del in allDeleteMarkers)
|
||||
{
|
||||
#region 防止阿里云过期
|
||||
if (tempToken.AliyunOSS.Expiration.AddSeconds(10) <= DateTime.Now)
|
||||
{
|
||||
tempToken = _oSSService.GetObjectStoreTempToken();
|
||||
|
||||
_ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint,
|
||||
tempToken.AliyunOSS.AccessKeyId,
|
||||
tempToken.AliyunOSS.AccessKeySecret,
|
||||
tempToken.AliyunOSS.SecurityToken);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
if (!versionsByKey.TryGetValue(del.Key, out var versions))
|
||||
continue; // 没有历史版本无法恢复
|
||||
|
||||
var prevVersion = versions.FirstOrDefault(v => v.LastModified < del.LastModified);
|
||||
if (prevVersion == null)
|
||||
continue; // 没找到可恢复版本
|
||||
|
||||
|
||||
|
||||
|
||||
// 创建 CopyObject 请求
|
||||
// 先用构造函数指定源和目标
|
||||
var copyReq = new CopyObjectRequest(
|
||||
sourceBucketName: tempToken.AliyunOSS.BucketName,
|
||||
sourceKey: prevVersion.Key,
|
||||
destinationBucketName: tempToken.AliyunOSS.BucketName,
|
||||
destinationKey: prevVersion.Key // 覆盖到同名 Key,达到“恢复”的效果
|
||||
);
|
||||
|
||||
// 再设置版本号
|
||||
copyReq.SourceVersionId = prevVersion.VersionId;
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var copyResult = _ossClient.CopyObject(copyReq);
|
||||
Console.WriteLine($"✅ 恢复成功: {prevVersion.Key}, 新版本ID={copyResult.VersionId}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"❌ 恢复失败: {prevVersion.Key}, 错误: {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> UserCreateSourceDeal([FromServices] IRepository<IdentityUser> _identityUserRepository,
|
||||
[FromServices] IRepository<TrialUserRole> _trialUserRoleRepository)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -297,6 +297,11 @@ public class VisitTask : BaseFullAuditEntity
|
||||
[Comment("退回原因")]
|
||||
public string PMBackReason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看检查部位
|
||||
/// </summary>
|
||||
public bool IsViewStudyPart { get; set; } = false;
|
||||
|
||||
#region 完全随机增加字段
|
||||
|
||||
[Comment("完全随机阅片号")]
|
||||
|
||||
@@ -11,7 +11,19 @@ namespace IRaCIS.Core.Domain.Models
|
||||
[Table("AuditDocument")]
|
||||
public class AuditDocument : BaseFullAuditEntity
|
||||
{
|
||||
|
||||
// 0=自己, 1=直接子节点, 2=孙节点...
|
||||
[JsonIgnore]
|
||||
public List<AuditDocumentClosure> AncestorList { get; set; } = new List<AuditDocumentClosure>();
|
||||
|
||||
[JsonIgnore]
|
||||
public List<AuditDocumentClosure> DescendantList { get; set; } = new List<AuditDocumentClosure>();
|
||||
|
||||
[JsonIgnore]
|
||||
public List<AuditDocument> AuditDocumentOldVersionList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(MainFileId))]
|
||||
public AuditDocument MainAuditDocument { get; set; }
|
||||
/// <summary>
|
||||
/// 文件夹名或者文件名
|
||||
/// </summary>
|
||||
@@ -80,4 +92,110 @@ namespace IRaCIS.Core.Domain.Models
|
||||
HistoricalVersion = 2,
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 稽查文档闭包表
|
||||
/// </summary>
|
||||
public class AuditDocumentClosure : Entity
|
||||
{
|
||||
[JsonIgnore]
|
||||
|
||||
public AuditDocument Ancestor { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
public AuditDocument Descendant { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父Id
|
||||
/// </summary>
|
||||
[Comment("祖先")]
|
||||
public Guid AncestorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子Id
|
||||
/// </summary>
|
||||
[Comment("后代")]
|
||||
public Guid DescendantId { get; set; }
|
||||
public int Depth { get; set; } // 0=自己, 1=直接子节点, 2=孙节点...
|
||||
}
|
||||
|
||||
|
||||
public class AuditRecord : BaseFullAuditEntity
|
||||
{
|
||||
[JsonIgnore]
|
||||
public List<AuditRecordIdentityUser> AuditRecordIdentityUserList { get; set; }
|
||||
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
public string AuditContent { get; set; }
|
||||
|
||||
[Comment("稽查日期")]
|
||||
public DateOnly AuditTime { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginTime { get; set; }
|
||||
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
[Comment("稽查状态")]
|
||||
public AuditState AuditState { get; set; }
|
||||
|
||||
[Comment("稽查形式")]
|
||||
public AuditType AuditType { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class AuditRecordIdentityUser : BaseAddAuditEntity
|
||||
{
|
||||
[JsonIgnore]
|
||||
public IdentityUser IdentityUser { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public AuditRecord AuditRecord { get; set; }
|
||||
|
||||
|
||||
|
||||
public Guid IdentityUserId { get; set; }
|
||||
|
||||
public Guid AuditRecordId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class AuditRecordPermission : BaseAddAuditEntity
|
||||
{
|
||||
[JsonIgnore]
|
||||
public AuditRecord AuditRecord { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public AuditDocument AuditDocument { get; set; }
|
||||
|
||||
|
||||
public Guid AuditRecordId { get; set; }
|
||||
|
||||
|
||||
public Guid AuditDocumentId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public enum AuditState
|
||||
{
|
||||
NotStart = 0,
|
||||
|
||||
Ongoing = 1,
|
||||
|
||||
End = 2
|
||||
|
||||
}
|
||||
|
||||
public enum AuditType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Online = 1,
|
||||
|
||||
OnSite = 2
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public class DicomStudy : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
|
||||
public string BodyPartForEdit { get; set; } = null!;
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
public int Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -11,6 +11,11 @@ public class NoneDicomStudy : BaseFullDeleteAuditEntity
|
||||
[JsonIgnore]
|
||||
public List<NoneDicomStudyFile> TaskNoneDicomFileList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<NoneDicomStudyFile> ImageLabelNoneDicomFileList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public SubjectVisit SubjectVisit { get; set; }
|
||||
[JsonIgnore]
|
||||
@@ -53,5 +58,7 @@ public class NoneDicomStudy : BaseFullDeleteAuditEntity
|
||||
#endregion
|
||||
|
||||
public string ModifyReason { get; set; }
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,16 @@ public class NoneDicomStudyFile : BaseAddDeleteAuditEntity
|
||||
[ForeignKey("OriginNoneDicomStudyId")]
|
||||
[JsonIgnore]
|
||||
public NoneDicomStudy OriginNoneDicomStudy { get; set; }
|
||||
|
||||
|
||||
[ForeignKey("ImageLabelNoneDicomStudyId")]
|
||||
[JsonIgnore]
|
||||
public NoneDicomStudy ImageMarkNoneDicomStudy { get; set; }
|
||||
|
||||
|
||||
//[ForeignKey("ImageMarkSubjectVisitId")]
|
||||
//[JsonIgnore]
|
||||
//public SubjectVisit ImageMarkSubjectVisit { get; set; }
|
||||
#endregion
|
||||
public Guid NoneDicomStudyId { get; set; }
|
||||
|
||||
@@ -33,5 +43,13 @@ public class NoneDicomStudyFile : BaseAddDeleteAuditEntity
|
||||
[Comment("为了不影响原始检查,跟任务绑定的 NoneDicomStudyId 为guid空 这个字段记录跟原始检查绑")]
|
||||
public Guid? OriginNoneDicomStudyId { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
#region 影像预处理访视Id NoneDicomStudyId 为guid空
|
||||
|
||||
//public Guid? ImageMarkSubjectVisitId { get; set; }
|
||||
|
||||
public Guid? ImageLabelNoneDicomStudyId { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models;
|
||||
|
||||
[Comment("项目中心 - 影像推送记录")]
|
||||
@@ -21,4 +23,36 @@ public class SCPImageUpload : BaseAddAuditEntity
|
||||
public int StudyCount { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
[MaxLength]
|
||||
public string UploadJsonStr { get; set; }
|
||||
}
|
||||
|
||||
public class SCPImageLog
|
||||
{
|
||||
////当前传输 检查患者名字,一个检查可能患者名字不同 记录去重的,然后,拼接
|
||||
//public string PatientNames => string.Join(",", UploadList.SelectMany(t => t.PatientNameList).ToList());
|
||||
|
||||
/// <summary>
|
||||
/// 归档到数据库的检查Id
|
||||
/// </summary>
|
||||
public List<Guid> SCPStudyIdList => UploadList.Select(t => t.SCPStudyId).ToList();
|
||||
|
||||
|
||||
public List<ImageUploadInfo> UploadList { get; set; } = new List<ImageUploadInfo>();
|
||||
|
||||
}
|
||||
|
||||
public class ImageUploadInfo
|
||||
{
|
||||
public List<string> PatientNameList { get; set; } = new List<string>();
|
||||
|
||||
public Guid SCPStudyId { get; set; }
|
||||
|
||||
public string StudyInstanceUid { get; set; }
|
||||
|
||||
|
||||
public int FailedImageCount { get; set; }
|
||||
|
||||
public int SuccessImageCount { get; set; }
|
||||
}
|
||||
@@ -40,4 +40,20 @@ public class SCPInstance : BaseFullAuditEntity, IEntitySeqId
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
||||
public long? FileSize { get; set; }
|
||||
|
||||
|
||||
|
||||
#region DIR 增加
|
||||
|
||||
public string SOPClassUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPClassUID { get; set; }
|
||||
|
||||
public string TransferSytaxUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPInstanceUID { get; set; }
|
||||
|
||||
public bool IsEncapsulated { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -39,4 +39,11 @@ public class SCPSeries : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
[StringLength(1000)]
|
||||
public string ImageResizePath { get; set; } = string.Empty;
|
||||
|
||||
#region DIR 增加
|
||||
|
||||
public string DicomSeriesDate { get; set; }
|
||||
|
||||
public string DicomSeriesTime { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -64,4 +64,18 @@ public class SCPStudy : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
|
||||
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
|
||||
#region DIR 增加字段
|
||||
|
||||
public string DicomStudyDate { get; set; }
|
||||
|
||||
public string DicomStudyTime { get; set; }
|
||||
|
||||
public string StudyDIRPath { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@ public class TaskInstance : BaseFullAuditEntity, IEntitySeqId
|
||||
[JsonIgnore]
|
||||
[ForeignKey("StudyId")]
|
||||
public TaskStudy TaskStudy { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SubjectVisitId")]
|
||||
public SubjectVisit SubjectVisit { get; set; }
|
||||
#endregion
|
||||
|
||||
public Guid SeqId { get; set; }
|
||||
@@ -37,6 +42,8 @@ public class TaskInstance : BaseFullAuditEntity, IEntitySeqId
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public bool Anonymize { get; set; }
|
||||
public string Path { get; set; } = string.Empty;
|
||||
@@ -46,4 +53,19 @@ public class TaskInstance : BaseFullAuditEntity, IEntitySeqId
|
||||
|
||||
public long? FileSize { get; set; }
|
||||
|
||||
|
||||
#region DIR 增加
|
||||
|
||||
public string SOPClassUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPClassUID { get; set; }
|
||||
|
||||
public string TransferSytaxUID { get; set; }
|
||||
|
||||
public string MediaStorageSOPInstanceUID { get; set; }
|
||||
|
||||
public bool IsEncapsulated { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,16 @@ public class TaskSeries : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TaskInstance> InstanceList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SubjectVisitId")]
|
||||
public SubjectVisit SubjectVisit { get; set; }
|
||||
#endregion
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public Guid SeqId { get; set; }
|
||||
public Guid StudyId { get; set; }
|
||||
@@ -41,4 +48,12 @@ public class TaskSeries : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
[StringLength(1000)]
|
||||
public string ImageResizePath { get; set; } = string.Empty;
|
||||
|
||||
|
||||
#region DIR 增加
|
||||
|
||||
public string DicomSeriesDate { get; set; }
|
||||
|
||||
public string DicomSeriesTime { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -19,11 +19,18 @@ public class TaskStudy : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SubjectId")]
|
||||
public Subject Subject { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SubjectVisitId")]
|
||||
public SubjectVisit SubjectVisit { get; set; }
|
||||
#endregion
|
||||
|
||||
public Guid SeqId { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public int Code { get; set; } = 0;
|
||||
|
||||
@@ -54,4 +61,17 @@ public class TaskStudy : BaseFullDeleteAuditEntity, IEntitySeqId
|
||||
public string BodyPartForEdit { get; set; } = string.Empty;
|
||||
|
||||
public string ModalityForEdit { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
public string BodyPartForEditOther { get; set; }
|
||||
#region DIR 增加字段
|
||||
|
||||
public string DicomStudyDate { get; set; }
|
||||
|
||||
public string DicomStudyTime { get; set; }
|
||||
|
||||
public string StudyDIRPath { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -69,6 +69,10 @@ public class IdentityUser : BaseFullAuditEntity
|
||||
[JsonIgnore]
|
||||
public List<TrialIdentityUser> UserTrialList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
public List<AuditRecordIdentityUser> AuditRecordList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<UserRole> UserRoleList { get; set; } = new List<UserRole>();
|
||||
|
||||
|
||||
@@ -176,6 +176,16 @@ public class ReadingQuestionSystem : BaseAddAuditEntity
|
||||
[Comment("数据来源")]
|
||||
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
[Comment("最大答案长度")]
|
||||
public int? MaxAnswerLength { get; set; }
|
||||
|
||||
|
||||
@@ -238,7 +238,12 @@ public class ReadingQuestionTrial : BaseAddAuditEntity
|
||||
[Comment("数据来源")]
|
||||
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
[Comment("问题英文名称")]
|
||||
public string QuestionEnName { get; set; } = string.Empty;
|
||||
|
||||
@@ -130,6 +130,16 @@ public class ReadingTableQuestionSystem : BaseAddAuditEntity
|
||||
[Comment("数据来源")]
|
||||
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
[Comment("限制编辑")]
|
||||
public LimitEdit LimitEdit { get; set; } = LimitEdit.None;
|
||||
|
||||
@@ -167,6 +177,12 @@ public class ReadingTableQuestionSystem : BaseAddAuditEntity
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否预设
|
||||
/// </summary>
|
||||
public bool IsPreinstall { get; set; } = false;
|
||||
|
||||
[NotMapped]
|
||||
public List<ExportResult> ExportResult
|
||||
{
|
||||
|
||||
@@ -143,6 +143,16 @@ public class ReadingTableQuestionTrial : BaseAddAuditEntity
|
||||
[Comment("数据来源")]
|
||||
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 选项类型
|
||||
/// </summary>
|
||||
public OptionType OptionTypeEnum { get; set; } = OptionType.Defalut;
|
||||
|
||||
[Comment("最大答案长度")]
|
||||
public int? MaxAnswerLength { get; set; }
|
||||
|
||||
@@ -192,6 +202,11 @@ public class ReadingTableQuestionTrial : BaseAddAuditEntity
|
||||
/// </summary>
|
||||
public string ImageTool { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 是否预设
|
||||
/// </summary>
|
||||
public bool IsPreinstall { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 影像工具属性
|
||||
/// </summary>
|
||||
|
||||
@@ -10,12 +10,31 @@ public class ReadingTableAnswerRowInfo : BaseFullDeleteAuditEntity
|
||||
[JsonIgnore]
|
||||
[ForeignKey("InstanceId")]
|
||||
public DicomInstance Instance { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("VisitTaskId")]
|
||||
public VisitTask VisitTask { get; set; }
|
||||
[ForeignKey("SeriesId")]
|
||||
public DicomSeries DicomSeries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// studyId 关联 dicom 和非dicom ,这里为了查询方便,默认查询非dicom dicom 通过序列查询
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
[ForeignKey("StudyId")]
|
||||
public NoneDicomStudy NoneDicomStudy { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("OrganInfoId")]
|
||||
public OrganInfo OrganInfo { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("VisitTaskId")]
|
||||
public VisitTask VisitTask { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("FristAddTaskId")]
|
||||
public VisitTask FristAddTask { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey("SplitRowId")]
|
||||
public ReadingTableAnswerRowInfo SplitRow { get; set; }
|
||||
@@ -76,9 +95,6 @@ public class ReadingTableAnswerRowInfo : BaseFullDeleteAuditEntity
|
||||
[StringLength(1000)]
|
||||
public string PicturePath { get; set; } = string.Empty;
|
||||
|
||||
[Comment("第一次添加的任务ID")]
|
||||
public decimal FristAddTaskNum { get; set; } = 0;
|
||||
|
||||
[Comment("首次添加任务ID")]
|
||||
public Guid FristAddTaskId { get; set; }
|
||||
|
||||
|
||||
@@ -95,4 +95,7 @@ public class Subject : BaseFullDeleteAuditEntity
|
||||
|
||||
[Comment("受试者退出")]
|
||||
public bool IsSubjectQuit { get; set; }
|
||||
|
||||
[Comment("访视中止原因")]
|
||||
public string SuspendReason { get; set; }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ namespace IRaCIS.Core.Domain.Models;
|
||||
public class SubjectVisit : BaseFullDeleteAuditEntity
|
||||
{
|
||||
#region 导航属性
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TaskStudy> TaskStudyList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<TrialQCQuestionAnswer> TrialQCQuestionAnswerList { get; set; }
|
||||
|
||||
|
||||
@@ -106,17 +106,43 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (answerType == "upload")
|
||||
{
|
||||
return "❄❅❆❇❈❉❊" + answer;
|
||||
}
|
||||
|
||||
if (unit == ValueUnit.Custom)
|
||||
var answerList = new List<string>() { };
|
||||
|
||||
try
|
||||
{
|
||||
return answer + string.Empty + customUnit;
|
||||
answerList = JsonConvert.DeserializeObject<List<string>>(answer);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
answerList.Add(answer);
|
||||
}
|
||||
|
||||
return answer + string.Empty + unitDataList.Where(y => y.Unit == unit).Select(x => x.UnitName).FirstIsNullReturnEmpty();
|
||||
List<string> transList = new List<string>();
|
||||
foreach (var item in answerList)
|
||||
{
|
||||
if (unit == ValueUnit.Custom)
|
||||
{
|
||||
transList.Add(item + string.Empty + customUnit);
|
||||
}
|
||||
else
|
||||
{
|
||||
transList.Add(item + string.Empty + unitDataList.Where(y => y.Unit == unit).Select(x => x.UnitName).FirstIsNullReturnEmpty());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return string.Join(",", transList);
|
||||
|
||||
}
|
||||
public string GetEntityAuditOpt(EntityEntry entityEntry)
|
||||
{
|
||||
@@ -262,7 +288,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
var entity = item.Entity as ReadingImportFile;
|
||||
|
||||
|
||||
var visitTaskInfo = await _dbContext.VisitTask.Where(x => x.Id == entity.VisitTaskId).Include(x=>x.DoctorUser).FirstOrDefaultAsync();
|
||||
var visitTaskInfo = await _dbContext.VisitTask.Where(x => x.Id == entity.VisitTaskId).Include(x => x.DoctorUser).FirstOrDefaultAsync();
|
||||
|
||||
await InsertInspection<ReadingImportFile>(entity, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
@@ -2533,20 +2559,35 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
var extraIdentification = string.Empty;
|
||||
|
||||
Arm armEnum = Arm.SingleReadingArm;
|
||||
|
||||
Guid? subjectVisitId = null;
|
||||
|
||||
Arm? armEnum = Arm.SingleReadingArm;
|
||||
if (entity.VisitTaskId != null)
|
||||
{
|
||||
extraIdentification = "/VisitTask";
|
||||
armEnum = await _dbContext.VisitTask.Where(x => x.Id == entity.VisitTaskId).Select(x => x.ArmEnum).FirstOrDefaultAsync();
|
||||
var obj = await _dbContext.VisitTask.Where(x => x.Id == entity.VisitTaskId).Select(x => new { x.ArmEnum, x.SourceSubjectVisitId }).FirstOrDefaultAsync();
|
||||
armEnum = obj?.ArmEnum;
|
||||
subjectVisitId = obj.SourceSubjectVisitId;
|
||||
}
|
||||
else if (entity.ImageLabelNoneDicomStudyId != null)
|
||||
{
|
||||
//默认R0
|
||||
extraIdentification = "/VisitTask";
|
||||
|
||||
//var noneDicomStudy = await _dbContext.NoneDicomStudy.FindAsync(entity.NoneDicomStudyId);
|
||||
subjectVisitId = await _dbContext.NoneDicomStudy.Where(x => x.Id == entity.ImageLabelNoneDicomStudyId).Select(t => t.SubjectVisitId).FirstOrDefaultAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
subjectVisitId = (await _dbContext.NoneDicomStudy.FindAsync(entity.NoneDicomStudyId))?.SubjectVisitId;
|
||||
}
|
||||
|
||||
await InsertInspection<NoneDicomStudyFile>(item.Entity as NoneDicomStudyFile, type, x => new InspectionConvertDTO()
|
||||
{
|
||||
//SubjectVisitId = noneDicomStudy.SubjectVisitId,
|
||||
SubjectVisitId = subjectVisitId,
|
||||
//SubjectId = noneDicomStudy.SubjectId,
|
||||
ObjectRelationParentId = x.VisitTaskId,
|
||||
VisitTaskId= x.VisitTaskId,
|
||||
ObjectRelationParentId = subjectVisitId,
|
||||
ObjectRelationParentId2 = x.NoneDicomStudyId,
|
||||
ObjectRelationParentId3 = x.OriginNoneDicomStudyId,
|
||||
ExtraIndentification = extraIdentification
|
||||
@@ -3696,7 +3737,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
string questionName = string.Empty;
|
||||
string questionAnswer = string.Empty;
|
||||
if (thisQuestinonAnswer != null&& question!=null)
|
||||
if (thisQuestinonAnswer != null && question != null)
|
||||
{
|
||||
questionName = _userInfo.IsEn_Us ? question.QuestionEnName : question.QuestionName;
|
||||
questionAnswer = Translationunit(question.Type, question.Unit, question.CustomUnit, unitDataList, thisQuestinonAnswer.Answer);
|
||||
@@ -3857,9 +3898,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
|
||||
entity.OrderMark = await _dbContext.ReadingQuestionTrial.Where(x => x.Id == entity.QuestionId).Select(x => x.OrderMark).FirstOrDefaultAsync();
|
||||
|
||||
entity.RowMark = entity.OrderMark+ entity.RowIndex.GetLesionMark();
|
||||
|
||||
|
||||
entity.RowMark = entity.OrderMark + entity.RowIndex.GetLesionMark();
|
||||
|
||||
|
||||
string extraIdentification = string.Empty;
|
||||
@@ -4123,7 +4162,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure.Encryption;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Newtonsoft.Json;
|
||||
@@ -58,6 +59,9 @@ public class IRaCISDBContext : DbContext
|
||||
//configurationBuilder.Conventions.Add(_ => new DecimalPrecisionConvention(18,2));
|
||||
//针对字符串使用默认的长度配置为200,如果标注了StringLength 其他长度,就是标注的长度,如果标注了MaxLength 那么就是nvarcharMax
|
||||
configurationBuilder.Conventions.Add(_ => new DefaultStringLengthConvention(400));
|
||||
|
||||
//https://learn.microsoft.com/zh-cn/ef/core/modeling/relationships/conventions?utm_source=chatgpt.com
|
||||
//configurationBuilder.Conventions.Remove(typeof(ForeignKeyIndexConvention));
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
@@ -669,6 +673,14 @@ public class IRaCISDBContext : DbContext
|
||||
|
||||
|
||||
public virtual DbSet<SubjectVisitImageBackRecord> SubjectVisitImageBackRecord { get; set; }
|
||||
|
||||
|
||||
public virtual DbSet<AuditRecord> AuditRecord { get; set; }
|
||||
public virtual DbSet<AuditRecordIdentityUser> AuditRecordIdentityUser { get; set; }
|
||||
public virtual DbSet<AuditRecordPermission> AuditRecordPermission { get; set; }
|
||||
|
||||
public virtual DbSet<AuditDocumentClosure> AuditDocumentClosure { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
||||
{
|
||||
public class AuditDocumentConfigration : IEntityTypeConfiguration<AuditDocument>
|
||||
{
|
||||
|
||||
|
||||
public void Configure(EntityTypeBuilder<AuditDocument> builder)
|
||||
{
|
||||
|
||||
builder.HasMany(r => r.AncestorList).WithOne(t => t.Descendant).HasForeignKey(f => f.DescendantId);
|
||||
|
||||
builder.HasMany(r => r.DescendantList).WithOne(t => t.Ancestor).HasForeignKey(f => f.AncestorId);
|
||||
|
||||
|
||||
builder.HasMany(r => r.AuditDocumentOldVersionList).WithOne(t => t.MainAuditDocument).HasForeignKey(f => f.MainFileId);
|
||||
|
||||
|
||||
// builder.HasOne(r => r.WordFileRecord)
|
||||
//.WithOne(t => t.WordFileRecord)
|
||||
//.HasForeignKey<TrialFile>(t => t.WordFileRecordId)
|
||||
//.OnDelete(DeleteBehavior.Cascade);
|
||||
// builder.HasOne(r => r.PDFFileRecord).WithOne().HasForeignKey<TrialFile>(f => f.TrialFileTypeId);
|
||||
|
||||
// builder.HasOne(r => r.WordFileRecord).WithOne().HasForeignKey<TrialFile>(f => f.TrialFileTypeId);
|
||||
|
||||
// builder.HasOne(r => r.SignFileRecord).WithOne().HasForeignKey<TrialFile>(f => f.TrialFileTypeId);
|
||||
|
||||
// builder.HasOne(r => r.HistoryFileRecord).WithOne().HasForeignKey<TrialFile>(f => f.TrialFileTypeId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user