Test.EIImageViewer
he 2023-03-03 17:06:38 +08:00
commit 2a7280b501
10 changed files with 55 additions and 22 deletions

View File

@ -3,6 +3,7 @@
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using Microsoft.AspNetCore.Hosting;
using System.Text.RegularExpressions;
namespace IRaCIS.Core.Application.Helper;
@ -25,6 +26,14 @@ public static class FileStoreHelper
fileName = fileName.Split("/").Last();
}
var matchResult = Regex.Match(fileName, @"[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}");
//如果有guid
if (matchResult.Success)
{
fileName = fileName.Replace($"{matchResult.Value}", "");
}
var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileName;
return (trustedFileNameForFileStorage, fileName);

View File

@ -1,7 +1,9 @@
using IRaCIS.Core.Domain.Share;
using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Core.Domain.Share;
using MailKit;
using MailKit.Security;
using MimeKit;
using NPOI.HPSF;
namespace IRaCIS.Core.Application.Helper;
@ -40,10 +42,10 @@ public static class SendEmailHelper
catch (Exception ex)
{
throw new Exception("邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员") ;
throw new Exception("邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员");
}
}
public static async Task SendEmailAsync(SMTPEmailConfig sMTPEmailConfig, EventHandler<MessageSentEventArgs>? messageSentSuccess = null)
@ -88,10 +90,19 @@ public static class SendEmailHelper
{
//builder.Attachments.Add(item.FileName, item.FileData);
builder.Attachments.Add(item.FileName, item.FileStream);
var attachment = builder.Attachments.Add(item.FileName, item.FileStream);
//解决附件名过长 奇怪的名字
foreach (var param in attachment.ContentDisposition.Parameters)
param.EncodingMethod = ParameterEncodingMethod.Rfc2047;
foreach (var param in attachment.ContentType.Parameters)
param.EncodingMethod = ParameterEncodingMethod.Rfc2047;
}
messageToSend.Body = builder.ToMessageBody();
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
@ -113,7 +124,7 @@ public static class SendEmailHelper
await smtp.DisconnectAsync(true);
}
}
}
@ -123,12 +134,12 @@ public static class SendEmailHelper
public class SMTPEmailConfig
{
public int Port { get; set; }
public int Port { get; set; }
public string Host { get; set; }
public string UserName { get; set; }
public string UserName { get; set; }
public string AuthorizationCode { get; set; }

View File

@ -92,7 +92,7 @@ namespace IRaCIS.Core.Application.Service
{
//找到一致性核查通过且没有产生任务的访视
var needGenerateVisit = await _subjectVisitRepository.Where(t => t.TrialId == trialId && t.CheckState == CheckStateEnum.CVPassed &&
!t.VisitTaskList.Any(u => u.TrialReadingCriterionId == confirmedTrialReadingCriterionId && u.SourceSubjectVisitId == t.Id)).ToListAsync();
!t.VisitTaskList.Any(u => u.TrialReadingCriterionId == confirmedTrialReadingCriterionId && u.SourceSubjectVisitId == t.Id && u.TaskState==TaskState.Effect && u.IsAnalysisCreate==false)).ToListAsync();
var trialReadingCriterionConfig = await _trialReadingCriterionRepository.Where(t => t.Id == confirmedTrialReadingCriterionId).Select(t => new { TrialReadingCriterionId = t.Id, t.ReadingTool, t.ReadingType, t.IsReadingTaskViewInOrder, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, t.CriterionType }).FirstOrDefaultAsync();

View File

@ -785,7 +785,7 @@ namespace IRaCIS.Core.Application.Service
["TrialSiteCode"] = taskInfo.TrialSiteCode,
["SubjectCode"] = taskInfo.SubjectCode,
["VisitName"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitName : taskInfo.ModuleVisitName,
["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate : taskInfo.ModuleEarliestScanDate,
["EarliestScanDate"] = taskInfo.SourceSubjectVisitId != null ? taskInfo.VisitEarliestScanDate?.ToString("yyyy-MM-DD") : taskInfo.ModuleEarliestScanDate?.ToString("yyyy-MM-DD"),
["SignTime"] = taskInfo.SignTime,
["Result"] = answer

View File

@ -162,21 +162,32 @@ namespace IRaCIS.Core.Application.Services
var samplesPerPixel = dataset.GetSingleValueOrDefault(DicomTag.SamplesPerPixel, string.Empty);
var photometricInterpretation = dataset.GetSingleValueOrDefault(DicomTag.PhotometricInterpretation, string.Empty);
if (samplesPerPixel == "1" && (photometricInterpretation.ToUpper() == "MONOCHROME2" || photometricInterpretation.ToUpper() == "MONOCHROME1"))//MONOCHROME2
{
if (dataset.InternalTransferSyntax.IsEncapsulated)
{
//正常保存 不做处理
await dicomFile.SaveAsync(physicalPath);
}
else
{
{ //JPEGLSLossless 保存
await dicomFile.Clone(DicomTransferSyntax.JPEGLSLossless).SaveAsync(physicalPath);
}
}
else
{
if (dataset.InternalTransferSyntax.IsEncapsulated) await dicomFile.SaveAsync(physicalPath);
else await dicomFile.Clone(DicomTransferSyntax.RLELossless).SaveAsync(physicalPath); //RLELossless
if (dataset.InternalTransferSyntax.IsEncapsulated)
{
//正常保存 不做处理
await dicomFile.SaveAsync(physicalPath);
}
else
{
//RLELossless 保存
await dicomFile.Clone(DicomTransferSyntax.RLELossless).SaveAsync(physicalPath); //RLELossless
}
}
return (dicomInstance.StudyId, dicomStudy.StudyCode);
}

View File

@ -151,7 +151,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
public async Task<PageOutput<UnionStudyMonitorModel>> GetDicomAndNoneDicomStudyMonitorList(StudyQuery studyQuery)
{
var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(studyQuery.VisitPlanArray);
var StudyMonitorQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId)
var StudyMonitorQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId,ignoreQueryFilters:true)
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression)

View File

@ -792,7 +792,7 @@ namespace IRaCIS.Core.Application.Image.QA
var success3 = await _dicomSeriesrepository.BatchDeleteNoTrackingAsync(t => t.StudyId == id);
//var success3 = await _dicomSeriesrepository.DeleteFromQueryAsync(t => t.StudyId == id, true);
var success4 = await _repository.BatchDeleteAsync<StudyMonitor>(t => t.StudyId == id);
//var success4 = await _repository.BatchDeleteAsync<StudyMonitor>(t => t.StudyId == id);
//删除 物理文件
@ -1195,7 +1195,7 @@ namespace IRaCIS.Core.Application.Image.QA
// CRC 上传的基线数据签名
await _readingClinicalDataRepository.BatchUpdateNoTrackingAsync(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == dbSubjectVisit.Id, x => new ReadingClinicalData()
await _readingClinicalDataRepository.UpdatePartialFromQueryAsync(x => x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == dbSubjectVisit.Id && x.IsSign==false, x => new ReadingClinicalData()
{
IsSign = true,
ReadingClinicalDataState = ReadingClinicalDataStatus.HaveSigned

View File

@ -25,15 +25,10 @@ namespace IRaCIS.Core.Domain.Models
public Guid CreateUserId { get; set; }
//可能是Dicom 也可能是非Dicom
//可能是Dicom 也可能是非Dicom 该字段废弃
public Guid StudyId { get; set; }
//public int TotalMillisecondsInterval { get; set; }
public DateTime UploadStartTime { get; set; }

View File

@ -960,6 +960,13 @@ update TrialEmailNoticeConfig set FileName='入组确认报告.docx' where FileN
-- 出现质疑未关闭 但是实际所有质疑都关闭了(不存在 未关闭的质疑)
select * from SubjectVisit where ChallengeState=2 and not EXISTS(select * from QCChallenge where SubjectVisitId=SubjectVisit.Id and IsClosed=0)
update SubjectVisit set ChallengeState=1 where ChallengeState=2 and not EXISTS(select * from QCChallenge where SubjectVisitId=SubjectVisit.Id and IsClosed=0)
update TrialEmailNoticeConfig set FileName='入组确认报告.docx' where FileName='ECR_v1.0_Final.docx'
----------------------------------------

View File

@ -1696,7 +1696,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
IsDistinctionInterface = type == AuditOpt.Update ? true : false,
//SubjectVisitId = x.IsVisit ? x.ReadingId : null,
SubjectVisitId = x.IsVisit ? x.ReadingId : null,
ObjectRelationParentId = entity.ClinicalDataTrialSetId,