修改斑块明细表,增加单位-修改1
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d24d70365d
commit
9268aa5bc4
|
|
@ -699,7 +699,7 @@ public static class ExcelExportHelper
|
|||
}
|
||||
else
|
||||
{
|
||||
enumValues = JsonConvert.DeserializeObject<int[]>(itemValue)?? new int[0];
|
||||
enumValues = JsonConvert.DeserializeObject<int[]>(itemValue) ?? new int[0];
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -709,7 +709,7 @@ public static class ExcelExportHelper
|
|||
enumValues.Select(code =>
|
||||
dynamicTranslateDataList[itemDicName]
|
||||
.FirstOrDefault(t =>
|
||||
string.Equals(code.ToString(),t.Code, StringComparison.OrdinalIgnoreCase)
|
||||
string.Equals(code.ToString(), t.Code, StringComparison.OrdinalIgnoreCase)
|
||||
) is var r && r != null
|
||||
? (isEn_US ? r.Value : r.ValueCN)
|
||||
: string.Empty
|
||||
|
|
@ -718,7 +718,7 @@ public static class ExcelExportHelper
|
|||
else
|
||||
{
|
||||
|
||||
translatedItemData = dynamicTranslateDataList[itemDicName].Where(t => t.Code.ToLower() == itemValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
translatedItemData = dynamicTranslateDataList[itemDicName].Where(t => t.Code.ToLower() == itemValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -727,7 +727,19 @@ public static class ExcelExportHelper
|
|||
}
|
||||
else
|
||||
{
|
||||
row.GetCell(writeIndex).SetCellValue(itemValue);
|
||||
var unit = iteObjDic.ContainsKey("Unit") ? iteObjDic["Unit"]?.ToString() : null;
|
||||
|
||||
if (unit.IsNotNullOrEmpty() && unit == "9")
|
||||
{
|
||||
row.GetCell(writeIndex).SetCellValue(itemValue + "%");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
row.GetCell(writeIndex).SetCellValue(itemValue);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -498,11 +498,14 @@ public class OSSService : IOSSService
|
|||
|
||||
var result = _ossClient.GetObject(aliConfig.BucketName, ossRelativePath);
|
||||
|
||||
// 将OSS返回的流复制到内存流中并返回
|
||||
var memoryStream = new MemoryStream();
|
||||
await result.Content.CopyToAsync(memoryStream);
|
||||
memoryStream.Position = 0; // 重置位置以便读取
|
||||
return memoryStream;
|
||||
// 直接返回流
|
||||
return result.Content;
|
||||
|
||||
//// 将OSS返回的流复制到内存流中并返回
|
||||
//var memoryStream = new MemoryStream();
|
||||
//await result.Content.CopyToAsync(memoryStream);
|
||||
//memoryStream.Position = 0; // 重置位置以便读取
|
||||
//return memoryStream;
|
||||
}
|
||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
|
||||
{
|
||||
|
|
@ -513,17 +516,31 @@ public class OSSService : IOSSService
|
|||
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey)
|
||||
.WithSSL(minIOConfig.UseSSL)
|
||||
.Build();
|
||||
|
||||
var pipe = new System.IO.Pipelines.Pipe();
|
||||
|
||||
var memoryStream = new MemoryStream();
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var args = new GetObjectArgs()
|
||||
.WithBucket(minIOConfig.BucketName)
|
||||
.WithObject(ossRelativePath)
|
||||
.WithCallbackStream(stream =>
|
||||
{
|
||||
stream.CopyTo(pipe.Writer.AsStream());
|
||||
});
|
||||
|
||||
var getObjectArgs = new GetObjectArgs()
|
||||
.WithBucket(minIOConfig.BucketName)
|
||||
.WithObject(ossRelativePath)
|
||||
.WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
|
||||
await minioClient.GetObjectAsync(args);
|
||||
await pipe.Writer.CompleteAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await pipe.Writer.CompleteAsync(ex);
|
||||
}
|
||||
});
|
||||
|
||||
await minioClient.GetObjectAsync(getObjectArgs);
|
||||
memoryStream.Position = 0;
|
||||
return memoryStream;
|
||||
return pipe.Reader.AsStream();
|
||||
}
|
||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
|
||||
{
|
||||
|
|
@ -551,10 +568,13 @@ public class OSSService : IOSSService
|
|||
|
||||
var response = await amazonS3Client.GetObjectAsync(getObjectRequest);
|
||||
|
||||
var memoryStream = new MemoryStream();
|
||||
await response.ResponseStream.CopyToAsync(memoryStream);
|
||||
memoryStream.Position = 0;
|
||||
return memoryStream;
|
||||
// ⭐ 直接返回流
|
||||
return response.ResponseStream;
|
||||
|
||||
//var memoryStream = new MemoryStream();
|
||||
//await response.ResponseStream.CopyToAsync(memoryStream);
|
||||
//memoryStream.Position = 0;
|
||||
//return memoryStream;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2350,7 +2350,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
{
|
||||
list.Add(new ExportDocumentDes() { Code = StaticData.Export.IVUS_CDISC_Export, ExportCatogory = ExportResult.IVUS_CDISC_Export });
|
||||
}
|
||||
//else if (criterion.CriterionType == CriterionType.SelfDefine)
|
||||
if (criterion.CriterionGroup != CriterionGroup.Tumor && criterion.CriterionType != CriterionType.OCT && criterion.CriterionType != CriterionType.IVUS)
|
||||
{
|
||||
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CDISC_Reading_Export, ExportCatogory = ExportResult.CDISC });
|
||||
}
|
||||
|
|
@ -2479,7 +2479,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
//阅片结果表
|
||||
export_Template = StaticData.Export.CommonReading_Export;
|
||||
}
|
||||
|
||||
//斑块表
|
||||
else if (inQuery.ReadingExportType == ExportResult.OCT_ReadingLession_Export)
|
||||
{
|
||||
//OCT
|
||||
|
|
@ -2746,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, OptionTypeEnum = t.OptionTypeEnum, 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 ,Unit=t.Unit});
|
||||
|
||||
//有三部分组成 外层问题+ 没有配置病灶编号和类型+ 动态的表格问题
|
||||
var dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
|
|
@ -2894,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, OptionTypeEnum = t.OptionTypeEnum, 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, Unit = t.Unit });
|
||||
|
||||
//有三部分组成 外层问题+ 固定列表格名称 + 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(addLessionInfoList).Union(dynamicPartialLessionInfoList).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
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 });
|
||||
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, Unit = t.Unit });
|
||||
|
||||
//两部分组成 外层问题+ 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
|
||||
|
|
@ -2948,7 +2948,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
|||
TranslateDicNameList = translateDicNameList
|
||||
};
|
||||
|
||||
if (export_Template == StaticData.Export.ReadingLession_Export || export_Template == StaticData.Export.CommonJudgeReadingDetail_Export)
|
||||
if (export_Template == StaticData.Export.ReadingLession_Export || export_Template == StaticData.Export.CommonJudgeReadingDetail_Export || export_Template== StaticData.Export.OCT_ReadingLession_Export)
|
||||
{
|
||||
dynamicColumnConfig.TempalteLastColumnIndex = 8;
|
||||
}
|
||||
|
|
@ -3011,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,OptionTypeEnum=t.OptionTypeEnum, 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, Unit = t.Unit });
|
||||
|
||||
//两部分组成 外层问题+ 动态的表格问题
|
||||
dynamicLessionInfoList = item.QuestionAnswerList.Union(dynamicPartialLessionInfoList).ToList();
|
||||
|
|
|
|||
|
|
@ -1248,6 +1248,8 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public OptionType OptionTypeEnum { get; set; }
|
||||
|
||||
public ValueUnit? Unit { get; set; }
|
||||
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
public string QuestionName { get; set; }
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.OrderBy(k => k.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(c => new CommonQuesionInfo()
|
||||
{
|
||||
Unit=c.ReadingQuestionTrial.Unit,
|
||||
OptionTypeEnum=c.ReadingQuestionTrial.OptionTypeEnum,
|
||||
QuestionType = c.ReadingQuestionTrial.QuestionType,
|
||||
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
|
||||
|
|
@ -285,6 +286,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
.OrderBy(k => k.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(c => new CommonQuesionInfo()
|
||||
{
|
||||
Unit=c.ReadingQuestionTrial.Unit,
|
||||
Group = isEn_Us ? c.ReadingQuestionTrial.GroupEnName : c.ReadingQuestionTrial.GroupName,
|
||||
QuestionType = c.ReadingQuestionTrial.QuestionType,
|
||||
OptionTypeEnum=c.ReadingQuestionTrial.OptionTypeEnum,
|
||||
QuestionId = c.ReadingQuestionTrial.Id,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ using SixLabors.ImageSharp.Processing;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
|
|
@ -74,6 +75,91 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
public static int IntValue = 100;
|
||||
|
||||
|
||||
public async Task<IResponseOutput> DealIVUSOCTDicomTag(string subjectCode, bool isUploadOss)
|
||||
{
|
||||
var trialId = Guid.Parse("01000000-AC13-0242-3AE4-08DC9B0495C6");
|
||||
|
||||
var trialCode = "ZY2024002";
|
||||
|
||||
//var subjectCodeList = new List<string>() { "04032", "12004", "04005" };
|
||||
|
||||
var list = await _dicomInstanceRepository.Where(t => t.TrialId == trialId && t.DicomStudy.SubjectVisit.IsBaseLine)
|
||||
.Where(t => t.DicomStudy.Subject.Code== subjectCode)
|
||||
.WhereIf(subjectCode == "04032", t => t.DicomStudy.ModalityForEdit == "OCT")
|
||||
.WhereIf(subjectCode == "12004", t => t.DicomStudy.ModalityForEdit == "IVUS")
|
||||
.WhereIf(subjectCode == "04005 ", t => t.DicomStudy.ModalityForEdit == "IVUS" || t.DicomStudy.ModalityForEdit == "OCT")
|
||||
.Select(t => new
|
||||
{
|
||||
SubjectCode = t.DicomStudy.Subject.Code,
|
||||
t.DicomStudy.ModalityForEdit,
|
||||
t.Path
|
||||
}).ToListAsync();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
|
||||
var stream = await _IOSSService.GetStreamFromOSSAsync(item.Path);
|
||||
|
||||
var dicomFile = DicomFile.Open(stream);
|
||||
|
||||
switch (item.SubjectCode)
|
||||
{
|
||||
case "04032":
|
||||
|
||||
dicomFile.Dataset.AddOrUpdate(DicomTag.PatientID, $"{trialCode}_04032");
|
||||
dicomFile.Dataset.AddOrUpdate(DicomTag.ClinicalTrialSubjectID, "04032");
|
||||
|
||||
break;
|
||||
case "12004":
|
||||
dicomFile.Dataset.AddOrUpdate(DicomTag.PatientID, $"{trialCode}_12004");
|
||||
dicomFile.Dataset.AddOrUpdate(DicomTag.ClinicalTrialSubjectID, "12004");
|
||||
break;
|
||||
|
||||
case "04005":
|
||||
dicomFile.Dataset.AddOrUpdate(DicomTag.PatientID, $"{trialCode}_04005");
|
||||
dicomFile.Dataset.AddOrUpdate(DicomTag.ClinicalTrialSubjectID, "04005");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//获取原始目录 和文件名
|
||||
var folder = item.Path.Substring(0, item.Path.LastIndexOf('/')).TrimStart('/');
|
||||
var fileName = Path.GetFileName(item.Path);
|
||||
|
||||
|
||||
// 4 保存到一个 MemoryStream
|
||||
await using var output = new MemoryStream();
|
||||
dicomFile.Save(output);
|
||||
output.Position = 0;
|
||||
|
||||
|
||||
if (isUploadOss == false)
|
||||
{
|
||||
// 本地完整路径
|
||||
var localPath = Path.Combine(Directory.GetCurrentDirectory(), fileName);
|
||||
|
||||
// 写入文件
|
||||
await using var fileStream = File.Create(localPath);
|
||||
await output.CopyToAsync(fileStream);
|
||||
|
||||
// 可选:确保写入完成再关闭
|
||||
await fileStream.FlushAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _IOSSService.UploadToOSSAsync(output, folder, fileName, false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重建闭包表
|
||||
/// </summary>
|
||||
|
|
@ -529,7 +615,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
continue; // 没找到可恢复版本
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue