Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

Test_IRC_Net8
hang 2025-11-19 10:24:46 +08:00
commit 17e0517e5b
44 changed files with 22103 additions and 2193 deletions

View File

@ -66,7 +66,7 @@
"SystemEmailSendConfig": {
"Port": 587,
"Host": "smtp-mail.outlook.com",
"Imap": "imap.qiye.aliyun.com",
"Imap": "imap-mail.outlook.com",
"FromEmail": "donotreply@elevateimaging.ai",
"FromName": "LiLi System",
"AuthorizationCode": "Q#669869497420ul",

View File

@ -74,7 +74,7 @@
"SystemEmailSendConfig": {
"Port": 587,
"Host": "smtp-mail.outlook.com",
"Imap": "imap.qiye.aliyun.com",
"Imap": "imap-mail.outlook.com",
"FromEmail": "donotreply@elevateimaging.ai",
"FromName": "LiLi System",
"AuthorizationCode": "Q#669869497420ul",

View File

@ -73,7 +73,7 @@
"SystemEmailSendConfig": {
"Port": 587,
"Host": "smtp-mail.outlook.com",
"Imap": "imap.qiye.aliyun.com",
"Imap": "imap-mail.outlook.com",
"FromEmail": "donotreply@elevateimaging.ai",
"FromName": "LiLi System",
"AuthorizationCode": "Q#669869497420ul",

View File

@ -55,6 +55,20 @@ public static class SendEmailHelper
}
/// <summary>
/// 设置发送邮箱
/// </summary>
/// <param name="messageToSend"></param>
/// <param name="senderName"></param>
public static void ChangeEmailSenderName(MimeMessage messageToSend, string senderName)
{
var fromAddress = messageToSend.From.Mailboxes.FirstOrDefault();
if (fromAddress != null)
{
messageToSend.From.Clear();
messageToSend.From.Add(new MailboxAddress(senderName, fromAddress.Address));
}
}
public static async Task<bool> TestEmailConfigAsync(SystemEmailSendConfig _systemEmailConfig)
{
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)))

View File

@ -3585,6 +3585,22 @@
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetReadingReportQuestion(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.VisitTaskInfo},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.Globalanswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableAnsweRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.OrganInfo},System.Collections.Generic.List{System.Nullable{IRaCIS.Core.Domain.Share.QuestionMark}})">
<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>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetDataTableFromUpload(Microsoft.AspNetCore.Http.IFormFile,System.String,System.Guid)">
<summary>
从上传文件中获取Datatable
@ -9075,6 +9091,11 @@
单位
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingReportDto.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingReportDto.HighlightAnswer">
<summary>
高亮问题的答案
@ -11320,6 +11341,11 @@
数据来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionTrialAddOrEdit.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionTrialAddOrEdit.DictionaryCode">
<summary>
字典code
@ -11403,6 +11429,11 @@
数据来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionSystemAddOrEdit.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionSystemAddOrEdit.Unit">
<summary>
单位
@ -11841,6 +11872,11 @@
数据来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionTrialView.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionTrialView.QuestionEnName">
<summary>
问题英文名称
@ -11916,6 +11952,11 @@
数据来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionSystemView.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionSystemView.Unit">
<summary>
单位
@ -12171,6 +12212,11 @@
默认值
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetCalculateTableQuestionsOutDto.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetCalculateTableQuestionsOutDto.ClassifyEditType">
<summary>
分类编辑类型 是否可编辑
@ -12351,6 +12397,11 @@
数据来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionSystemInDto.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionSystemInDto.Unit">
<summary>
单位
@ -12711,6 +12762,11 @@
数据来源
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionTrialInDto.ShowChartTypeEnum">
<summary>
显示图表类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionTrialInDto.Unit">
<summary>
单位
@ -13882,7 +13938,7 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMarkBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService,IRaCIS.Core.Application.Contracts.IReadingClinicalDataService,IRaCIS.Core.Application.Service.IReadingCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserFeedBack},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingCriterionPage},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskRelation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingJudgeInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganTrialInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoCalculateService,IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoWithoutPETCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CriterionKeyFileRead},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Application.Service.IGeneralCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskStudy},IRaCIS.Core.Application.Service.ImageAndDoc.IDownloadAndUploadService,IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService,AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMarkBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService,IRaCIS.Core.Application.Contracts.IReadingClinicalDataService,IRaCIS.Core.Application.Service.IReadingCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserFeedBack},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingCriterionPage},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskRelation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingJudgeInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganTrialInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoCalculateService,IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoWithoutPETCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CriterionKeyFileRead},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionKeyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Application.Service.IGeneralCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskStudy},IRaCIS.Core.Application.Service.ImageAndDoc.IDownloadAndUploadService,IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService,AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<summary>
IR影像阅片
</summary>
@ -15286,6 +15342,13 @@
<param name="email"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Helper.SendEmailHelper.ChangeEmailSenderName(MimeKit.MimeMessage,System.String)">
<summary>
设置发送邮箱
</summary>
<param name="messageToSend"></param>
<param name="senderName"></param>
</member>
<member name="M:IRaCIS.Core.Application.Helper.FileConvertHelper.ConvertWordToPdf(System.String,System.String)">
<summary>
镜像里面打入libreoffice 的方案
@ -15324,13 +15387,14 @@
<param name="isFileNameAddGuid"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.String,System.String,System.Boolean)">
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.String,System.String,System.Boolean,System.Boolean)">
<summary>
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
</summary>
<param name="localFilePath"></param>
<param name="oosFolderPath"></param>
<param name="isFileNameAddGuid"></param>
<param name="randomFileName">随机文件名</param>
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
@ -15738,7 +15802,7 @@
10分钟检测通知IR 已通知的进行标注,下次不会再通知
</summary>
</member>
<member name="M:IRaCIS.Core.Application.MassTransit.Recurring.UrgentIRUnReadTaskRecurringEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
<member name="M:IRaCIS.Core.Application.MassTransit.Recurring.UrgentIRUnReadTaskRecurringEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialEmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
<summary>
10分钟检测通知IR 已通知的进行标注,下次不会再通知
</summary>

View File

@ -365,8 +365,11 @@ public class ImageConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(inDto.EmailNoticeConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -500,6 +503,7 @@ public class ImageConsumer(
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailNoticeConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}

View File

@ -127,7 +127,7 @@ public class UrgentMedicalReviewAddedEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@ -235,7 +235,7 @@ public class UrgentIRRepliedMedicalReviewConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@ -353,7 +353,7 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -462,7 +462,7 @@ public class UrgentIRApplyedReReadingConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}

View File

@ -121,7 +121,7 @@ public class UserSiteSurveySubmitedEventConsumer(
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@ -204,7 +204,7 @@ public class SiteSurveySPMSubmitedEventConsumer(
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@ -318,7 +318,7 @@ public class SiteSurverRejectedEventConsumer(
};
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}

View File

@ -121,7 +121,7 @@ public class CRCSubmitedAndQCToAuditEventConsumer(
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@ -220,7 +220,7 @@ public class CRCRepliedQCChallengeEventConsumer(
return (topicStr, htmlBodyStr);
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -338,7 +338,7 @@ public class QCRepliedQCChallengeEventConsumer(
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -438,7 +438,7 @@ public class CRCRepliedCheckChallengeEventConsumer(
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -548,7 +548,7 @@ public class PMRepliedCheckChallengeEventConsumer(
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -647,7 +647,7 @@ public class CheckStateChangedToAuditEventConsumer(
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}
@ -756,7 +756,7 @@ public class QCClaimTaskEventConsumer(
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
}

View File

@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Consumer;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Models;
using MassTransit;
using Microsoft.Extensions.Options;
using MimeKit;
@ -26,6 +27,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
public class UrgentIRUnReadTaskRecurringEventConsumer(
IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<Trial> _trialRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<TrialUserRole> _trialUserRoleRepository,
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigrepository,
@ -38,6 +40,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
var trialId = context.Message.TrialId;
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
var scenario = EmailBusinessScenario.ExpeditedReading;
var trialEmailConfig = _trialEmailNoticeConfigrepository.Where(t => t.TrialId == trialId && t.BusinessScenarioEnum == scenario && t.IsAutoSend && t.IsEnable).FirstOrDefault();
@ -160,7 +163,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
};
await CommonEmailHelper.GetTrialEmailSubejctAndHtmlInfoAndBuildAsync(trialEmailConfig, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
//处理标记已通知的任务

View File

@ -114,7 +114,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
if (emailConfig != null)
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}

View File

@ -137,7 +137,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
if (emailConfig != null)
{
await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(emailConfig, messageToSend, emailConfigFunc);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}

View File

@ -10,6 +10,7 @@ using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infrastructure.Extention;
using IdentityModel.Client;
using MailKit;
using MailKit.Net.Imap;
using MailKit.Search;
@ -95,12 +96,11 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
try
{
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var sentFolder = client.GetFolder("已发送");
sentFolder.Open(FolderAccess.ReadOnly);
AuthenticateImap(client);
var sentFolder = OpenSentFolder(client);
var uid = new UniqueId(uint.Parse(emailInfo.UniqueId));
var message = sentFolder.GetMessage(uid);
emailInfo.Content = message.HtmlBody ?? string.Empty;
emailInfo.Content = message.HtmlBody ?? message.TextBody ?? string.Empty;
if (emailInfo.AttachmentList.Count == 0)
@ -182,12 +182,11 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
try
{
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var sentFolder = client.GetFolder("已发送");
sentFolder.Open(FolderAccess.ReadOnly);
AuthenticateImap(client);
var sentFolder = OpenSentFolder(client);
var uid = new UniqueId(uint.Parse(emailInfo.UniqueId));
var message = sentFolder.GetMessage(uid);
emailInfo.Content = message.HtmlBody ?? string.Empty;
emailInfo.Content = message.HtmlBody ?? message.TextBody ?? string.Empty;
sentFolder.Close();
}
catch (Exception ex)
@ -246,9 +245,8 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
try
{
client.Connect(_systemEmailConfig.Imap, 993, SecureSocketOptions.SslOnConnect);
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var sentFolder = client.GetFolder("已发送");
sentFolder.Open(FolderAccess.ReadOnly);
AuthenticateImap(client);
var sentFolder = OpenSentFolder(client);
var startDate = maxTime ?? DateTime.MinValue;
var searchQuery = SearchQuery.All.And(SearchQuery.DeliveredAfter(startDate));
@ -334,6 +332,111 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
}
}
private IMailFolder OpenSentFolder(ImapClient client)
{
IMailFolder folder = null;
try
{
folder = client.GetFolder(SpecialFolder.Sent);
}
catch { }
if (folder == null)
{
var candidates = new[] { "已发送", "已发送邮件", "Sent", "Sent Items", "[Gmail]/Sent Mail" };
foreach (var name in candidates)
{
try
{
var f = client.GetFolder(name);
if (f != null)
{
folder = f;
break;
}
}
catch { }
}
}
if (folder == null)
{
try
{
var personal = client.GetFolder(client.PersonalNamespaces.FirstOrDefault());
if (personal != null)
{
foreach (var sub in personal.GetSubfolders(false))
{
if (string.Equals(sub.FullName, "Sent", StringComparison.OrdinalIgnoreCase) ||
string.Equals(sub.FullName, "Sent Items", StringComparison.OrdinalIgnoreCase))
{
folder = sub;
break;
}
}
}
}
catch { }
}
if (folder == null)
throw new InvalidOperationException("未找到已发送文件夹");
folder.Open(FolderAccess.ReadOnly);
return folder;
}
private void AuthenticateImap(ImapClient client)
{
try
{
client.Authenticate(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
}
catch (AuthenticationException)
{
//if (_systemEmailConfig.UseOAuth2 && _systemEmailConfig.OAuth2AccessToken.IsNotNullOrEmpty())
//{
// var sasl = new SaslMechanismOAuth2(_systemEmailConfig.FromEmail, _systemEmailConfig.OAuth2AccessToken);
// client.Authenticate(sasl);
// return;
//}
//if (_systemEmailConfig.OAuth2AccessToken.IsNullOrEmpty())
//{
// var token = AcquireOAuth2TokenByPassword();
// if (token.IsNotNullOrEmpty())
// {
// _systemEmailConfig.OAuth2AccessToken = token;
// var sasl = new SaslMechanismOAuth2(_systemEmailConfig.FromEmail, token);
// client.Authenticate(sasl);
// return;
// }
//}
throw;
}
}
//private string AcquireOAuth2TokenByPassword()
//{
// if (_systemEmailConfig.OAuthTenantId.IsNullOrEmpty() || _systemEmailConfig.OAuthClientId.IsNullOrEmpty())
// return string.Empty;
// using var http = new HttpClient();
// var req = new PasswordTokenRequest
// {
// Address = $"https://login.microsoftonline.com/{_systemEmailConfig.OAuthTenantId}/oauth2/v2.0/token",
// ClientId = _systemEmailConfig.OAuthClientId,
// ClientSecret = _systemEmailConfig.OAuthClientSecret,
// Scope = "offline_access https://outlook.office365.com/IMAP.AccessAsUser.All",
// UserName = _systemEmailConfig.FromEmail,
// Password = _systemEmailConfig.AuthorizationCode
// };
// var resp = http.RequestPasswordTokenAsync(req).GetAwaiter().GetResult();
// if (resp.IsError || resp.AccessToken.IsNullOrEmpty())
// return string.Empty;
// return resp.AccessToken;
//}
// 取skip的值
public int CalcReverseSkip(int pageIndex, int pageSize, int totalCount)
{

View File

@ -2597,7 +2597,7 @@ namespace IRaCIS.Core.Application.Service.Common
list.Add(new ExportDocumentDes() { Code = StaticData.Export.ReadingLession_Export, ExportCatogory = ExportResult.DetailedTableOfLesions });
}
if (criterion.CriterionType == CriterionType.RECIST1Point1)
if (criterion.CriterionType == CriterionType.RECIST1Point1 || criterion.CriterionType == CriterionType.Lugano2014)
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.TumorCDISC_Export, ExportCatogory = ExportResult.TumorCDISC_Export });
}

View File

@ -796,7 +796,7 @@ public class Tumor_CDISC_ExportService(IRepository<ReadingQuestionCriterionTrial
}
#region co 处理部分 处理部分2 访视点,裁判备注
#region co 处理部分 处理部分2 访视点
//非基线
if (task.VisitNum > 0)

View File

@ -533,7 +533,7 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
}
@ -593,7 +593,7 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
@ -723,7 +723,7 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.DoctorUserFirstJoinTrial : EmailBusinessScenario.DoctorUserExistJoinTrial, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
//创建账号 和创建角色 一条,更新的时候才记录更新角色
@ -926,7 +926,7 @@ namespace IRaCIS.Core.Application.Service
//中心调研核对人员提醒
public async Task SiteSuervyCheckUser(Guid trialId, string email, string name)
{
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialCode, t.ResearchProgramNo }).FirstOrDefaultAsync();
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialCode, t.EmailFromName, t.ResearchProgramNo }).FirstOrDefaultAsync();
var messageToSend = new MimeMessage();
//发件地址
@ -954,13 +954,13 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurvey_CheckUser, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}
public async Task SiteSuervyUpdateUser(Guid trialSiteId, string email, string name, string url)
{
var trialInfo = await _trialSiteRepository.Where(t => t.Id == trialSiteId).Select(t => new { t.Trial.TrialCode, t.Trial.ResearchProgramNo, t.TrialSiteCode, t.TrialSiteName, t.TrialSiteAliasName }).FirstOrDefaultAsync();
var trialInfo = await _trialSiteRepository.Where(t => t.Id == trialSiteId).Select(t => new { t.Trial.TrialCode, t.Trial.EmailFromName, t.Trial.ResearchProgramNo, t.TrialSiteCode, t.TrialSiteName, t.TrialSiteAliasName }).FirstOrDefaultAsync();
var messageToSend = new MimeMessage();
//发件地址
@ -990,7 +990,7 @@ namespace IRaCIS.Core.Application.Service
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.SiteSurvey_UpdateUser, messageToSend, emailConfigFunc);
SendEmailHelper.ChangeEmailSenderName(messageToSend, trialInfo.EmailFromName);
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
}

View File

@ -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,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public string? ReportMark { get; set; }
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
/// <summary>
/// 高亮问题的答案
/// </summary>
@ -192,6 +199,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
{
@ -449,12 +466,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public List<string> VisitTaskNameList { get; set; }
public List<ChartData> ChartDataList { get; set; }
public List<ReportChartData> ChartDataList { get; set; }
}
public class ChartData
public class ReportChartData
{
public string Name { get; set; }
public List<string> Value { get; set; }
@ -471,6 +488,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid? TableQuestionId { get; set; }
public decimal? RowIndex { get; set; }
public ReportChartType? ReportChartTypeEnum { get; set; }
}
public class SetReadKeyFileInDto
{
@ -1979,6 +1998,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public bool IsReadKeyFile { get; set; } = false;
public bool IsHaveKeyFile { get; set; } = false;
}
public class GetReadingImgInDto

View File

@ -431,6 +431,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// 数据来源
/// </summary>
public DataSources? DataSource { get; set; } = DataSources.ManualEntry;
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
public Guid? Id { get; set; }
@ -561,6 +567,11 @@ 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>
@ -1241,6 +1252,11 @@ 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>
@ -1352,6 +1368,11 @@ 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>
@ -1817,6 +1838,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
[Comment("数据来源")]
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
[Comment("限制编辑")]
public LimitEdit LimitEdit { get; set; } = LimitEdit.None;
@ -2223,6 +2249,11 @@ 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>
@ -2630,6 +2661,11 @@ 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>

View File

@ -72,6 +72,7 @@ namespace IRaCIS.Core.Application.Service
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
IRepository<ReadingQuestionSystem> _readingQuestionSystem,
IRepository<CriterionKeyFileRead> _criterionKeyFileReadRepository,
IRepository<TrialCriterionKeyFile> _trialCriterionKeyFileRepository,
IRepository<NoneDicomStudyFile> _noneDicomStudyFileSystem,
IGeneralCalculateService _generalCalculateService,
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
@ -3776,6 +3777,7 @@ namespace IRaCIS.Core.Application.Service
task.IsExistUnprocessedFeedback = await _userFeedBackRepository.AnyAsync(x => x.VisitTaskId == task.VisitTaskId && x.State == 0);
task.IsViewStudyPart= visitTaskInfo.ReadingCategory==ReadingCategory.Judge|| visitTaskInfo.IsViewStudyPart;
task.IsReadKeyFile = await _criterionKeyFileReadRepository.AnyAsync(x => x.IdentityUserId == _userInfo.IdentityUserId && x.TrialCriterionId == task.TrialReadingCriterionId);
task.IsHaveKeyFile = await _trialCriterionKeyFileRepository.AnyAsync(x => x.TrialCriterionId == task.TrialReadingCriterionId);
// 添加默认答案
if (inDto.VisitTaskId == null && visitTaskInfo.ReadingTaskState != ReadingTaskState.HaveSigned)
{

View File

@ -15,6 +15,15 @@ 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));
CreateMap<SystemCriterionKeyFile, SystemCriterionKeyFileView>();
CreateMap<SystemCriterionKeyFile, SystemCriterionKeyFileAddOrEdit>().ReverseMap();

View File

@ -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>

View File

@ -4,6 +4,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;
@ -257,21 +258,62 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto()
{
VisitTaskNameList = data.VisitTaskList.Select(x => x.BlindName).ToList(),
ChartDataList=new List<ChartData>() { },
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>(),
};
if (inDto.QuestionId != null)
for (var i = 0; i < result.VisitTaskNameList.Count; i++)
{
// 淋巴结的短径
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());
}
else
{
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer[i].Answer).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)
{
ChartData chartData = new ChartData()
ReportChartData chartData = new ReportChartData()
{
Name = question.QuestionName,
Value = new List<string>(),
@ -290,15 +332,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 问题 靶病灶
.SelectMany(x => x.Childrens)
// 病灶
.SelectMany(x => x.Childrens).Where(x=> x.RowIndex == inDto.RowIndex)
.SelectMany(x => x.Childrens).Where(x => x.RowIndex == inDto.RowIndex)
// 表格问题
.SelectMany(x => x.Childrens).Where(x => x.TableQuestionId == inDto.TableQuestionId)
.FirstOrDefault();
if (lesion != null)
{
ChartData chartData = new ChartData()
ReportChartData chartData = new ReportChartData()
{
Name = lesion.QuestionName,
Value = new List<string>(),
@ -309,7 +351,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
result.ChartDataList.Add(chartData);
}
}

View File

@ -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
);

View File

@ -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
);

View File

@ -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>

View File

@ -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
);

View File

@ -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,208 +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
);

View File

@ -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
);

View File

@ -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
);

View File

@ -160,12 +160,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 +177,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
);

View File

@ -144,6 +144,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
GroupName = x.GroupName,
GroupEnName = x.GroupEnName,
IsShowInDicom = x.IsShowInDicom,
ShowChartTypeEnum=x.ShowChartTypeEnum,
Type = x.Type,
GroupId = x.GroupId,
QuestionType = x.QuestionType,
@ -171,6 +172,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
GroupName = x.GroupName,
GroupEnName = x.GroupEnName,
QuestionId = x.Id,
ShowChartTypeEnum = x.ShowChartTypeEnum,
IsShowInDicom = x.IsShowInDicom,
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
LesionType = x.LesionType,
@ -238,7 +240,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
QuestionId = x.ReadingQuestionId,
TableQuestionId = x.Id,
ShowChartTypeEnum = x.ShowChartTypeEnum,
Type = x.Type,
LesionType = question.LesionType,
TableQuestionType = x.TableQuestionType,

View File

@ -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

View File

@ -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
);

View File

@ -103,12 +103,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();
@ -122,227 +122,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
);

View File

@ -340,7 +340,7 @@ namespace IRaCIS.Core.Application
foreach (var item in systemCriterionKeyFile)
{
var path= await oSSService.UploadToOSSAsync(item.FilePath, $"{trialCriterion.TrialId}/KeyFile", true,true);
var path= await oSSService.UploadToOSSAsync(item.FilePath, $"{trialCriterion.TrialId}/ReadingModule/{trialCriterion.CriterionName}", true,true);
trialCriterionKeyFiles.Add(new TrialCriterionKeyFile
{

View File

@ -9,6 +9,7 @@ namespace IRaCIS.Core.Application.Service
[ApiExplorerSettings(GroupName = "Trial")]
public class SubjectService(IRepository<Subject> _subjectRepository,
IRepository<Trial> _trialRepository,
IRepository<VisitStage> _visitStageRepository,
IRepository<SubjectVisit> _subjectVisitRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISubjectService
{
@ -30,6 +31,11 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.NotOk(_localizer["Subject_NoConfirmedPlan"]);
}
if ( !(await _visitStageRepository.AnyAsync(x => x.IsBaseLine && x.TrialId == subjectCommand.TrialId&&x.IsConfirmed)))
{
return ResponseOutput.NotOk(_localizer["Subject_NoBaseLinePlan"]);
}
var verifyExp1 = new EntityVerifyExp<Subject>()
{
VerifyExp = u => u.Code == subjectCommand.Code && u.TrialId == subjectCommand.TrialId,

View File

@ -378,6 +378,23 @@ namespace IRaCIS.Core.Domain.Share
ReportResult = 2,
}
/// <summary>
/// 显示图表的类型
/// </summary>
public enum ShowChartType
{
/// <summary>
/// 不显示
/// </summary>
NotShow = 0,
/// <summary>
/// 柱状图
/// </summary>
BarGraph = 1,
}
/// <summary>
/// 数据来源
/// </summary>
@ -2472,11 +2489,23 @@ public enum SUVChangeVSBaseline
}
/// <summary>
/// 阅片图表类型
/// </summary>
public enum ReportChartType
{
/// <summary>
/// 靶病灶
/// </summary>
Target = 0,
/// <summary>
/// 问题类型 这里序号关系着计算顺序 请勿修改
/// </summary>
public enum QuestionType
}
/// <summary>
/// 问题类型 这里序号关系着计算顺序 请勿修改
/// </summary>
public enum QuestionType
{
/// <summary>
/// 靶病灶径线之和SOD

View File

@ -176,6 +176,11 @@ public class ReadingQuestionSystem : BaseAddAuditEntity
[Comment("数据来源")]
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
[Comment("最大答案长度")]
public int? MaxAnswerLength { get; set; }

View File

@ -238,7 +238,10 @@ public class ReadingQuestionTrial : BaseAddAuditEntity
[Comment("数据来源")]
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
[Comment("问题英文名称")]
public string QuestionEnName { get; set; } = string.Empty;
@ -287,6 +290,8 @@ public class ReadingQuestionTrial : BaseAddAuditEntity
/// </summary>
public ImageMark? ImageMarkEnum { get; set; }
/// <summary>
/// 影像工具
/// </summary>

View File

@ -130,6 +130,11 @@ public class ReadingTableQuestionSystem : BaseAddAuditEntity
[Comment("数据来源")]
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
[Comment("限制编辑")]
public LimitEdit LimitEdit { get; set; } = LimitEdit.None;

View File

@ -143,6 +143,11 @@ public class ReadingTableQuestionTrial : BaseAddAuditEntity
[Comment("数据来源")]
public DataSources DataSource { get; set; } = DataSources.ManualEntry;
/// <summary>
/// 显示图表类型
/// </summary>
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
[Comment("最大答案长度")]
public int? MaxAnswerLength { get; set; }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class ShowChartType : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ShowChartTypeEnum",
table: "ReadingTableQuestionTrial",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ShowChartTypeEnum",
table: "ReadingTableQuestionSystem",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ShowChartTypeEnum",
table: "ReadingQuestionTrial",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ShowChartTypeEnum",
table: "ReadingQuestionSystem",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_TrialCriterionKeyFile_TrialCriterionId",
table: "TrialCriterionKeyFile",
column: "TrialCriterionId");
migrationBuilder.AddForeignKey(
name: "FK_TrialCriterionKeyFile_ReadingQuestionCriterionTrial_TrialCriterionId",
table: "TrialCriterionKeyFile",
column: "TrialCriterionId",
principalTable: "ReadingQuestionCriterionTrial",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_TrialCriterionKeyFile_ReadingQuestionCriterionTrial_TrialCriterionId",
table: "TrialCriterionKeyFile");
migrationBuilder.DropIndex(
name: "IX_TrialCriterionKeyFile_TrialCriterionId",
table: "TrialCriterionKeyFile");
migrationBuilder.DropColumn(
name: "ShowChartTypeEnum",
table: "ReadingTableQuestionTrial");
migrationBuilder.DropColumn(
name: "ShowChartTypeEnum",
table: "ReadingTableQuestionSystem");
migrationBuilder.DropColumn(
name: "ShowChartTypeEnum",
table: "ReadingQuestionTrial");
migrationBuilder.DropColumn(
name: "ShowChartTypeEnum",
table: "ReadingQuestionSystem");
}
}
}

View File

@ -6723,6 +6723,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)")
.HasComment("备注");
b.Property<int>("ShowChartTypeEnum")
.HasColumnType("int");
b.Property<int>("ShowOrder")
.HasColumnType("int")
.HasComment("排序");
@ -7033,6 +7036,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)")
.HasComment("备注");
b.Property<int>("ShowChartTypeEnum")
.HasColumnType("int");
b.Property<int>("ShowOrder")
.HasColumnType("int")
.HasComment("排序");
@ -7556,6 +7562,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)")
.HasComment("备注");
b.Property<int>("ShowChartTypeEnum")
.HasColumnType("int");
b.Property<int>("ShowOrder")
.HasColumnType("int")
.HasComment("排序号");
@ -7786,6 +7795,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)")
.HasComment("注释");
b.Property<int>("ShowChartTypeEnum")
.HasColumnType("int");
b.Property<int>("ShowOrder")
.HasColumnType("int");