Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
						commit
						c88b83bb6b
					
				| 
						 | 
				
			
			@ -12,7 +12,7 @@ public static class FileStoreHelper
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    //处理文件名  压缩包,或者目录类的  会带上相对路径
 | 
			
		||||
    public static (string TrustedFileNameForFileStorage, string RealName) GetStoreFileName(string fileName)
 | 
			
		||||
    public static (string TrustedFileNameForFileStorage, string RealName) GetStoreFileName(string fileName,bool isChangeToPdfFormat=false)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        //带目录层级,需要后端处理前端的路径
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,18 @@ public static class FileStoreHelper
 | 
			
		|||
            fileName = fileName.Replace($"{matchResult.Value}", "");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileName;
 | 
			
		||||
 | 
			
		||||
        var trustedFileNameForFileStorage = string.Empty;
 | 
			
		||||
 | 
			
		||||
        if (isChangeToPdfFormat==false)
 | 
			
		||||
        {
 | 
			
		||||
            trustedFileNameForFileStorage= Guid.NewGuid().ToString() + fileName;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            trustedFileNameForFileStorage=Guid.NewGuid().ToString() + Path.GetFileNameWithoutExtension(fileName) + ".pdf";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return (trustedFileNameForFileStorage, fileName);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +431,7 @@ public static class FileStoreHelper
 | 
			
		|||
 | 
			
		||||
    // 获取 入组确认 PD 进展发送邮件Word|PDF 存放路径
 | 
			
		||||
 | 
			
		||||
    public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteId, Guid subjectId)
 | 
			
		||||
    public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteId, Guid subjectId,bool isChangeToPdfFormat=false)
 | 
			
		||||
    {
 | 
			
		||||
        var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -428,7 +439,7 @@ public static class FileStoreHelper
 | 
			
		|||
 | 
			
		||||
        if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
 | 
			
		||||
 | 
			
		||||
        var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName);
 | 
			
		||||
        var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName, isChangeToPdfFormat);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{trustedFileNameForFileStorage}";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,6 +74,7 @@
 | 
			
		|||
		</PackageReference>
 | 
			
		||||
		<PackageReference Include="fo-dicom.Drawing" Version="4.0.8" />
 | 
			
		||||
		<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.0.3" />
 | 
			
		||||
		<PackageReference Include="FreeSpire.Doc" Version="10.8.0" />
 | 
			
		||||
		<PackageReference Include="Hangfire" Version="1.7.31">
 | 
			
		||||
		  <TreatAsUsed>true</TreatAsUsed>
 | 
			
		||||
		</PackageReference>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -87,7 +87,7 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
               .WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum)
 | 
			
		||||
               .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false))
 | 
			
		||||
               .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
 | 
			
		||||
               .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode))
 | 
			
		||||
                .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate))
 | 
			
		||||
               .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
 | 
			
		||||
               .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1))
 | 
			
		||||
               .ProjectTo<AnalysisTaskView>(_mapper.ConfigurationProvider);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1034,8 +1034,9 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
                                                                                TaskAllocationState = TaskAllocationState.Allocated,
 | 
			
		||||
                                                                                AllocateTime = DateTime.Now,
 | 
			
		||||
                                                                                DoctorUserId = singleTask.DoctorUserId,
 | 
			
		||||
                                                                                SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget),
 | 
			
		||||
 | 
			
		||||
                                                                                TrialReadingCriterionId = latestTask.TrialReadingCriterionId,
 | 
			
		||||
                                                                            TrialReadingCriterionId = latestTask.TrialReadingCriterionId,
 | 
			
		||||
                                                                                IsNeedClinicalDataSign = latestTask.IsNeedClinicalDataSign,
 | 
			
		||||
                                                                                IsClinicalDataSign = latestTask.IsClinicalDataSign
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ using System.Linq.Dynamic.Core;
 | 
			
		|||
using System.Linq;
 | 
			
		||||
using DocumentFormat.OpenXml.Bibliography;
 | 
			
		||||
using Org.BouncyCastle.Crypto;
 | 
			
		||||
using IRaCIS.Core.Domain.Share.Reading;
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -185,7 +186,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
                            DoctorUserId = doctorArm.DoctorUserId,
 | 
			
		||||
                            TaskAllocationState = TaskAllocationState.Allocated,
 | 
			
		||||
 | 
			
		||||
                            SuggesteFinishedTime = DateTime.Now.AddDays(7),
 | 
			
		||||
                            SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget),
 | 
			
		||||
                        });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -322,7 +323,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
                visitTask.DoctorUserId = assignSubjectTaskToDoctorCommand.DoctorUserId;
 | 
			
		||||
                visitTask.TaskAllocationState = TaskAllocationState.Allocated;
 | 
			
		||||
 | 
			
		||||
                visitTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
 | 
			
		||||
                visitTask.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -588,7 +589,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
                        task.AllocateTime = DateTime.Now;
 | 
			
		||||
                        task.TaskAllocationState = TaskAllocationState.Allocated;
 | 
			
		||||
 | 
			
		||||
                        task.SuggesteFinishedTime = task.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7);
 | 
			
		||||
                        task.SuggesteFinishedTime = /*task.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7)*/   GetSuggessFinishTime(true, UrgentType.NotUrget);
 | 
			
		||||
 | 
			
		||||
                        await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == task.SourceSubjectVisitId, u => new SubjectVisit() { ReadingStatus = ReadingStatusEnum.ImageReading });
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -712,7 +713,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
        /// <param name="queryVisitTask"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<PageOutput<ReadingTaskView>/*, object?)*/> GetReadingTaskList(VisitTaskQuery queryVisitTask)
 | 
			
		||||
        public async Task<(PageOutput<ReadingTaskView>, object?)> GetReadingTaskList(VisitTaskQuery queryVisitTask)
 | 
			
		||||
        {
 | 
			
		||||
            var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false)
 | 
			
		||||
               //.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null)
 | 
			
		||||
| 
						 | 
				
			
			@ -742,9 +743,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
 | 
			
		||||
            var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray);
 | 
			
		||||
 | 
			
		||||
            //var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo<TrialTaskConfigView>(_mapper.ConfigurationProvider).FirstOrDefault();
 | 
			
		||||
            var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo<TrialUrgentConfig>(_mapper.ConfigurationProvider).FirstOrDefault();
 | 
			
		||||
 | 
			
		||||
            return pageList;
 | 
			
		||||
            return (pageList,trialTaskConfig);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1381,6 +1382,14 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DateTime GetSuggessFinishTime(bool isInOrder, UrgentType urgentType)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            var datetime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 7, 22, 0, 0);
 | 
			
		||||
 | 
			
		||||
            return datetime;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 确认重阅与否  1同意 2 拒绝
 | 
			
		||||
        /// </summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -1744,7 +1753,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
                                                newTask.DoctorUserId = origenalTask.DoctorUserId;
 | 
			
		||||
                                                newTask.TaskAllocationState = TaskAllocationState.Allocated;
 | 
			
		||||
                                                newTask.AllocateTime = DateTime.Now;
 | 
			
		||||
                                                newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
 | 
			
		||||
                                                newTask.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
 | 
			
		||||
 | 
			
		||||
                                                //拷贝后续表单
 | 
			
		||||
                                                if (visitTaskReReadingAppply.IsCopyFollowForms && origenalTask.VisitTaskNum != influenceTask.VisitTaskNum)
 | 
			
		||||
| 
						 | 
				
			
			@ -1856,7 +1865,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
 | 
			
		|||
                                newTask.DoctorUserId = origenalTask.DoctorUserId;
 | 
			
		||||
                                newTask.TaskAllocationState = TaskAllocationState.Allocated;
 | 
			
		||||
                                newTask.AllocateTime = DateTime.Now;
 | 
			
		||||
                                newTask.SuggesteFinishedTime = DateTime.Now.AddDays(7);
 | 
			
		||||
                                newTask.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                //裁判任务 需要进行特殊处理  在重阅逻辑里面处理
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ using IRaCIS.Core.Application.Service.Reading.Dto;
 | 
			
		|||
using IRaCIS.Core.Domain.Share.Common;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Spire.Doc;
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Core.Application.Service
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -770,10 +771,11 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
 | 
			
		||||
                var phyPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, sendFileRelativePath);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                //先预先生成了邮件,发送预先生成的邮件
 | 
			
		||||
                sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
 | 
			
		||||
                {
 | 
			
		||||
                    FileName = $"{taskInfo.SubjectCode}_{emailConfig.FileName}",
 | 
			
		||||
                    FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(emailConfig.FileName)}.pdf",
 | 
			
		||||
 | 
			
		||||
                    FileStream = File.OpenRead(phyPath),
 | 
			
		||||
                });
 | 
			
		||||
| 
						 | 
				
			
			@ -797,11 +799,21 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId);
 | 
			
		||||
            var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId,true);
 | 
			
		||||
 | 
			
		||||
            if (emailStoreMode == EmailStoreSendMode.StoreLocalSend || emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
 | 
			
		||||
            {
 | 
			
		||||
                MiniSoftware.MiniWord.SaveAsByTemplate(serverFilePath, path, value);
 | 
			
		||||
 | 
			
		||||
                MemoryStream wordMemoryStream = new MemoryStream();
 | 
			
		||||
 | 
			
		||||
                Document document = new Document();
 | 
			
		||||
 | 
			
		||||
                MiniSoftware.MiniWord.SaveAsByTemplate(wordMemoryStream, path, value);
 | 
			
		||||
 | 
			
		||||
                document.LoadFromStream(wordMemoryStream,FileFormat.Docx);
 | 
			
		||||
 | 
			
		||||
                document.SaveToFile(serverFilePath, FileFormat.PDF);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            //手动生成发送的邮件内容,但是并不发送
 | 
			
		||||
| 
						 | 
				
			
			@ -819,16 +831,21 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
                MemoryStream memoryStream = new MemoryStream();
 | 
			
		||||
                MemoryStream pdfMemoryStream = new MemoryStream();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                MiniSoftware.MiniWord.SaveAsByTemplate(memoryStream, path, value);
 | 
			
		||||
                Document document = new Document();
 | 
			
		||||
 | 
			
		||||
                memoryStream.Seek(0, SeekOrigin.Begin);
 | 
			
		||||
                document.LoadFromStream(memoryStream, FileFormat.Docx);
 | 
			
		||||
                document.SaveToStream(pdfMemoryStream, FileFormat.PDF);
 | 
			
		||||
                pdfMemoryStream.Seek(0, SeekOrigin.Begin);
 | 
			
		||||
 | 
			
		||||
                sendEmailConfig.EmailAttachMentConfigList.Add(new EmailAttachMentConfig()
 | 
			
		||||
                {
 | 
			
		||||
                    FileName = $"{taskInfo.SubjectCode}_{emailConfig.FileName}",
 | 
			
		||||
                    FileName = $"{taskInfo.SubjectCode}_{Path.GetFileNameWithoutExtension(emailConfig.FileName)}.pdf",
 | 
			
		||||
 | 
			
		||||
                    FileStream = memoryStream
 | 
			
		||||
                    FileStream = pdfMemoryStream
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -183,6 +183,7 @@ namespace IRaCIS.Core.Application.Service
 | 
			
		|||
            CreateMap<Trial, TrialSelectDTO>();
 | 
			
		||||
 | 
			
		||||
            CreateMap<TrialUrgentConfig, Trial>();
 | 
			
		||||
            CreateMap<Trial, TrialUrgentConfig > ().ForMember(t=>t.TrialId,u=>u.MapFrom(c=>c.Id));
 | 
			
		||||
 | 
			
		||||
            CreateMap<SignDTO, TrialSign>();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue