From 53251e53a0c0115980fd1f59991cc6bd106aa624 Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Mon, 24 Jul 2023 14:40:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E8=A6=81=E7=9A=84?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/ExtraController.cs | 45 +-
.../Controllers/FinancialChangeController.cs | 258 +---
.../Controllers/UploadDownLoadController.cs | 67 +-
IRaCIS.Core.API/IRaCIS.Core.API.xml | 79 -
.../IRaCIS.Core.Application.xml | 960 +-----------
.../Allocation/TaskAllocationRuleService.cs | 225 ---
.../Allocation/TaskConsistentRuleService.cs | 777 ----------
.../Allocation/VisitTaskHelpeService.cs | 470 +-----
.../Service/Allocation/VisitTaskService.cs | 83 +-
.../Service/Allocation/_MapConfig.cs | 97 +-
.../Service/Common/DictionaryService.cs | 18 +-
.../Service/Common/FileService.cs | 165 +--
.../Service/Common/Interface/IFileService.cs | 6 +-
.../Service/Common/MailService.cs | 122 +-
.../Service/Doctor/AttachmentService.cs | 254 ----
.../Service/Doctor/DTO/AttachmentModel.cs | 64 -
.../Doctor/DTO/DoctorAccountRegisterModel.cs | 12 -
.../Service/Doctor/DTO/DoctorModel.cs | 15 +-
.../Service/Doctor/DTO/EducationModel.cs | 89 --
.../Service/Doctor/DTO/HolidayModel.cs | 13 -
.../Doctor/DTO/ResearchPublicationModel.cs | 21 -
.../Doctor/DTO/TrialExperienceModel.cs | 87 --
.../Service/Doctor/DoctorListService.cs | 279 ----
.../Service/Doctor/DoctorService.cs | 628 --------
.../Service/Doctor/EducationService.cs | 140 --
.../Doctor/Interface/IAttachmentService.cs | 27 -
.../Doctor/Interface/IDoctorAccountService.cs | 14 -
.../Interface/IDoctorListQueryService.cs | 32 -
.../Doctor/Interface/IDoctorService.cs | 74 -
.../Doctor/Interface/IEducationService.cs | 26 -
.../Interface/IResearchPublicationService.cs | 13 -
.../Interface/ITrialExperienceService.cs | 15 -
.../Doctor/Interface/IVacationService.cs | 19 -
.../Doctor/ResearchPublicationService.cs | 41 -
.../Service/Doctor/TrialExperienceService.cs | 179 ---
.../Service/Doctor/VacationService.cs | 88 --
.../Service/Doctor/_MapConfig.cs | 159 --
.../Service/Financial/CalculateService.cs | 715 ---------
.../Service/Financial/DTO/AwardPriceModel.cs | 37 -
.../Service/Financial/DTO/CalculateModel.cs | 44 -
.../Financial/DTO/ExchangeRateModel.cs | 13 -
.../Financial/DTO/PaymentAdjustmentModel.cs | 54 -
.../Financial/DTO/PaymentDetailModel.cs | 195 ---
.../Service/Financial/DTO/PaymentModel.cs | 179 ---
.../Service/Financial/DTO/RankPriceModel.cs | 50 -
.../Financial/DTO/ReviewerPayInfoModel.cs | 40 -
.../Financial/DTO/TrialPaymentPriceModel.cs | 46 -
.../Financial/DTO/TrialRevenuesPriceModel.cs | 37 -
.../DTO/TrialRevenuesPriceVerificationDTO.cs | 72 -
.../Service/Financial/ExchangeRateService.cs | 117 --
.../Service/Financial/FinancialService.cs | 1314 -----------------
.../Financial/Interface/ICalculateService.cs | 16 -
.../Interface/IDoctorPayInfoService.cs | 16 -
.../Interface/IExchangeRateService.cs | 15 -
.../Interface/IPaymentAdjustmentService.cs | 16 -
.../Financial/Interface/IPaymentService.cs | 32 -
.../Financial/Interface/IRankPriceService.cs | 18 -
.../Interface/ITrialPaymentPriceService.cs | 21 -
.../Interface/ITrialRevenuesPriceService.cs | 14 -
.../ITrialRevenuesPriceVerificationService.cs | 17 -
.../Interface/IVolumeRewardService.cs | 12 -
.../Financial/PaymentAdjustmentService.cs | 314 ----
.../Service/Financial/RankPriceService.cs | 105 --
.../Financial/ReviewerPayInfoService.cs | 144 --
.../Financial/TrialPaymentPriceService.cs | 188 ---
.../Financial/TrialRevenuesPriceService.cs | 152 --
.../TrialRevenuesPriceVerificationService.cs | 197 ---
.../Service/Financial/VolumeRewardService.cs | 61 -
.../Service/Financial/_MapConfig.cs | 62 -
.../Service/Institution/HospitalService.cs | 11 +-
.../Service/Management/UserService.cs | 4 +-
...tCriteriaEvaluationVisitFilterViewModel.cs | 48 +-
.../ISubjectCriteriaEvaluationService.cs | 25 -
.../SubjectCriteriaEvaluationService.cs | 776 ----------
.../Service/Reading/_MapConfig.cs | 6 +-
.../SiteSurvey/TrialSiteSurveyService.cs | 8 -
.../Service/Stat/IStatisticsService.cs | 27 +-
.../Service/Stat/StatisticsService.cs | 706 +--------
.../TrialSiteUser/Interface/ITrialService.cs | 7 +-
.../TrialSiteUser/PersonalWorkstation.cs | 85 +-
.../TrialSiteUser/TrialConfigService.cs | 9 +-
.../Service/TrialSiteUser/TrialService.cs | 200 +--
.../Service/TrialSiteUser/_MapConfig.cs | 2 +-
.../Service/TrialSiteUser/_MapConfig2.cs | 1 -
.../Service/Visit/SubjectVisitService.cs | 7 +-
.../Service/WorkLoad/DoctorWorkloadService.cs | 855 -----------
.../Service/WorkLoad/EnrollService.cs | 517 -------
.../Interface/IDoctorWorkloadService.cs | 18 -
.../WorkLoad/Interface/IEnrollService.cs | 15 -
.../Interface/ITrialEnrollmentService.cs | 29 -
.../Interface/IWorkloadDistributionService.cs | 27 -
.../WorkLoad/WorkloadDistributionService.cs | 573 -------
.../Service/WorkLoad/_MapConfig.cs | 21 -
.../SubjectVisitCheckPassedTrigger.cs | 21 +-
.../Doctor/WorkLoadStatus.cs | 15 -
.../Abandon/WorkloadDistribution.cs | 4 -
IRaCIS.Core.Domain/Allocation/SubjectUser.cs | 90 --
.../Allocation/TaskAllocationRule.cs | 62 -
.../Allocation/TaskConsistentRule.cs | 76 -
IRaCIS.Core.Domain/Common/Dictionary.cs | 3 -
IRaCIS.Core.Domain/Dcotor/Attachment.cs | 34 -
IRaCIS.Core.Domain/Dcotor/Doctor.cs | 207 ---
.../Dcotor/DoctorCriterionFile.cs | 76 -
IRaCIS.Core.Domain/Dcotor/DoctorDictionary.cs | 25 -
IRaCIS.Core.Domain/Dcotor/DoctorWorkload.cs | 54 -
IRaCIS.Core.Domain/Dcotor/Education.cs | 69 -
IRaCIS.Core.Domain/Dcotor/Postgraduate.cs | 66 -
.../Dcotor/ResearchPublication.cs | 24 -
IRaCIS.Core.Domain/Dcotor/TrialExperience.cs | 40 -
.../Dcotor/TrialExperienceCriteria.cs | 18 -
IRaCIS.Core.Domain/Dcotor/UserDoctor.cs | 22 -
IRaCIS.Core.Domain/Dcotor/Vacation.cs | 18 -
IRaCIS.Core.Domain/Financial/CalculateTask.cs | 16 -
IRaCIS.Core.Domain/Financial/ExchangeRate.cs | 18 -
IRaCIS.Core.Domain/Financial/Payment.cs | 49 -
.../Financial/PaymentAdjustment.cs | 33 -
IRaCIS.Core.Domain/Financial/PaymentDetail.cs | 48 -
IRaCIS.Core.Domain/Financial/RankPrice.cs | 49 -
.../Financial/ReviewerPayInformation.cs | 32 -
.../Financial/TrialPaymentPrice.cs | 34 -
.../Financial/TrialRevenuesPrice.cs | 46 -
.../TrialRevenuesPriceVerification.cs | 33 -
IRaCIS.Core.Domain/Financial/VolumeReward.cs | 18 -
IRaCIS.Core.Domain/Image/DicomSeries.cs | 4 -
IRaCIS.Core.Domain/Image/DicomStudy.cs | 3 -
IRaCIS.Core.Domain/Institution/Hospital.cs | 3 -
IRaCIS.Core.Domain/Management/User.cs | 6 -
.../SubjectCriteriaEvaluation.cs | 88 --
.../SubjectCriteriaEvaluationVisitFilter.cs | 101 --
...bjectCriteriaEvaluationVisitStudyFilter.cs | 64 -
IRaCIS.Core.Domain/Trial/Enroll.cs | 73 -
IRaCIS.Core.Domain/Trial/EnrollDetail.cs | 31 -
.../Trial/EnrollReadingCategory.cs | 46 -
IRaCIS.Core.Domain/Trial/Trial.cs | 9 -
IRaCIS.Core.Domain/Trial/TrialStatusDetail.cs | 3 +-
IRaCIS.Core.Domain/Visit/Subject.cs | 9 -
.../Visit/SubjectCanceDoctor.cs | 31 -
IRaCIS.Core.Domain/Visit/SubjectVisit.cs | 2 -
IRaCIS.Core.Domain/_Config/_AppSettings.cs | 4 -
.../Common/AuditingData.cs | 263 +---
.../Context/IRaCISDBContext.cs | 43 +-
.../EntityConfigration/DoctorConfigration.cs | 57 -
.../TrialSiteConfigration.cs | 14 -
143 files changed, 133 insertions(+), 15972 deletions(-)
delete mode 100644 IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DTO/DoctorAccountRegisterModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DTO/EducationModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DTO/HolidayModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DTO/ResearchPublicationModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DTO/TrialExperienceModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/DoctorService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/EducationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IAttachmentService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorAccountService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorListQueryService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IEducationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IResearchPublicationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/ITrialExperienceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/Interface/IVacationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/TrialExperienceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/VacationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/CalculateService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/AwardPriceModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/CalculateModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/ExchangeRateModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/PaymentAdjustmentModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/PaymentDetailModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/PaymentModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/RankPriceModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/ReviewerPayInfoModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/TrialPaymentPriceModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/TrialRevenuesPriceModel.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/DTO/TrialRevenuesPriceVerificationDTO.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/ExchangeRateService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/FinancialService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/ICalculateService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/IDoctorPayInfoService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/IExchangeRateService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/IPaymentAdjustmentService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/IPaymentService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/IRankPriceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/ITrialPaymentPriceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/ITrialRevenuesPriceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/ITrialRevenuesPriceVerificationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/Interface/IVolumeRewardService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/PaymentAdjustmentService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/RankPriceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/ReviewerPayInfoService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/TrialRevenuesPriceService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/TrialRevenuesPriceVerificationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/VolumeRewardService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Financial/_MapConfig.cs
delete mode 100644 IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/Interface/ISubjectCriteriaEvaluationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/Interface/IDoctorWorkloadService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/Interface/IEnrollService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/Interface/ITrialEnrollmentService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/Interface/IWorkloadDistributionService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/WorkloadDistributionService.cs
delete mode 100644 IRaCIS.Core.Application/Service/WorkLoad/_MapConfig.cs
delete mode 100644 IRaCIS.Core.Domain.Share/Doctor/WorkLoadStatus.cs
delete mode 100644 IRaCIS.Core.Domain/Allocation/SubjectUser.cs
delete mode 100644 IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs
delete mode 100644 IRaCIS.Core.Domain/Allocation/TaskConsistentRule.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/Attachment.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/Doctor.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/DoctorCriterionFile.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/DoctorDictionary.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/DoctorWorkload.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/Education.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/Postgraduate.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/ResearchPublication.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/TrialExperience.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/TrialExperienceCriteria.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/UserDoctor.cs
delete mode 100644 IRaCIS.Core.Domain/Dcotor/Vacation.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/CalculateTask.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/ExchangeRate.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/Payment.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/PaymentAdjustment.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/PaymentDetail.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/RankPrice.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/ReviewerPayInformation.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/TrialPaymentPrice.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/TrialRevenuesPrice.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/TrialRevenuesPriceVerification.cs
delete mode 100644 IRaCIS.Core.Domain/Financial/VolumeReward.cs
delete mode 100644 IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluation.cs
delete mode 100644 IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationVisitFilter.cs
delete mode 100644 IRaCIS.Core.Domain/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationVisitStudyFilter.cs
delete mode 100644 IRaCIS.Core.Domain/Trial/Enroll.cs
delete mode 100644 IRaCIS.Core.Domain/Trial/EnrollDetail.cs
delete mode 100644 IRaCIS.Core.Domain/Trial/EnrollReadingCategory.cs
delete mode 100644 IRaCIS.Core.Domain/Visit/SubjectCanceDoctor.cs
delete mode 100644 IRaCIS.Core.Infra.EFCore/EntityConfigration/DoctorConfigration.cs
diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs
index de3d78b2c..a7e0c5e45 100644
--- a/IRaCIS.Core.API/Controllers/ExtraController.cs
+++ b/IRaCIS.Core.API/Controllers/ExtraController.cs
@@ -35,50 +35,7 @@ namespace IRaCIS.Api.Controllers
{
- ///
- /// 获取医生详情
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpGet, Route("doctor/getDetail/{doctorId:guid}")]
-
- public async Task> GetDoctorDetail([FromServices] IAttachmentService attachmentService, [FromServices] IDoctorService _doctorService,
- [FromServices] IEducationService _educationService, [FromServices] ITrialExperienceService _trialExperienceService,
- [FromServices] IResearchPublicationService _researchPublicationService, [FromServices] IVacationService _vacationService, Guid doctorId)
- {
- var education = await _educationService.GetEducation(doctorId);
-
- var sowList = _doctorService.GetDoctorSowList(doctorId);
- var ackSowList = _doctorService.GetDoctorAckSowList(doctorId);
-
- var doctorDetail = new DoctorDetailDTO
- {
- AuditView =await _doctorService.GetAuditState(doctorId),
- BasicInfoView = await _doctorService.GetBasicInfo(doctorId),
- EmploymentView = await _doctorService.GetEmploymentInfo(doctorId),
- AttachmentList = await attachmentService.GetAttachments(doctorId),
-
- EducationList = education.EducationList,
- PostgraduateList = education.PostgraduateList,
-
- TrialExperienceView = await _trialExperienceService.GetTrialExperience(doctorId),
- ResearchPublicationView = await _researchPublicationService.GetResearchPublication(doctorId),
-
- SpecialtyView =await _doctorService.GetSpecialtyInfo(doctorId),
- InHoliday = (await _vacationService.OnVacation(doctorId)).IsSuccess,
- IntoGroupInfo = _doctorService.GetDoctorIntoGroupInfo(doctorId),
- SowList = sowList,
- AckSowList = ackSowList
- };
-
- return ResponseOutput.Ok(doctorDetail);
- }
+
diff --git a/IRaCIS.Core.API/Controllers/FinancialChangeController.cs b/IRaCIS.Core.API/Controllers/FinancialChangeController.cs
index 0b3b13468..f67228b2b 100644
--- a/IRaCIS.Core.API/Controllers/FinancialChangeController.cs
+++ b/IRaCIS.Core.API/Controllers/FinancialChangeController.cs
@@ -22,14 +22,14 @@ namespace IRaCIS.Core.API.Controllers.Special
public class FinancialChangeController : ControllerBase
{
private readonly ITrialService _trialService;
- private readonly ICalculateService _calculateService;
+
private IStringLocalizer _localizer { get; set; }
- public FinancialChangeController(ITrialService trialService, ICalculateService calculateService, IStringLocalizer localizer
+ public FinancialChangeController(ITrialService trialService, IStringLocalizer localizer
)
{
_localizer = localizer;
_trialService = trialService;
- _calculateService = calculateService;
+
}
@@ -60,268 +60,28 @@ namespace IRaCIS.Core.API.Controllers.Special
var userId = Guid.Parse(User.FindFirst("id").Value);
var result = await _trialService.AddOrUpdateTrial(param);
- if (_trialService.TrialExpeditedChange)
- {
- var needCalReviewerIds = await _trialService.GetTrialEnrollmentReviewerIds(param.Id.Value);
- var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty);
-
- calcList.ForEach(t =>
- {
- if (needCalReviewerIds.Contains(t.DoctorId))
- {
- _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- t.DoctorId
- },
- CalculateMonth = DateTime.Parse(t.YearMonth)
- }, User.FindFirst("id").Value);
-
- }
- });
- }
return result;
}
- ///
- /// 添加或更新工作量[AUTH]
- ///
- ///
- ///
- ///
-
- [HttpPost, Route("doctorWorkload/workLoadAddOrUpdate")]
- [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
- public async Task WorkLoadAddOrUpdate([FromServices] IDoctorWorkloadService _trialWorkloadService, WorkloadCommand workLoadAddOrUpdateModel)
- {
- var userId = Guid.Parse(User.FindFirst("id").Value);
- var result = await _trialWorkloadService.AddOrUpdateWorkload(workLoadAddOrUpdateModel, userId);
- if (result.IsSuccess && workLoadAddOrUpdateModel.DataFrom == 2)
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- workLoadAddOrUpdateModel.DoctorId
- },
- CalculateMonth = workLoadAddOrUpdateModel.WorkTime
- }, User.FindFirst("id").Value);
- }
- return result;
- }
+
-
- [HttpDelete, Route("doctorWorkload/deleteWorkLoad/{id:guid}/{trialId:guid}")]
- [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
- public async Task DeleteWorkLoad([FromServices] IDoctorWorkloadService _trialWorkloadService, Guid id)
- {
- //先判断该工作量的费用是否被锁定,如果被锁定,则不能删除
- var workload = await _trialWorkloadService.GetWorkloadDetailById(id);
- var yearMonth = workload.WorkTime.ToString("yyyy-MM");
- var isLock = await _calculateService.IsLock(workload.DoctorId, yearMonth);
-
- if (isLock)
- {
- //---Expenses have been settled and workload can not be reset.
- return ResponseOutput.NotOk(_localizer["Financial_ChargeSettled"]);
- }
-
- var deleteResult = await _trialWorkloadService.DeleteWorkload(id);
- if (workload.DataFrom == (int)Domain.Share.WorkLoadFromStatus.FinalConfirm)
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- workload.DoctorId
- },
- CalculateMonth = workload.WorkTime
- }, User.FindFirst("id").Value);
- }
- return deleteResult;
- }
-
-
- ///
- /// 添加或更新汇率(会触发没有对锁定的费用计算)
- ///
-
- [HttpPost, Route("exchangeRate/addOrUpdateExchangeRate")]
- public async Task AddOrUpdateExchangeRate([FromServices] IExchangeRateService _exchangeRateService, [FromServices] IPaymentAdjustmentService _costAdjustmentService, ExchangeRateCommand addOrUpdateModel)
- {
- var result = await _exchangeRateService.AddOrUpdateExchangeRate(addOrUpdateModel);
- var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, addOrUpdateModel.YearMonth);
- foreach (var item in calcList)
- {
- if (item != null)
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- item.DoctorId
- },
- CalculateMonth = DateTime.Parse(item.YearMonth)
- }, User.FindFirst("id").Value);
- }
- }
- await _costAdjustmentService.CalculateCNY(addOrUpdateModel.YearMonth, addOrUpdateModel.Rate);
- return result;
- }
-
-
- ///
- /// 添加或更新 职称单价[AUTH]
- ///
-
- [HttpPost, Route("rankPrice/addOrUpdateRankPrice")]
- public async Task AddOrUpdateRankPrice([FromServices] IReviewerPayInfoService _reviewerPayInfoService, [FromServices] IRankPriceService _rankPriceService, RankPriceCommand addOrUpdateModel)
- {
- if (addOrUpdateModel.Id != Guid.Empty && addOrUpdateModel.Id != null)
- {
- var needCalReviewerIds =await _reviewerPayInfoService.GetReviewerIdByRankId(Guid.Parse(addOrUpdateModel.Id.ToString()));
- var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty);
-
- foreach (var item in calcList)
- {
- if (item != null && needCalReviewerIds.Contains(item.DoctorId))
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- item.DoctorId
- },
- CalculateMonth = DateTime.Parse(item.YearMonth)
- }, User.FindFirst("id").Value);
- }
- }
- }
- var userId = Guid.Parse(User.FindFirst("id").Value);
- return await _rankPriceService.AddOrUpdateRankPrice(addOrUpdateModel, userId);
- }
+
- ///
- /// 添加或更新(替换)医生支付展信息[AUTH]
- ///
-
- [HttpPost, Route("reviewerPayInfo/addOrUpdateReviewerPayInfo")]
- public async Task AddOrUpdateReviewerPayInfo([FromServices] IReviewerPayInfoService _doctorPayInfoService, ReviewerPayInfoCommand addOrUpdateModel)
- {
- var userId = Guid.Parse(User.FindFirst("id").Value);
- var result =await _doctorPayInfoService.AddOrUpdateReviewerPayInfo(addOrUpdateModel, userId);
- var calcList = await _calculateService.GetNeedCalculateReviewerList(addOrUpdateModel.DoctorId, string.Empty);
- foreach (var item in calcList)
- {
- if (item != null)
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- item.DoctorId
- },
- CalculateMonth = DateTime.Parse(item.YearMonth)
- }, User.FindFirst("id").Value);
- }
- }
- return result;
- }
+
- ///
- /// 保存(替换)项目支付价格信息(会触发没有被锁定的费用计算)[AUTH]
- ///
-
- [HttpPost, Route("trialPaymentPrice/addOrUpdateTrialPaymentPrice")]
- public async Task AddOrUpdateTrialPaymentPrice([FromServices] ITrialPaymentPriceService _trialPaymentPriceService, TrialPaymentPriceCommand addOrUpdateModel)
- {
- var userId = Guid.Parse(User.FindFirst("id").Value);
- var result =await _trialPaymentPriceService.AddOrUpdateTrialPaymentPrice(addOrUpdateModel);
- var needCalReviewerIds = await _trialService.GetTrialEnrollmentReviewerIds(addOrUpdateModel.TrialId);
- var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty);
+
- foreach (var item in calcList)
- {
- if (item != null && needCalReviewerIds.Contains(item.DoctorId))
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- item.DoctorId
- },
- CalculateMonth = DateTime.Parse(item.YearMonth)
- }, User.FindFirst("id").Value);
- }
- }
- return result;
- }
-
- ///
- /// 批量更新奖励费用[AUTH]
- ///
-
- [HttpPost, Route("volumeReward/addOrUpdatevolumeRewardPriceList")]
- public async Task AddOrUpdateAwardPriceList([FromServices] IVolumeRewardService _volumeRewardService, IEnumerable addOrUpdateModel)
- {
-
- var result =await _volumeRewardService.AddOrUpdateVolumeRewardPriceList(addOrUpdateModel);
-
- var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty);
- foreach (var item in calcList)
- {
- if (item != null)
- {
- await _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
- {
- NeedCalculateReviewers = new List()
- {
- item.DoctorId
- },
- CalculateMonth = DateTime.Parse(item.YearMonth)
- }, User.FindFirst("id").Value);
- }
- }
- return result;
- }
+
-
- ///
- /// 计算医生月度费用,并将计算的结果存入费用表
- ///
- [HttpPost, Route("financial/calculateMonthlyPayment")]
- public async Task CalculateMonthlyPayment(CalculateDoctorAndMonthDTO param)
- {
- if (!ModelState.IsValid)
- {
- //---Invalid parameter.
- return ResponseOutput.NotOk(_localizer["Financial_InvalidParameter"]);
- }
- return await _calculateService.CalculateMonthlyPayment(param, User.FindFirst("id").Value);
- }
-
- ///
- /// Financials /Monthly Payment 列表查询接口
- ///
- [HttpPost, Route("financial/getMonthlyPaymentList")]
- public async Task> GetMonthlyPaymentList([FromServices] IPaymentService _paymentService, [FromServices] IExchangeRateService _exchangeRateService, MonthlyPaymentQueryDTO queryParam)
- {
- return ResponseOutput.Ok(new PaymentDTO
- {
- CostList = await _paymentService.GetMonthlyPaymentList(queryParam),
- ExchangeRate = await _exchangeRateService.GetExchangeRateByMonth(queryParam.StatisticsDate.ToString("yyyy-MM"))
- });
- }
-
+
}
}
diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs
index b3e4cde44..66580badf 100644
--- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs
+++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs
@@ -993,73 +993,8 @@ namespace IRaCIS.Core.API.Controllers
}
- ///
- /// 下载多个医生的所有附件
- ///
- ///
- ///
- [HttpPost, Route("file/downloadDoctorAttachments")]
- public async Task> DownloadAttachment(Guid[] doctorIds)
- {
-
- var path = await _fileService.CreateDoctorsAllAttachmentZip(doctorIds);
-
- return ResponseOutput.Ok(new UploadFileInfoDTO
- {
- FilePath = path,
- FullFilePath = path + "?access_token=" + HttpContext.Request.Headers["Authorization"].ToString().Substring(7)
-
- });
- }
-
- ///
- /// 下载医生官方简历
- ///
- ///
- ///
- ///
- [HttpPost, Route("file/downloadOfficialCV/{language}")]
- public async Task> DownloadOfficialResume(int language, Guid[] doctorIds)
- {
-
- var path = await _fileService.CreateDoctorsAllAttachmentZip(doctorIds);
- return ResponseOutput.Ok(new UploadFileInfoDTO
- {
- FilePath = await _fileService.CreateOfficialResumeZip(language, doctorIds),
- FullFilePath = path + "?access_token=" + HttpContext.Request.Headers["Authorization"].ToString().Substring(7)
- });
- }
-
- ///
- /// 下载指定医生的指定附件
- ///
- /// 医生Id
- /// 要下载的附件Id
- ///
- [HttpPost, Route("file/downloadByAttachmentId/{doctorId}")]
- public async Task> DownloadAttachmentById(Guid doctorId, Guid[] attachmentIds)
- {
- var path = await _fileService.CreateZipPackageByAttachment(doctorId, attachmentIds);
- return ResponseOutput.Ok(new UploadFileInfoDTO
- {
- FilePath = await _fileService.CreateZipPackageByAttachment(doctorId, attachmentIds),
- FullFilePath = path + "?access_token=" + HttpContext.Request.Headers["Authorization"].ToString().Substring(7)
- });
- }
-
-
-
-
- [HttpPost, Route("enroll/downloadResume/{trialId:guid}/{language}")]
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
- [AllowAnonymous]
- public async Task> DownloadResume(int language, Guid trialId, Guid[] doctorIdArray)
- {
- var zipPath = await _fileService.CreateOfficialResumeZip(language, doctorIdArray);
-
- return ResponseOutput.Ok(zipPath);
- }
+
}
#endregion
diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml
index ed6960728..fc2558ece 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.xml
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml
@@ -16,19 +16,6 @@
医生基本信息 、工作信息 专业信息、审核状态
-
-
- 获取医生详情
-
-
-
-
-
-
-
-
-
-
系统用户登录接口[New]
@@ -41,49 +28,6 @@
新记录Id
-
-
- 添加或更新工作量[AUTH]
-
-
-
-
-
-
-
- 添加或更新汇率(会触发没有对锁定的费用计算)
-
-
-
-
- 添加或更新 职称单价[AUTH]
-
-
-
-
- 添加或更新(替换)医生支付展信息[AUTH]
-
-
-
-
- 保存(替换)项目支付价格信息(会触发没有被锁定的费用计算)[AUTH]
-
-
-
-
- 批量更新奖励费用[AUTH]
-
-
-
-
- 计算医生月度费用,并将计算的结果存入费用表
-
-
-
-
- Financials /Monthly Payment 列表查询接口
-
-
获取稽查数据
@@ -359,29 +303,6 @@
文件类型
-
-
- 下载多个医生的所有附件
-
-
-
-
-
-
- 下载医生官方简历
-
-
-
-
-
-
-
- 下载指定医生的指定附件
-
- 医生Id
- 要下载的附件Id
-
-
缩略图
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index e9489d018..4297d274b 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -85,105 +85,6 @@
-
-
- 替换表格Key
-
-
-
-
-
-
-
- 分配规则
-
-
-
-
- 获取计划列表 医生带阅片类型
-
-
-
-
-
-
- 获取项目下 医生账户信息下拉
-
-
-
-
-
-
-
- 获取访视任务 应用Subject后 医生比率情况
-
-
-
-
-
- 一致性分析配置表
-
-
-
-
- 设置一致性分析任务失效
-
-
-
-
-
-
- 一致性分析列表 (自身 组内 最后勾选 产生的任务)
-
-
-
-
-
-
- 为自身一致性分析医生,选择Subejct 列表
-
-
-
-
-
-
- 确认生成自身一致性分析任务
-
-
-
-
-
-
-
- 组间一致性分析 选择Subejct 列表
-
-
-
-
-
-
- 确认生成组间一致性分析任务
-
-
-
-
-
-
-
- 仅仅自身一致性时使用(
-
-
-
-
-
-
-
-
- 自身一致性分配 配置+ 统计已经生成数量统计表
-
-
-
-
医学审核生成规则 废弃
@@ -280,74 +181,11 @@
-
+
- Subject 任务类型 统计 +分配情况
-
-
-
-
-
- 一次性分配所有医生 批量分配(添加),后端现在没限制
-
-
-
-
-
-
- 阅片人维度 Subject统计表
+ 获取项目下 阅片人下拉
-
-
-
-
-
- 获取Subject 分配医生情况
-
-
-
-
-
-
-
- 取消Subject 分配的医生
-
-
-
-
-
-
-
- 任务 手动分配 重新分配 确认 取消分配
- 分配
-
-
-
-
-
- 获取手动分配 未分配的Subject列表(IsHaveAssigned 传递false)
-
-
-
-
-
- 批量为 多个Subject 分配医生 手动分配 IsReAssign 为true 批量删除 重新分配
-
-
-
-
-
-
- 批量取消Subject 分配的医生
-
- 数量
-
-
-
- 手动分配确认 绑定该Subject的已存在的任务给医生
-
-
@@ -358,11 +196,25 @@
-
+
+
+ new- 首次审核 后续编辑审核
+
+
+
+
+
+
+ new- 回复审核内容
+
+
+
+
+
- 裁判任务
+ new- 获取审核对话列表
-
+
@@ -441,12 +293,6 @@
-
-
- 基线退回 影响附加评估标准 是否参与评估
-
-
-
影响提示列表 重阅仅仅针对已完成的任务申请 退回针对的是未完成的(退回仅仅针对是访视类型的)
@@ -1148,11 +994,6 @@
获取登陆用户的系统通知列表 只是过滤了用户类型 和已经发布的
-
-
- UserLogService
-
-
验证CRC 是否已提交 已提交 就不允许进行任何操作,如果是IQC 那么还验证是否是当前任务领取人
@@ -2423,77 +2264,6 @@
-
-
- SubjectCriteriaEvaluationService
-
-
-
-
- subject 某标准 是否评估列表
-
-
-
-
-
-
- 添加 编辑 是否参与评估
-
-
-
-
-
-
- 自动访视筛选 (针对单一访视,重新筛选一遍,可能不存在该接口,仅仅留存)
-
-
-
-
-
- 评估访视筛选列表(一致性核查通过的访视都会出现 根据条件筛选)
-
-
-
-
-
-
- 已生成任务列表
-
-
-
-
-
-
- 批量勾选 生成该标准的任务
-
-
-
-
-
- 获取dicom 访视检查列表 (序列的 Id CreateTime 是否为空 代表了记录是否创建、IsConfirmed 代表 保存 确认)
-
-
-
-
-
- 批量保存或者确认 选择的序列
-
-
-
-
-
- 附加评估标准 PM 退回某一访视 影响任务列表
-
-
-
-
-
-
- 退回任务
-
-
-
-
临床答案
@@ -8073,16 +7843,6 @@
完成阅片量
-
-
- 未完成裁判任务数量
-
-
-
-
- 完成裁判任务数量
-
-
建议完成时间
@@ -8320,9 +8080,6 @@
UserLogQuery 列表查询参数模型
-
- UserLogAddOrEdit 列表查询参数模型
-
靶病灶是否为IUPD或者ICPD
@@ -8603,12 +8360,6 @@
SubjectCriteriaEvaluationAddOrEdit 列表查询参数模型
-
- SubjectCriteriaEvaluationVisitFilterView 列表视图模型
-
-
- SubjectCriteriaEvaluationVisitFilterQuery 列表查询参数模型
-
SubjectCriteriaEvaluationVisitFilterAddOrEdit 列表查询参数模型
@@ -9156,11 +8907,6 @@
IUserLogService
-
-
- ISubjectCriteriaEvaluationService
-
-
IClinicalQuestionService
@@ -10352,11 +10098,6 @@
-
-
- Financial---项目收入价格验证
-
-
指定资源Id,获取Dicom序列所属的实例信息列表
Dicom序列的Id
@@ -10796,15 +10537,6 @@
-
-
- PM 阅片人筛选 -- PM APM 待办
-
-
-
-
- vvv
-
获取PM核对临床数据
@@ -10812,16 +10544,7 @@
-
-
- SPM 阅片人筛选
-
-
-
-
- vvv
-
-
+
SPM 重阅审批
@@ -10912,7 +10635,7 @@
-
+
MIM医学反馈
@@ -11309,21 +11032,6 @@
-
-
- 打包医生官方简历
-
-
-
-
-
-
-
- 打包医生的所有附件
-
-
-
-
发送验证码
@@ -11332,372 +11040,6 @@
-
-
- 医生文档关联关系维护
-
-
-
-
- 删除附件
-
-
-
-
-
-
- 根据医生Id 和 附件类型,获取记录
-
- 医生Id
- 附件类型
-
-
-
-
- 获取单个医生的多种证书附件
-
- 医生Id
- 类型数组
-
-
-
-
- 根据医生Id获取医生附件
-
- 医生Id
-
-
-
-
- 保存多个附件
-
-
-
-
-
-
- 将简历设置为官方简历
-
-
-
-
-
-
-
-
- 设置简历的语言类型
-
-
-
- 0-未设置,1-中文,2-英文
-
-
-
-
- Reviewer列表分页查询
-
-
-
-
- 获取可筛选筛选及已经筛选的医生列表
-
-
-
-
- 获取提交CRO或者CRO审核的Reviewer列表
-
-
- 根据状态获取医生列表,入组 相关接口 (提交CRO-1) CRO确认-4
-
-
-
-
- 获取项目下医生入组状态列表[Confirmation]
-
-
-
-
- 添加/更新 医生基本信息 BasicInfo
-
-
-
-
- 详情、编辑-获取 医生基本信息 BasicInfo
-
- ReviewerID
-
-
-
-
- 详情、编辑-获取医生工作信息 Employment
-
-
-
-
- 添加修改医生标准文件
-
-
-
-
-
-
- 删除医生标准文件
-
-
-
-
-
-
- 获取医生标准文件
-
-
-
-
-
-
- 获取医生入组信息 正在提交的数量 已同意入组项目个数 正在读的
-
-
-
-
- Get Statement of Work list.[New]
-
-
-
-
- Get Ack Statement of Work[New]
-
-
-
-
- 根据医生Id获取医生教育经历和继续学习经历列表
-
-
-
-
- 新增医生教育经历
-
-
-
-
-
- 添加/更新医生继续学习经历
-
-
-
- 删除医生继续学习经历
-
- 医生Id
-
-
-
-
- 查询-医生科学研究信息
-
- 医生Id
-
-
-
-
- 根据医生Id,获取临床试验经历 界面所有数据
-
-
-
- 添加或更新医生临床经验列表项
-
-
-
- 删除临床经验
-
-
-
-
- 更新-GCP和其他临床经验
-
-
-
-
-
-
- 更新其他技能经验
-
-
-
-
- 添加休假时间段
-
- Status不传
-
-
-
-
- 删除休假时间段
-
- 记录Id
-
-
-
-
- 获取休假时间段列表
-
-
-
-
-
- 获取某个月下的某些医生最终确认的工作量,用于计算月度费用
-
-
-
-
- 计算月度费用,并调用AddOrUpdateMonthlyPayment和AddOrUpdateMonthlyPaymentDetail方法,
- 将费用计算的月度数据及详情保存
-
-
-
-
- 保存费用计算的月度数据
-
-
-
-
- 保存费用计算的月度详情
-
-
-
-
- 获取待计算费用的Reviewer对应的月份列表
-
-
-
-
- 查询Reviewer某个月的费用是否被锁定
-
-
-
-
- 根据记录Id,删除汇率记录
-
- 汇率记录Id
-
-
-
- Financials /MonthlyPayment 列表查询接口
-
-
-
-
- Financials /MonthlyPaymentDetail 详情查询接口
-
-
-
-
- NEW 导出Excel压缩包 数据获取
-
-
-
-
- Financials / Payment History 列表查询接口(已经支付锁定的数据,包含调整的)[New]
-
-
-
-
- Financials / Payment History 详情接口[New]
-
-
-
-
- Revenues列表接口,收入统计[New] 0是Detail 1是按照项目 2是按照人 3按照月份
-
-
-
-
- 收入支出分析接口,按照项目维度分析统计
-
-
-
-
- 收入支出分析接口,按照医生维度分析统计
-
-
-
-
- 获取劳务费用列表
-
-
-
-
- 锁定医生费用,锁定后,无法变更该医生对应月份的费用和工作量[New]
-
-
-
-
- 添加或更新费用调整[AUTH]
-
-
-
-
- 删除费用调整记录
-
-
-
-
- 获取费用调整列表
-
-
-
-
- 获取职称单价列表
-
-
-
-
- 获取医生支付信息列表
-
-
-
-
- 根据医生Id获取支付信息
-
- 医生Id
-
-
-
-
- 根据rankId 获取ReviewerId,用于当Rank的单价信息改变时,触发费用计算
-
-
-
-
-
-
- 添加或更新项目支付价格信息
-
-
-
-
- 获取项目支付价格信息列表
-
-
-
-
- 获取项目收入费用信息列表[New]
-
-
-
-
- 批量添加或更新奖励费用单价
-
-
-
-
- 获取所有奖励单价列表-用于计算时,一次性获取所有
-
-
-
-
- 分页获取奖励单价列表
-
-
分页获取CRO列表
@@ -12793,39 +12135,12 @@
Dashboard统计、全局工作量统计、入组两个维度统计(按照项目、按照人)
-
- 根据项目和医生,分页获取工作量统计[New]
-
-
- 项目入组 医生维度统计[New]
-
用户参与项目 统计[New]
用户参与项目 列表[New]
-
- 读片数分类统计[New]
-
-
- 获取最近几个月份的数据[New]
-
-
- 读片数量排行前几的数据[New]
-
-
- 按Rank统计Reviewer 数量[New]
-
-
- 最近几个季度入组人次[New] type==0 按照月份
-
-
- 参与项目数排行 [New]
-
-
- 最新工作量 (已确定的)[New]
-
Setting页面 获取项目参与人员列表
@@ -12874,23 +12189,6 @@
真删除项目 方便清理测试数据
临床试验项目Id
-
-
- 根据项目Id 获取医生Id,用于触发计算费用
-
-
-
- 分页获取医生参与的临床实验项目列表(查询条件)
-
-
-
-
- 医生确认入组或拒绝入组
-
- 项目Id
- 9-拒绝入组,10-确认入组
-
-
添加或更新受试者信息[New]
@@ -12927,107 +12225,6 @@
删除项目计划某一项 废弃
-
-
- 修改项目医生的阅片类型
-
-
-
-
-
-
- 修改项目医生启用禁用状态
-
-
-
-
-
-
- 0代表裁判和Tp 都可以 1、代表Tp 2 代表裁判
-
-
-
-
-
- 获取某个项目入组的医生工作量统计列表
-
-
-
-
- 获取入组某个项目的医生的最近几个月的工作量详情(带有填充数据)
-
-
-
-
- 获取来自Reviewer自己的数据,某个月添加的多条
-
-
-
-
- 工作量是否存在,用于判断只能添加一条的工作量记录
-
-
- 查询某个医生是否在某天有某个项目的工作量数据,处理添加来自医生自己的工作量数据
-
-
-
-
- 添加或更新工作量
-
-
-
-
- 删除工作量
-
-
-
-
- 获取工作量详情(用于判断工作量锁定时,调用)
-
-
-
-
- 添加或更新项目医生项目价格
-
-
-
-
- 获取医生项目列表
-
-
-
-
-
- 为项目筛选医生 提交 【select】
- 项目Id
- 医生Id数组
-
-
-
-
- 入组流程-向CRO提交医生[Submit]
-
-
-
-
- 入组流程-CRO确定医生名单 [ Approve]
-
-
-
-
- 入组流程-后台确认医生入组[Confirm]
-
-
-
-
- optType 0表示入组,列表没这条数据了, 1表示出组,需要填写出组时间 废弃
-
-
-
-
-
-
-
维护临床数据 --一定要在同步表前同步数据才行
@@ -13224,123 +12421,8 @@
-
-
- 医生多条件查询
-
-
-
-
- 筛选医生列表
-
-
-
-
-
-
- //入组 相关接口 (提交CRO-1) CRO确认-4
-
-
-
-
- 基本信息详情展示、编辑使用
-
-
-
-
-
-
- 添加医生基本信息
-
-
-
-
-
-
- 获取医生 工作信息
-
-
-
-
-
-
- 更新医生 工作信息
-
-
-
-
-
-
- 获取医生技能信息
-
-
-
-
- 更新医生技能信息
-
-
-
-
- 获取医生 审核状态
-
-
-
-
- 审核简历 和合作关系
-
-
-
- 医生详情 入组信息
-
-
- 获取医生参与项目的Sow协议
-
-
- 获取医生入组的 ack Sow
-
-
- 判断当前时间是否在休假
-
-
-
- 上传入组后的Ack-SOW
-
-
获取医院列表
-
- 按类型统计读片数量
-
-
- 按月份统计读片数量
-
-
- 读片数量排行
-
-
- 按Position统计 Reviewers 数量
-
-
- 每月入组人次
-
-
- 参与项目数排行
-
-
- 最新工作量 (已确定的)
-
-
- 入组流程-筛选医生 [select]
-
-
- 入组流程-向CRO提交医生[Submit]
-
-
- 入组流程-CRO确定医生名单 [ Approve]
-
-
- 入组流程-向CRO提交医生[Submit]
-
diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
deleted file mode 100644
index 2695eb31f..000000000
--- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-//--------------------------------------------------------------------
-// 此代码由T4模板自动生成 byzhouhang 20210918
-// 生成时间 2022-06-07 13:14:38
-// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
-//--------------------------------------------------------------------
-
-using IRaCIS.Core.Domain.Models;
-using Microsoft.AspNetCore.Mvc;
-using IRaCIS.Core.Application.Interfaces;
-using IRaCIS.Core.Application.ViewModel;
-using IRaCIS.Core.Application.Contracts;
-using IRaCIS.Core.Domain.Share;
-using IRaCIS.Core.Application.Filter;
-
-namespace IRaCIS.Core.Application.Service
-{
- ///
- /// 分配规则
- ///
- [ApiExplorerSettings(GroupName = "Trial")]
- public class TaskAllocationRuleService : BaseService, ITaskAllocationRuleService
- {
-
- private readonly IRepository _taskAllocationRuleRepository;
- private readonly IRepository _userRepository;
-
- private readonly IRepository _trialRepository;
-
- private readonly IRepository _subjectCanceDoctorRepository;
-
-
-
- public TaskAllocationRuleService(IRepository taskAllocationRuleRepository, IRepository userRepository, IRepository trialRepository, IRepository subjectCanceDoctorRepository)
- {
- _taskAllocationRuleRepository = taskAllocationRuleRepository;
- _userRepository = userRepository;
- _trialRepository = trialRepository;
- _subjectCanceDoctorRepository = subjectCanceDoctorRepository;
- }
-
-
-
-
- ///
- /// 获取计划列表 医生带阅片类型
- ///
- ///
- ///
- public async Task<(List,object)> GetDoctorPlanAllocationRuleList(Guid trialId)
- {
-
- var list = await _taskAllocationRuleRepository.Where(t => t.TrialId == trialId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
-
- //所有标准都是一样 后台只返回任意一个标准的就好了
- var trialTaskConfig = _repository.Where(t => t.TrialId == trialId && t.IsConfirm).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault();
-
- return (list, trialTaskConfig);
- }
-
-
-
-
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
-
- public async Task AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
- {
-
-
- //冗余 存
-
- var enrollId = _repository.Where(t => t.TrialId == addOrEditTaskAllocationRule.TrialId && t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId).Select(t => t.Id).FirstOrDefault();
-
- if (enrollId == Guid.Empty)
- {
- //"错误,未在入组表中找到该医生得账号Id"
- return ResponseOutput.NotOk(_localizer["TaskAllocation_DoctorIdNotFound"]);
- }
-
- addOrEditTaskAllocationRule.EnrollId = enrollId;
-
- var verifyExp1 = new EntityVerifyExp()
- {
- VerifyExp = t => t.DoctorUserId == addOrEditTaskAllocationRule.DoctorUserId && t.TrialId == addOrEditTaskAllocationRule.TrialId,
- // "已有该医生配置,不允许继续增加"
- VerifyMsg = _localizer["TaskAllocation_DoctorConfigExists"]
- };
-
- var entity = await _taskAllocationRuleRepository.InsertOrUpdateAsync(addOrEditTaskAllocationRule, true, verifyExp1);
-
- return ResponseOutput.Ok(entity.Id.ToString());
-
- }
-
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
-
- [HttpDelete("{taskAllocationRuleId:guid}")]
- public async Task DeleteTaskAllocationRule(Guid taskAllocationRuleId)
- {
- if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Where(u => u.TrialId == t.TrialId).Any()))
- {
- //"已分配任务给该医生,不允许删除"
- return ResponseOutput.NotOk(_localizer["TaskAllocation_TaskAssigned"]);
- }
-
- var success = await _taskAllocationRuleRepository.DeleteFromQueryAsync(t => t.Id == taskAllocationRuleId, true);
-
-
- return ResponseOutput.Ok();
- }
-
-
- //public async Task AddSubjectCancelDoctorNote(CancelDoctorCommand command)
- //{
- // await _subjectCanceDoctorRepository.InsertOrUpdateAsync(command, true);
-
- // return ResponseOutput.Ok();
- //}
-
- public async Task> GetSubjectCancelDoctorHistoryList(Guid subjectId)
- {
- var list = await _subjectCanceDoctorRepository.Where(t => t.SubjectId == subjectId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
-
- return list;
- }
-
-
-
-
-
-
- ///
- /// 获取项目下 医生账户信息下拉
- ///
- ///
- ///
- ///
- [HttpGet("{trialId:guid}")]
- public async Task> GetDoctorUserSelectList(Guid trialId, [FromServices] IRepository _enrollRepository)
- {
- var query = from enroll in _enrollRepository.Where(t => t.TrialId == trialId && t.EnrollStatus >= EnrollStatus.ConfirmIntoGroup)
- join user in _userRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId
- select new TrialDoctorUserSelectView()
- {
- TrialId = enroll.TrialId,
- //ReadingType = enroll.Trial.ReadingType,
- DoctorUserId = user.Id,
- FullName = user.FullName,
- UserCode = user.UserCode,
- UserName = user.UserName,
- UserTypeEnum = user.UserTypeRole.UserTypeEnum,
- ReadingCategoryList = enroll.EnrollReadingCategoryList.Select(t => t.ReadingCategory).ToList()
-
- };
-
- return await query.ToListAsync();
- }
-
-
- [HttpPost]
- public async Task> GetDoctorSelectList(DoctorSelectQuery selectQuery, [FromServices] IRepository _enrollRepository)
- {
-
- var query = from allocationRule in _taskAllocationRuleRepository.Where(t => t.TrialId == selectQuery.TrialId && t.IsEnable)
- .WhereIf(selectQuery.ReadingCategory != null && selectQuery.TrialReadingCriterionId == null, t => t.Enroll.EnrollReadingCategoryList.Any(t => t.ReadingCategory == selectQuery.ReadingCategory))
- .WhereIf(selectQuery.TrialReadingCriterionId != null && selectQuery.ReadingCategory == null, t => t.Enroll.EnrollReadingCategoryList.Any(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId))
- .WhereIf(selectQuery.TrialReadingCriterionId != null && selectQuery.ReadingCategory !=null,
- t => t.Enroll.EnrollReadingCategoryList.Any(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId && t.ReadingCategory==selectQuery.ReadingCategory))
- join user in _userRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id
- select new TrialDoctorUserSelectView()
- {
- TrialId = allocationRule.TrialId,
- DoctorUserId = user.Id,
- FullName = user.FullName,
- UserCode = user.UserCode,
- UserName = user.UserName,
- UserTypeEnum = user.UserTypeRole.UserTypeEnum,
-
- ReadingCategoryList = selectQuery.TrialReadingCriterionId == null ?
-
- allocationRule.Enroll.EnrollReadingCategoryList.Where(t=> (selectQuery.ReadingCategory == null ?true: t.ReadingCategory == selectQuery.ReadingCategory) ).Select(t => t.ReadingCategory).OrderBy(t => t).ToList() :
-
- allocationRule.Enroll.EnrollReadingCategoryList
- .Where(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId && (selectQuery.ReadingCategory == null?true : t.ReadingCategory == selectQuery.ReadingCategory) )
- .Select(t => t.ReadingCategory).OrderBy(t => t).ToList()
- };
-
- return await query.ToListAsync();
- }
-
-
- #region 废弃
- ///
- /// 获取访视任务 应用Subject后 医生比率情况
- ///
- ///
- [HttpPost]
- [Obsolete]
- public async Task> GetSubjectApplyDoctorTaskStatList(ApplySubjectCommand assignConfirmCommand)
- {
- var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t => t.TrialId == assignConfirmCommand.TrialId && t.IsJudgeDoctor == assignConfirmCommand.IsJudgeDoctor)
- .ProjectTo(_mapper.ConfigurationProvider, new { subjectIdList = assignConfirmCommand.SubjectIdList, isJudgeDoctor = assignConfirmCommand.IsJudgeDoctor });
-
- return await taskAllocationRuleQueryable.ToListAsync();
- }
-
-
-
- [HttpPost]
- [Obsolete]
- public async Task> GetTaskAllocationRuleList(TaskAllocationRuleQuery queryTaskAllocationRule)
- {
- var taskAllocationRuleQueryable = _taskAllocationRuleRepository.Where(t => t.TrialId == queryTaskAllocationRule.TrialId /*&& t.IsJudgeDoctor == queryTaskAllocationRule.IsJudgeDoctor*/)
- .ProjectTo(_mapper.ConfigurationProvider);
-
-
- //var trialTaskConfig = _trialRepository.Where(t => t.Id == queryTaskAllocationRule.TrialId).ProjectTo(_mapper.ConfigurationProvider, new { isJudgeDoctor = queryTaskAllocationRule.IsJudgeDoctor }).FirstOrDefault();
-
- return await taskAllocationRuleQueryable.ToListAsync();
- }
-
- #endregion
-
-
- }
-}
diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs
deleted file mode 100644
index 1f8480a21..000000000
--- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs
+++ /dev/null
@@ -1,777 +0,0 @@
-//--------------------------------------------------------------------
-// 此代码由T4模板自动生成 byzhouhang 20210918
-// 生成时间 2022-07-01 15:33:04
-// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
-//--------------------------------------------------------------------
-
-using IRaCIS.Core.Domain.Models;
-using Microsoft.AspNetCore.Mvc;
-using IRaCIS.Core.Application.Interfaces;
-using IRaCIS.Core.Application.ViewModel;
-using IRaCIS.Core.Infrastructure;
-using IRaCIS.Core.Domain.Share;
-using System.Linq.Expressions;
-using IRaCIS.Core.Infra.EFCore.Common;
-using System.Linq;
-using Nito.AsyncEx;
-using IRaCIS.Core.Application.Contracts;
-using IRaCIS.Core.Application.Filter;
-
-namespace IRaCIS.Core.Application.Service
-{
- ///
- /// 一致性分析配置表
- ///
- [ApiExplorerSettings(GroupName = "Trial")]
- public class TaskConsistentRuleService : BaseService, ITaskConsistentRuleService
- {
-
- private readonly IRepository _taskConsistentRuleRepository;
- private readonly IRepository _visitTaskRepository;
- private readonly IRepository _subjectUserRepository;
- private readonly IRepository _subjectRepository;
- private readonly IRepository _enrollRepository;
-
- private readonly AsyncLock _mutex = new AsyncLock();
-
- public TaskConsistentRuleService(IRepository visitTaskRepository, IRepository enrollRepository, IRepository taskConsistentRuleRepository, IRepository subjectUserRepository, IRepository subjectRepository)
- {
- _taskConsistentRuleRepository = taskConsistentRuleRepository;
- _visitTaskRepository = visitTaskRepository;
- _subjectUserRepository = subjectUserRepository;
- _subjectRepository = subjectRepository;
- _enrollRepository = enrollRepository;
- }
-
- ///
- /// 设置一致性分析任务失效
- ///
- ///
- ///
- [HttpPost]
- public async Task SetAnalysisTaskInvalid(List taskIdList)
- {
-
-
- await _visitTaskRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.Id), u => new VisitTask() { TaskState = TaskState.NotEffect },true);
-
- await _visitTaskRepository.SaveChangesAsync();
-
- return ResponseOutput.Ok();
-
- }
-
-
- ///
- /// 一致性分析列表 (自身 组内 最后勾选 产生的任务)
- ///
- ///
- ///
- [HttpPost]
- public async Task> GetAnalysisTaskList(VisitTaskQuery queryVisitTask)
- {
- var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId)
- .Where(t => t.IsAnalysisCreate)
-
- .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
-
- .WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
- .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
- .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
- .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
- .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
- .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
- .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState)
- .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
- .WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
- .WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum)
- .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false))
- .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
- .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate))
- .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
- .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1))
- .ProjectTo(_mapper.ConfigurationProvider);
-
- var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) };
-
- var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray);
-
- //var trialTaskConfig = _repository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault();
- return pageList;
- }
-
-
- ///
- /// 为自身一致性分析医生,选择Subejct 列表
- ///
- ///
- ///
- [HttpPost]
- public async Task> GetDoctorSelfConsistentRuleSubjectList(ConsistentQuery inQuery)
- {
- var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId);
-
- var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, inQuery.DoctorUserId).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc);
-
- return pagedList;
- }
-
-
-
- ///
- /// 确认生成自身一致性分析任务
- ///
- ///
- ///
- ///
- [HttpPost]
- [UnitOfWork]
- //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
-
- public async Task ConfirmGenerateSelfConsistentTask(ConsistentConfirmGenerateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
- {
-
-
- var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inCommand.TaskConsistentRuleId);
- var doctorUserId = inCommand.DoctorUserId;
- var trialReadingCriterionId = filterObj.TrialReadingCriterionId;
-
- var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, doctorUserId, inCommand.SubejctIdList).ToListAsync();
-
- //var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj, inCommand.SubejctIdList);
-
- //var list = query.OrderByDescending(t => t.IsHaveGeneratedTask).ToList();
-
- using (await _mutex.LockAsync())
- {
- int maxCodeInt = 0;
-
- foreach (var subject in list)
- {
- //处理 Subject 编号
-
- var blindSubjectCode = string.Empty;
-
- var subjectTask = _visitTaskRepository.Where(t => t.SubjectId == subject.SubjectId && t.TrialReadingCriterionId==trialReadingCriterionId && t.IsSelfAnalysis == true).OrderByDescending(t => t.BlindSubjectCode).FirstOrDefault();
-
- if (subjectTask!=null && subjectTask.BlindSubjectCode != String.Empty)
- {
- blindSubjectCode = subjectTask.BlindSubjectCode;
- }
- else
- {
- var maxCodeStr = _visitTaskRepository.Where(t => t.TrialId == subject.TrialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsSelfAnalysis == true).OrderByDescending(t => t.BlindSubjectCode).Select(t => t.BlindSubjectCode).FirstOrDefault();
-
- if ( !string.IsNullOrEmpty(maxCodeStr))
- {
- int.TryParse(maxCodeStr.Substring(maxCodeStr.Length - filterObj.BlindSubjectNumberOfPlaces), out maxCodeInt);
-
- }
-
- blindSubjectCode = filterObj.BlindTrialSiteCode + (maxCodeInt + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}");
- }
-
- subject.VisitTaskList = subject.VisitTaskList.Take(filterObj.PlanVisitCount).ToList();
-
- subject.VisitTaskList.ForEach(t =>
- {
- t.DoctorUserId = doctorUserId;
- //t.TaskConsistentRuleId = filterObj.Id;
- t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode;
- t.BlindSubjectCode = blindSubjectCode;
- });
-
-
- //最后一个访视添加全局
- if (filterObj.IsGenerateGlobalTask)
- {
- var lastTask = (subject.VisitTaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
-
- var existGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId &&t.TrialReadingCriterionId==trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum == lastTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault();
-
-
- if (existGlobal == null)
- {
- existGlobal = new VisitTaskSimpleDTO()
- {
- SubjectId = lastTask.SubjectId,
- TrialId = lastTask.TrialId,
- ArmEnum = lastTask.ArmEnum,
- ReadingCategory = ReadingCategory.Global,
- TaskName = lastTask.TaskName + "_Global",
- TaskBlindName = lastTask.TaskBlindName + "_Global",
- TrialReadingCriterionId=trialReadingCriterionId,
- };
- }
-
-
- existGlobal.DoctorUserId = doctorUserId;
- existGlobal.BlindSubjectCode = lastTask.BlindSubjectCode;
- existGlobal.BlindTrialSiteCode = lastTask.BlindTrialSiteCode;
-
- subject.VisitTaskList.Add(existGlobal);
- }
-
-
-
- await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
- {
- TrialId = filterObj.TrialId,
-
- ReadingCategory = GenerateTaskCategory.SelfConsistent,
-
-
- //产生的过滤掉已经生成的
- GenerataConsistentTaskList = subject.VisitTaskList.Where(t => t.IsHaveGeneratedTask == false).ToList()
- });
-
- await _visitTaskRepository.SaveChangesAsync();
-
- }
- }
-
- return ResponseOutput.Ok();
-
-
- }
-
-
- ///
- /// 组间一致性分析 选择Subejct 列表
- ///
- ///
- ///
- [HttpPost]
- public async Task> GetGroupConsistentRuleSubjectList(GroupConsistentQuery inQuery)
- {
- var trialId = inQuery.TrialId;
-
- var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.TrialReadingCriterionId==inQuery.TrialReadingCriterionId && t.IsSelfAnalysis == false);
-
-
- if (filterObj == null)
- {
- return new PageOutput();
- }
-
- var query = await GetGroupConsistentQueryAsync(filterObj);
-
-
- var pagedList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc);
-
- return pagedList;
- }
-
-
-
- ///
- /// 确认生成组间一致性分析任务
- ///
- ///
- ///
- ///
- [HttpPost]
- [UnitOfWork]
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
-
- public async Task ConfirmGenerateGroupConsistentTask(GroupConsistentConfirmGenrateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
- {
- var trialId = inCommand.TrialId;
-
- var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.IsSelfAnalysis == false);
-
- var trialReadingCriterionId = filterObj.TrialReadingCriterionId;
-
-
- var query = await GetGroupConsistentQueryAsync(filterObj, inCommand.SubejctIdList);
-
- var subjectList = query.ToList();
-
- var doctorUserIdQuery = from enroll in _repository.Where(t => t.TrialId == trialId).Where(t => t.EnrollReadingCategoryList.Where(t=>t.TrialReadingCriterionId==trialReadingCriterionId).Any(c => c.ReadingCategory == ReadingCategory.Global || c.ReadingCategory == ReadingCategory.Visit))
- join user in _repository.Where() on enroll.DoctorId equals user.DoctorId
- select user.Id;
-
- var configDoctorUserIdList = await doctorUserIdQuery.ToListAsync();
-
- using (await _mutex.LockAsync())
- {
- int maxCodeInt = 0;
-
- foreach (var subject in subjectList.Where(t => t.IsHaveGeneratedTask == false))
- {
-
- //组间一致性分析 也用盲态SubjectCode
- //处理 Subject 编号
-
- var blindSubjectCode = string.Empty;
-
- var subjectTask = _visitTaskRepository.Where(t => t.SubjectId == subject.SubjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsSelfAnalysis==false).OrderByDescending(t => t.BlindSubjectCode).FirstOrDefault();
- if (subjectTask != null && subjectTask.BlindSubjectCode != String.Empty)
- {
- blindSubjectCode = subjectTask.BlindSubjectCode;
- }
- else
- {
- var maxCodeStr = _visitTaskRepository.Where(t => t.TrialId == subject.TrialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsSelfAnalysis == false).OrderByDescending(t => t.BlindSubjectCode).Select(t => t.BlindSubjectCode).FirstOrDefault();
-
- if (!string.IsNullOrEmpty(maxCodeStr))
- {
- int.TryParse(maxCodeStr.Substring(maxCodeStr.Length - filterObj.BlindSubjectNumberOfPlaces), out maxCodeInt);
-
- }
-
- blindSubjectCode = filterObj.BlindTrialSiteCode + (maxCodeInt + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}");
- }
-
-
-
-
-
-
- var subjectAddTaskList = new List();
-
-
- //需要处理的医生
-
- var needAddDoctorUserIdList = configDoctorUserIdList.Except(subject.VisitTaskList.Select(t => (Guid)t.DoctorUserId)).ToList();
-
- if (needAddDoctorUserIdList.Count == 0)
- {
- //"请配置一致性分析的医生"
- throw new BusinessValidationFailedException(_localizer["TaskConsistent_ConsistencyConfigExists"]);
- }
-
-
- foreach (var needAddDoctorUserId in needAddDoctorUserIdList)
- {
-
- //每个医生 都生成处理的任务
- foreach (var task in subject.SubjectTaskVisitList.Take(filterObj.PlanVisitCount))
- {
-
- subjectAddTaskList.Add(new VisitTaskGroupSimpleDTO()
- {
- ReadingCategory = task.ReadingCategory,
- ReadingTaskState = task.ReadingTaskState,
- TaskBlindName = task.TaskBlindName,
- TaskName = task.TaskName,
- TaskState = task.TaskState,
- SubjectId = task.SubjectId,
- VisitTaskNum = task.VisitTaskNum,
- TrialId = task.TrialId,
- DoctorUserId = needAddDoctorUserId,
- ArmEnum = Arm.GroupConsistentArm,
- SouceReadModuleId = task.SouceReadModuleId,
- SourceSubjectVisitId = task.SourceSubjectVisitId,
-
- TrialReadingCriterionId = task.TrialReadingCriterionId,
-
- BlindSubjectCode=blindSubjectCode,
- BlindTrialSiteCode=filterObj.BlindTrialSiteCode
-
-
- });
-
- }
-
- //最后一个访视添加全局
-
- if (filterObj.IsGenerateGlobalTask)
- {
- var lastTask = (subjectAddTaskList.Take(filterObj.PlanVisitCount).Last()).Clone();
-
-
- var existGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum == lastTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault();
-
-
- if (existGlobal == null)
- {
- existGlobal = new VisitTaskSimpleDTO()
- {
- SubjectId = lastTask.SubjectId,
- TrialId = lastTask.TrialId,
- ReadingCategory = ReadingCategory.Global,
- TaskName = lastTask.TaskName + "_Global",
- TaskBlindName = lastTask.TaskBlindName + "_Global",
-
- TrialReadingCriterionId = trialReadingCriterionId,
-
- BlindSubjectCode = blindSubjectCode,
- BlindTrialSiteCode = filterObj.BlindTrialSiteCode
-
- };
- }
-
-
- existGlobal.BlindSubjectCode = blindSubjectCode;
- existGlobal.BlindTrialSiteCode = filterObj.BlindTrialSiteCode;
- existGlobal.ArmEnum = Arm.GroupConsistentArm;
- existGlobal.DoctorUserId = needAddDoctorUserId;
-
- subjectAddTaskList.Add(existGlobal);
- }
-
- }
-
-
- await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand()
- {
- TrialId = filterObj.TrialId,
-
- ReadingCategory = GenerateTaskCategory.GroupConsistent,
-
-
- GenerataGroupConsistentTaskList = subjectAddTaskList
- });
-
-
- await _taskConsistentRuleRepository.SaveChangesAsync();
- }
-
- }
-
-
-
- return ResponseOutput.Ok();
-
-
- }
-
-
-
-
- ///
- /// 仅仅自身一致性时使用(
- ///
- ///
- ///
- ///
- ///
- private IQueryable GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, Guid doctorUserId, List? subejctIdList = null)
- {
- var trialId = filterObj.TrialId;
-
- var trialReadingCriterionId = filterObj.TrialReadingCriterionId;
-
- #region Subejct 维度
-
- Expression> comonTaskFilter = u => u.TrialId == trialId && u.IsAnalysisCreate == false && u.TaskState == TaskState.Effect && u.ReadingTaskState == ReadingTaskState.HaveSigned && u.TrialReadingCriterionId== trialReadingCriterionId &&
- u.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (u.ReReadingApplyState == ReReadingApplyState.Default || u.ReReadingApplyState == ReReadingApplyState.Reject) && u.DoctorUserId == doctorUserId;
-
-
-
-
- if (subejctIdList != null && subejctIdList?.Count > 0)
- {
- comonTaskFilter = comonTaskFilter.And(t => subejctIdList.Contains(t.SubjectId));
- }
-
-
- Expression> visitTaskFilter = comonTaskFilter.And(t => t.ReadingCategory == ReadingCategory.Visit);
-
- ////所选访视数量 的访视 其中必有一个访视后有全局任务
- //if (filterObj.IsHaveReadingPeriod == true)
- //{
- // //这里的过滤条件 不能用 where(comonTaskFilter) 会报错,奇怪的问题 只能重新写一遍
- // visitTaskFilter = visitTaskFilter.And(c => c.Subject.SubjectVisitTaskList.Any(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.ReadingCategory == ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned &&
- // t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)));
-
- //}
-
-
- var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId &&
- t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count() >= filterObj.PlanVisitCount)
- .WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).OrderBy(t => t.VisitTaskNum).Take(filterObj.PlanVisitCount + 1).Any(t => t.ReadingCategory == ReadingCategory.Global))
- ;
-
-
-
- var query = subjectQuery.Select(t => new DoctorSelfConsistentSubjectView()
- {
- TrialId = t.TrialId,
- SiteId = t.SiteId,
- SubjectCode = t.Code,
- TrialSiteCode = t.TrialSite.TrialSiteCode,
- SubjectId = t.Id,
-
- IsReReadingOrBackInfluenceAnalysis=t.IsReReadingOrBackInfluenceAnalysis,
-
- BlindSubjectCode = t.SubjectVisitTaskList.Where(t => t.IsAnalysisCreate && t.TrialReadingCriterionId == trialReadingCriterionId).OrderByDescending(t => t.BlindSubjectCode).Select(t => t.BlindSubjectCode).FirstOrDefault(),
-
- IsHaveGeneratedTask = t.SubjectVisitTaskList.Any(c => c.DoctorUserId == doctorUserId && c.IsSelfAnalysis == true && c.TrialReadingCriterionId==trialReadingCriterionId),
-
-
- ValidVisitCount = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count(),
-
- VisitTaskList = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).OrderBy(t => t.VisitTaskNum).Select(c => new VisitTaskSimpleDTO()
- {
- Id = c.Id,
- ReadingCategory = c.ReadingCategory,
- ReadingTaskState = c.ReadingTaskState,
- TaskBlindName = c.TaskBlindName,
- TaskCode = c.TaskCode,
- TaskName = c.TaskName,
- TaskState = c.TaskState,
- ArmEnum = c.ArmEnum,
- SubjectId = c.SubjectId,
- VisitTaskNum = c.VisitTaskNum,
- TrialId = c.TrialId,
- SourceSubjectVisitId = c.SourceSubjectVisitId,
- SouceReadModuleId = c.SouceReadModuleId,
-
-
-
- TrialReadingCriterionId=c.TrialReadingCriterionId,
- IsClinicalDataSign = c.IsClinicalDataSign,
- IsNeedClinicalDataSign = c.IsNeedClinicalDataSign,
-
- //自身一致性才有意义
- //IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id),
-
- GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global]).Select(c => new VisitTaskSimpleDTO()
- {
- Id = c.Id,
- ReadingCategory = c.ReadingCategory,
- ReadingTaskState = c.ReadingTaskState,
- TaskBlindName = c.TaskBlindName,
- TaskCode = c.TaskCode,
- TaskName = c.TaskName,
- TaskState = c.TaskState,
- ArmEnum = c.ArmEnum,
- SubjectId = c.SubjectId,
- VisitTaskNum = c.VisitTaskNum,
- TrialId = c.TrialId,
- SourceSubjectVisitId = c.SourceSubjectVisitId,
- SouceReadModuleId = c.SouceReadModuleId,
-
- TrialReadingCriterionId = c.TrialReadingCriterionId,
- IsClinicalDataSign = c.IsClinicalDataSign,
- IsNeedClinicalDataSign = c.IsNeedClinicalDataSign,
- }).ToList(),
-
- }).ToList()
- });
-
- return query.OrderByDescending(t => t.IsHaveGeneratedTask);
-
- #endregion
- }
-
-
-
-
- private async Task> GetGroupConsistentQueryAsync(TaskConsistentRule filterObj, List? subejctIdList = null)
- {
-
- var trialId = filterObj.TrialId;
- var trialReadingCriterionId = filterObj.TrialReadingCriterionId;
-
- //var trialConfig = (await _repository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException();
-
-
-
- Expression> comonTaskFilter = u => u.TrialId == trialId && u.IsAnalysisCreate == false && u.TaskState == TaskState.Effect && u.ReadingTaskState == ReadingTaskState.HaveSigned && u.TrialReadingCriterionId == trialReadingCriterionId
- && (u.ReReadingApplyState == ReReadingApplyState.Default || u.ReReadingApplyState == ReReadingApplyState.Reject);
-
-
- if (subejctIdList != null && subejctIdList?.Count > 0)
- {
- comonTaskFilter = comonTaskFilter.And(t => subejctIdList.Contains(t.SubjectId));
- }
-
- Expression> visitTaskFilter = comonTaskFilter.And(t => t.ReadingCategory == ReadingCategory.Visit);
-
-
- ////所选访视数量 的访视 其中必有一个访视后有全局任务
- //if (filterObj.IsHaveReadingPeriod == true)
- //{
- // //visitTaskFilter = visitTaskFilter.And(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Any(u => u.VisitTaskNum == t.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && u.ReadingCategory == ReadingCategory.Global));
-
- // //这里的过滤条件 不能用 where(comonTaskFilter) 会报错,奇怪的问题 只能重新写一遍
- // visitTaskFilter = visitTaskFilter.And(c => c.Subject.SubjectVisitTaskList.Any(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.ReadingCategory == ReadingCategory.Global && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned &&
- // t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now && (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject)));
-
- //}
-
-
- IQueryable subjectQuery = default;
-
- //单重阅片没有组件一致性
-
- subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId &&
- t.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Select(t => t.DoctorUserId).Distinct().Count() == 2 &&
- t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Count() >= filterObj.PlanVisitCount
- )
- .WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).OrderBy(t => t.VisitTaskNum).Take(filterObj.PlanVisitCount * 2 + 2).Any(t => t.ReadingCategory == ReadingCategory.Global))
-
- ;
-
-
-
- var query = subjectQuery.Select(t => new DoctorGroupConsistentSubjectView()
- {
- TrialId = t.TrialId,
- SiteId = t.SiteId,
- SubjectCode = t.Code,
- TrialSiteCode = t.TrialSite.TrialSiteCode,
- SubjectId = t.Id,
- IsReReadingOrBackInfluenceAnalysis = t.IsReReadingOrBackInfluenceAnalysis,
-
- IsHaveGeneratedTask = t.SubjectVisitTaskList.Any(c => c.IsSelfAnalysis == false && c.TrialReadingCriterionId==trialReadingCriterionId),
-
-
- ValidVisitCount = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Count(),
-
- VisitTaskList = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter)
- .Select(c => new VisitTaskGroupSimpleDTO()
- {
- ReadingCategory = c.ReadingCategory,
- ReadingTaskState = c.ReadingTaskState,
- TaskBlindName = c.TaskBlindName,
- TaskName = c.TaskName,
- TaskState = c.TaskState,
- SubjectId = c.SubjectId,
- VisitTaskNum = c.VisitTaskNum,
- TrialId = c.TrialId,
- DoctorUserId = c.DoctorUserId,
-
- SourceSubjectVisitId = c.SourceSubjectVisitId,
- SouceReadModuleId = c.SouceReadModuleId,
-
- TrialReadingCriterionId = c.TrialReadingCriterionId,
- IsClinicalDataSign = c.IsClinicalDataSign,
- IsNeedClinicalDataSign = c.IsNeedClinicalDataSign,
-
- }).ToList()
-
- //
- });
-
- query = query.OrderByDescending(t => t.IsHaveGeneratedTask);
-
- return query;
- }
-
-
-
-
- [HttpPost]
- public async Task GetConsistentRule(TaskConsistentRuleQuery inQuery)
- {
- return await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis && t.TrialReadingCriterionId==inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
- }
-
- ///
- /// 自身一致性分配 配置+ 统计已经生成数量统计表
- ///
- ///
- ///
- [HttpPost]
- public async Task> GetSelfConsistentDoctorStatList(TaskConsistentRuleQuery inQuery)
- {
- var trialId = inQuery.TrialId;
-
- var taskConsistentRuleQueryable = from enroll in _repository.Where(t => t.TrialId == trialId && t.EnrollStatus==EnrollStatus.ConfirmIntoGroup)
- join user in _repository.Where() on enroll.DoctorId equals user.DoctorId
- join taskConsistentRule in _repository.Where(t => t.TrialId == trialId &&t.TrialReadingCriterionId==inQuery.TrialReadingCriterionId && t.IsSelfAnalysis) on enroll.TrialId equals taskConsistentRule.TrialId
- select new TaskConsistentRuleView()
- {
- Id = taskConsistentRule.Id,
- CreateTime = taskConsistentRule.CreateTime,
- BlindTrialSiteCode = taskConsistentRule.BlindTrialSiteCode,
- BlindSubjectNumberOfPlaces = taskConsistentRule.BlindSubjectNumberOfPlaces,
- CreateUserId = taskConsistentRule.CreateUserId,
- IntervalWeeks = taskConsistentRule.IntervalWeeks,
- IsEnable = taskConsistentRule.IsEnable,
- PlanSubjectCount = taskConsistentRule.PlanSubjectCount,
- Note = taskConsistentRule.Note,
- TrialId = taskConsistentRule.TrialId,
- UpdateTime = taskConsistentRule.UpdateTime,
- UpdateUserId = taskConsistentRule.UpdateUserId,
- IsGenerateGlobalTask = taskConsistentRule.IsGenerateGlobalTask,
- IsHaveReadingPeriod = taskConsistentRule.IsHaveReadingPeriod,
- PlanVisitCount = taskConsistentRule.PlanVisitCount,
-
- GeneratedSubjectCount = taskConsistentRule.Trial.VisitTaskList.Where(t => t.IsAnalysisCreate && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.IsSelfAnalysis == true && t.DoctorUserId == user.Id).Select(t => t.SubjectId).Distinct().Count(),
-
- AnalysisDoctorUser = new UserSimpleInfo()
- {
- UserId = user.Id,
- UserCode = user.UserCode,
- FullName = user.FullName,
- UserName = user.UserName
- }
- };
-
-
-
- //if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId))
- //{
- // var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstAsync();
-
- // rule.IsBatchAdd = true;
-
- // await BatchAddOrUpdateTaskConsistentRule(rule);
- //}
-
- //#endregion
-
- //var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId)
- // .ProjectTo(_mapper.ConfigurationProvider);
-
- return await taskConsistentRuleQueryable.ToListAsync();
- }
-
-
-
-
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
-
- public async Task AddOrUpdateTaskConsistentRule(TaskConsistentRuleAddOrEdit addOrEditTaskConsistentRule)
- {
-
- var verifyExp1 = new EntityVerifyExp()
- {
- VerifyExp = t => t.TrialId == addOrEditTaskConsistentRule.TrialId && t.IsSelfAnalysis == addOrEditTaskConsistentRule.IsSelfAnalysis && t.TrialReadingCriterionId==addOrEditTaskConsistentRule.TrialReadingCriterionId,
- //"已有该项目配置,不允许继续增加"
- VerifyMsg = _localizer["TaskConsistent_TaskGenerated"]
- };
-
- if (await _visitTaskRepository.AnyAsync(t => t.IsSelfAnalysis == addOrEditTaskConsistentRule.IsSelfAnalysis && t.TrialId == addOrEditTaskConsistentRule.TrialId && t.TrialReadingCriterionId == addOrEditTaskConsistentRule.TrialReadingCriterionId))
- {
- //"该标准已有Subject 生成了任务,不允许修改配置"
- return ResponseOutput.NotOk(_localizer["TaskConsistent_MedicalAuditTaskExists"]);
- }
-
- var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEditTaskConsistentRule, true, verifyExp1);
-
- return ResponseOutput.Ok(entity.Id.ToString());
-
- }
-
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
-
- [HttpDelete("{taskConsistentRuleId:guid}")]
- public async Task DeleteTaskConsistentRule(Guid taskConsistentRuleId)
- {
- var config = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == taskConsistentRuleId);
-
-
- if (await _visitTaskRepository.AnyAsync(t => t.IsAnalysisCreate && t.TrialId == config.TrialId && t.IsSelfAnalysis == config.IsSelfAnalysis && t.TrialReadingCriterionId==config.TrialReadingCriterionId))
- {
- //"该标准已产生一致性分析任务,不允许删除"
- throw new BusinessValidationFailedException(_localizer["TaskConsistent_SignedTaskCannotBeInvalidated"]);
- }
-
-
-
- var success = await _taskConsistentRuleRepository.DeleteFromQueryAsync(t => t.Id == taskConsistentRuleId, true);
- return ResponseOutput.Ok();
- }
-
-
-
-
-
- }
-}
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
index 0a151eda4..263f052c9 100644
--- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs
@@ -34,8 +34,6 @@ namespace IRaCIS.Core.Application.Service
private readonly IEasyCachingProvider _provider;
private readonly IRepository _subjectVisitRepository;
private readonly IRepository _readingJudgeInfoRepository;
- private readonly IRepository _taskAllocationRuleRepository;
- private readonly IRepository _subjectUserRepository;
private readonly IRepository _readModuleRepository;
private readonly IRepository _readingTaskQuestionAnswerRepository;
private readonly IRepository _readingTableAnswerRowInfoRepository;
@@ -51,10 +49,9 @@ namespace IRaCIS.Core.Application.Service
private readonly IRepository _trialClinicalDataSetRepository;
private readonly IRepository _readingClinicalDataRepository;
- private readonly IRepository _subjectCriteriaEvaluationRepository;
- public VisitTaskHelpeService(IRepository visitTaskRepository, IRepository subjectUserRepository, IRepository trialRepository, IEasyCachingProvider provider,
+ public VisitTaskHelpeService(IRepository visitTaskRepository, IRepository trialRepository, IEasyCachingProvider provider,
IRepository subjectVisitRepository,
IRepository readModuleRepository,
IRepository readingTaskQuestionAnswerRepository,
@@ -63,9 +60,9 @@ namespace IRaCIS.Core.Application.Service
IRepository readingTableQuestionTrialRepository,
IRepository readingQuestionTrialRepository,
IRepository readingJudgeInfoRepository,
- IRepository taskAllocationRuleRepository, IMapper mapper, IUserInfo userInfo, IRepository visitTaskReReadingRepository,
- IRepository trialReadingCriterionRepository, IRepository trialClinicalDataSetRepository, IRepository readingClinicalDataRepository,
- IRepository subjectCriteriaEvaluationRepository)
+ IMapper mapper, IUserInfo userInfo, IRepository visitTaskReReadingRepository,
+ IRepository trialReadingCriterionRepository, IRepository trialClinicalDataSetRepository, IRepository readingClinicalDataRepository
+ )
{
_readingClinicalDataRepository = readingClinicalDataRepository;
_trialClinicalDataSetRepository = trialClinicalDataSetRepository;
@@ -81,12 +78,9 @@ namespace IRaCIS.Core.Application.Service
_provider = provider;
_subjectVisitRepository = subjectVisitRepository;
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
- _taskAllocationRuleRepository = taskAllocationRuleRepository;
- _subjectUserRepository = subjectUserRepository;
_mapper = mapper;
_userInfo = userInfo;
_visitTaskReReadingRepository = visitTaskReReadingRepository;
- _subjectCriteriaEvaluationRepository = subjectCriteriaEvaluationRepository;
_trialReadingCriterionRepository = trialReadingCriterionRepository;
}
@@ -186,7 +180,6 @@ namespace IRaCIS.Core.Application.Service
foreach (var subjectGroup in needGenerateVisit.GroupBy(t => t.SubjectId).Select(g => new { SubjectId = g.Key, SubjectVisitList = g.ToList() }))
{
- var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectGroup.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync();
@@ -314,24 +307,6 @@ namespace IRaCIS.Core.Application.Service
var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated;
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null)
- {
- task1.TaskAllocationState = defaultState;
- //分配给对应Arm的人
- task1.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm1).DoctorUserId;
- task1.AllocateTime = DateTime.Now;
-
- task1.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null)
- {
- task2.TaskAllocationState = defaultState;
- task2.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2).DoctorUserId;
- task2.AllocateTime = DateTime.Now;
- task2.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
}
else if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Single)
{
@@ -374,20 +349,6 @@ namespace IRaCIS.Core.Application.Service
var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated;
- if (assignConfigList.Any(t => t.ArmEnum == Arm.SingleReadingArm))
- {
- singleTask.TaskAllocationState = defaultState;
-
- singleTask.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.SingleReadingArm).DoctorUserId;
-
- singleTask.AllocateTime = DateTime.Now;
-
- singleTask.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
-
-
-
}
await _visitTaskRepository.SaveChangesAsync();
@@ -655,7 +616,7 @@ namespace IRaCIS.Core.Application.Service
{
- var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync();
+ //var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync();
var blindTaskName = string.Empty;
@@ -771,269 +732,7 @@ namespace IRaCIS.Core.Application.Service
}
else
{
- //并且配置了医生
- if (assignConfigList.Count > 0 && trialReadingCriterionConfig.IsFollowVisitAutoAssign)
- {
-
- #region 后续访视 未分配的进行再次分配,重置的或者失效的 需要重新生成新的任务 (PM 有序退回 或者PM 有序 申请重阅)
-
-
- if (trialReadingCriterionConfig.IsReadingTaskViewInOrder)
- {
- //之前有回退到影像上传的访视 那么当前访视一致性核查通过的时候,当前访视生成但是不分配出去(排除失访的)
-
- var beforeBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum < subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed && t.SourceSubjectVisit.IsLostVisit == false).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync();
-
- //之前有回退的,那么当前访视任务生成但是不分配
- if (beforeBackVisitTask != null)
- {
- //不用进行额外处理
-
- //访视2 PM 回退 基线回退 访视2先一致性核查通过,生成访视2任务,但是不分配
- }
- else
- {
- #region 当前访视根据配置规则分配出去
-
- var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated;
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null)
- {
- task1.TaskAllocationState = defaultState;
- //分配给对应Arm的人
- task1.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm1).DoctorUserId;
- task1.AllocateTime = DateTime.Now;
-
- task1.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null)
- {
- task2.TaskAllocationState = defaultState;
- task2.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2).DoctorUserId;
- task2.AllocateTime = DateTime.Now;
- task2.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- #endregion
- }
-
- //后续最近的未一致性核查通过的访视任务
- var followBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed && t.SourceSubjectVisit.IsLostVisit == false).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync();
-
- //大于当前访视 同时小于最近的未一致性核查通过的访视任务分配 或者生成
-
- //存在退回访视1 又退回基线 这种情况 生成任务 考虑基线先一致性核查通过,但是访视1还未通过时 生成任务
- var followVisitTaskList = await _visitTaskRepository
- .Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate == false, true)
- .WhereIf(followBackVisitTask != null, t => t.VisitTaskNum < followBackVisitTask.VisitTaskNum)
- .ToListAsync();
-
- var followVisitGroup = followVisitTaskList.GroupBy(t => t.VisitTaskNum);
-
- //每个访视去判断 是分配还是生成(因为影响哪里有些是取消分配,有些是重阅重置需要重新生成)
- foreach (var visitGroup in followVisitGroup)
- {
-
- var visit = await _subjectVisitRepository.Where(x => x.Id == visitGroup.First().SourceSubjectVisitId).Select(x => new
- {
- x.PDState,
- x.IsEnrollmentConfirm,
- x.IsUrgent,
- }).FirstNotNullAsync();
-
-
- TaskUrgentType? urgentType = null;
-
- if (subjectVisitInfo.PDState == PDStateEnum.PDProgress)
- {
- urgentType = TaskUrgentType.PDProgress;
- }
- else if (subjectVisitInfo.IsEnrollmentConfirm)
- {
- urgentType = TaskUrgentType.EnrollmentConfirm;
- }
- else if (subjectVisitInfo.IsUrgent)
- {
- urgentType = TaskUrgentType.VisitUrgent;
- }
-
- bool isCanEdit = urgentType == TaskUrgentType.EnrollmentConfirm || urgentType == TaskUrgentType.PDProgress ? false : true;
-
- //如果后续访视已分配有效 就不用处理
- if (visitGroup.Any(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated && t.ArmEnum == Arm.DoubleReadingArm1))
- {
- //不做处理
- }
- else
- {
- var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1);
-
- if (arm1 != null)
- {
-
- //有可能仅仅只分配了一个Subject 未分配 那么
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null)
- {
- arm1.IsUrgent = visit.IsUrgent;
- arm1.TaskUrgentType = urgentType;
- arm1.IsCanEditUrgentState = isCanEdit;
- arm1.TaskAllocationState = TaskAllocationState.Allocated;
- arm1.AllocateTime = DateTime.Now;
- arm1.DoctorUserId = task1.DoctorUserId;
- arm1.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- }
- else
- {
- var latestTask = visitGroup.Where(t => t.ArmEnum == Arm.DoubleReadingArm1).OrderByDescending(t => t.CreateTime).First();
-
-
-
-
- var taskOne = await _visitTaskRepository.AddAsync(new VisitTask()
- {
- TrialId = trialId,
- SubjectId = subjectVisit.SubjectId,
- IsUrgent = visit.IsUrgent,
- TaskUrgentType = urgentType,
- IsCanEditUrgentState = isCanEdit,
- ArmEnum = Arm.DoubleReadingArm1,//特殊
- Code = currentMaxCodeInt + 1,
- TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
- ReadingCategory = ReadingCategory.Visit,
-
- SourceSubjectVisitId = latestTask.SourceSubjectVisitId,
- VisitTaskNum = latestTask.VisitTaskNum,
- TaskBlindName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(latestTask.VisitTaskNum),
- TaskName = latestTask.TaskName,
-
- BlindSubjectCode = latestTask.BlindSubjectCode,
- BlindTrialSiteCode = latestTask.BlindTrialSiteCode,
- IsAnalysisCreate = latestTask.IsAnalysisCreate,
- IsSelfAnalysis = latestTask.IsSelfAnalysis,
- TaskAllocationState = TaskAllocationState.Allocated,
- AllocateTime = DateTime.Now,
- DoctorUserId = task1.DoctorUserId,
- SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget),
- TrialReadingCriterionId = latestTask.TrialReadingCriterionId,
- IsNeedClinicalDataSign = latestTask.IsNeedClinicalDataSign,
- IsClinicalDataSign = latestTask.IsClinicalDataSign
- });
-
- currentMaxCodeInt = currentMaxCodeInt + 1;
-
- _provider.Set($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
- }
-
- }
-
- //如果后续访视已分配有效 就不用处理
- if (visitGroup.Any(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated && t.ArmEnum == Arm.DoubleReadingArm2))
- {
- //不做处理
- }
- else
- {
- var arm2 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm2);
- if (arm2 != null)
- {
- //有可能仅仅只分配了一个Subject
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null)
- {
- arm2.IsUrgent = visit.IsUrgent;
- arm2.TaskUrgentType = urgentType;
- arm2.IsCanEditUrgentState = isCanEdit;
- arm2.TaskAllocationState = TaskAllocationState.Allocated;
- arm2.AllocateTime = DateTime.Now;
- arm2.DoctorUserId = task2.DoctorUserId;
- arm2.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- }
- else
- {
- var latestTask = visitGroup.Where(t => t.ArmEnum == Arm.DoubleReadingArm2).OrderByDescending(t => t.CreateTime).First();
-
- var taskTwo = await _visitTaskRepository.AddAsync(new VisitTask()
- {
- TrialId = trialId,
- SubjectId = subjectVisit.SubjectId,
- IsUrgent = visit.IsUrgent,
- TaskUrgentType = urgentType,
- IsCanEditUrgentState = isCanEdit,
-
- //CheckPassedTime = subjectVisit.CheckPassedTime,
- ArmEnum = Arm.DoubleReadingArm2,//特殊
- Code = currentMaxCodeInt + 1,
- TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
- ReadingCategory = ReadingCategory.Visit,
-
- SourceSubjectVisitId = latestTask.SourceSubjectVisitId,
- VisitTaskNum = latestTask.VisitTaskNum,
- TaskBlindName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(latestTask.VisitTaskNum),
- TaskName = latestTask.TaskName,
-
- BlindSubjectCode = latestTask.BlindSubjectCode,
- BlindTrialSiteCode = latestTask.BlindTrialSiteCode,
- IsAnalysisCreate = latestTask.IsAnalysisCreate,
- IsSelfAnalysis = latestTask.IsSelfAnalysis,
- TaskAllocationState = TaskAllocationState.Allocated,
-
- AllocateTime = DateTime.Now,
- DoctorUserId = task2.DoctorUserId,
- SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget),
-
- TrialReadingCriterionId = latestTask.TrialReadingCriterionId,
- IsNeedClinicalDataSign = latestTask.IsNeedClinicalDataSign,
- IsClinicalDataSign = latestTask.IsClinicalDataSign
- });
-
- currentMaxCodeInt = currentMaxCodeInt + 1;
-
- _provider.Set($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
- }
- }
-
- }
-
-
- }
- //无序的时候 生成任务并分配出去
- else
- {
- var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated;
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null)
- {
- task1.TaskAllocationState = defaultState;
- //分配给对应Arm的人
- task1.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm1).DoctorUserId;
- task1.AllocateTime = DateTime.Now;
-
- task1.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null)
- {
- task2.TaskAllocationState = defaultState;
- task2.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2).DoctorUserId;
- task2.AllocateTime = DateTime.Now;
- task2.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
- }
-
-
- #endregion
-
- }
- else
- //后续访视不自动分配,或者配置的医生数量不足,就不进行分配
- {
-
- }
+
}
@@ -1101,148 +800,7 @@ namespace IRaCIS.Core.Application.Service
//}
- //配置了医生
- if (assignConfigList.Count > 0)
- {
-
- #region 重阅/退回的时候,需要将取消分配的访视类型的 任务重新分配
-
- if (trialReadingCriterionConfig.IsReadingTaskViewInOrder)
- {
- //之前有回退到影像上传的访视 那么当前访视一致性核查通过的时候,当前访视生成但是不分配出去(排除失访的)
- var beforeBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum < subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed && t.SourceSubjectVisit.IsLostVisit == false).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync();
-
-
- if (beforeBackVisitTask == null)
- {
- #region 访视2 PM 回退 基线回退 访视2先一致性核查通过,生成访视2任务,但是不分配
-
- var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated;
-
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.SingleReadingArm))
- {
- singleTask.TaskAllocationState = defaultState;
-
- singleTask.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.SingleReadingArm).DoctorUserId;
-
- singleTask.AllocateTime = DateTime.Now;
-
- singleTask.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
-
- #endregion
-
-
- var followBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed && t.SourceSubjectVisit.IsLostVisit == false).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync();
-
- //存在退回访视1 又退回基线 这种情况 生成任务 考虑基线先一致性核查通过,但是访视1还未通过时 生成任务
- var followVisitTaskList = await _visitTaskRepository
- .Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.VisitTaskNum > subjectVisit.VisitNum && t.SourceSubjectVisit.CheckState == CheckStateEnum.CVPassed && t.ReadingCategory == ReadingCategory.Visit && t.IsAnalysisCreate == false, true)
- .WhereIf(followBackVisitTask != null, t => t.VisitTaskNum < followBackVisitTask.VisitTaskNum)
- .ToListAsync();
-
- var followVisitGroup = followVisitTaskList.GroupBy(t => t.VisitTaskNum);
-
- //每个访视去判断 是分配还是生成
-
-
- foreach (var visitGroup in followVisitGroup)
- {
- //如果后续访视已分配有效 就不用处理
- if (visitGroup.Any(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated && t.ArmEnum == Arm.SingleReadingArm))
- {
- //不做处理
- }
-
- else
- {
- var arm = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.SingleReadingArm);
- if (arm != null)
- {
- arm.TaskAllocationState = TaskAllocationState.Allocated;
- arm.AllocateTime = DateTime.Now;
- arm.DoctorUserId = singleTask.DoctorUserId;
- arm.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
- else
- {
- var latestTask = visitGroup.Where(t => t.ArmEnum == Arm.SingleReadingArm).OrderByDescending(t => t.CreateTime).First();
-
- var taskOne = await _visitTaskRepository.AddAsync(new VisitTask()
- {
- TrialId = trialId,
- SubjectId = subjectVisit.SubjectId,
- IsUrgent = subjectVisit.IsUrgent,
- ArmEnum = Arm.SingleReadingArm,//特殊
- Code = currentMaxCodeInt + 1,
- TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
- ReadingCategory = ReadingCategory.Visit,
- TaskUrgentType = latestTask.TaskUrgentType,
- SourceSubjectVisitId = latestTask.SourceSubjectVisitId,
- VisitTaskNum = latestTask.VisitTaskNum,
- TaskBlindName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(latestTask.VisitTaskNum),
- TaskName = latestTask.TaskName,
-
- BlindSubjectCode = latestTask.BlindSubjectCode,
- BlindTrialSiteCode = latestTask.BlindTrialSiteCode,
- IsAnalysisCreate = latestTask.IsAnalysisCreate,
- IsSelfAnalysis = latestTask.IsSelfAnalysis,
- TaskAllocationState = TaskAllocationState.Allocated,
- AllocateTime = DateTime.Now,
- DoctorUserId = singleTask.DoctorUserId,
- SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget),
-
- TrialReadingCriterionId = latestTask.TrialReadingCriterionId,
- IsNeedClinicalDataSign = latestTask.IsNeedClinicalDataSign,
- IsClinicalDataSign = latestTask.IsClinicalDataSign
-
- });
-
- currentMaxCodeInt = currentMaxCodeInt + 1;
-
- _provider.Set($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
- }
- }
-
-
- }
-
- }
- //之前有回退的 后续访视不生成或者分配 当前访视生成但是不分配出去
- else
- {
-
- //不用进行额外处理
- }
-
-
-
- }
- //无序的时候 生成任务并分配出去
- else
- {
- var defaultState = trialReadingCriterionConfig.FollowVisitAutoAssignDefaultState == TaskAllocateDefaultState.InitAllocated ? TaskAllocationState.InitAllocated : TaskAllocationState.Allocated;
-
-
- if (assignConfigList.Any(t => t.ArmEnum == Arm.SingleReadingArm))
- {
- singleTask.TaskAllocationState = defaultState;
-
- singleTask.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.SingleReadingArm).DoctorUserId;
-
- singleTask.AllocateTime = DateTime.Now;
-
- singleTask.SuggesteFinishedTime = GetSuggessFinishTime(true, UrgentType.NotUrget);
- }
-
-
- }
-
- #endregion
-
- }
+
}
}
else
@@ -1493,7 +1051,7 @@ namespace IRaCIS.Core.Application.Service
case GenerateTaskCategory.Judge:
var firstTask = await _visitTaskRepository.Where(x => generateTaskCommand.JudgeVisitTaskIdList.Contains(x.Id)).FirstOrDefaultAsync();
- var subjectUser = await _subjectUserRepository.Where(x => x.SubjectId == firstTask.SubjectId && x.ArmEnum == Arm.JudgeArm && x.IsConfirmed && x.TrialReadingCriterionId == firstTask.TrialReadingCriterionId).FirstOrDefaultAsync();
+
VisitTask visitTask = new VisitTask()
{
@@ -1512,10 +1070,6 @@ namespace IRaCIS.Core.Application.Service
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
TaskState = TaskState.Effect,
TaskBlindName = firstTask.TaskBlindName,
- DoctorUserId = subjectUser == null ? null : subjectUser.DoctorUserId,
- TaskAllocationState = subjectUser == null ? TaskAllocationState.NotAllocate : TaskAllocationState.Allocated,
- AllocateTime = subjectUser == null ? null : DateTime.Now,
- SuggesteFinishedTime = subjectUser == null ? null : GetSuggessFinishTime(true, UrgentType.NotUrget),
TrialReadingCriterionId = firstTask.TrialReadingCriterionId,
@@ -1598,8 +1152,7 @@ namespace IRaCIS.Core.Application.Service
foreach (var item in generateTaskCommand.ReadingGenerataTaskList)
{
- //需要 根据标准筛选
- var oncologySubjectUser = await _subjectUserRepository.Where(x => x.SubjectId == item.SubjectId && x.ArmEnum == Arm.TumorArm && x.IsConfirmed && x.TrialReadingCriterionId == originalTaskInfo.TrialReadingCriterionId).FirstOrDefaultAsync();
+
item.VisitNum = await _readModuleRepository.Where(x => x.Id == item.ReadModuleId).Select(x => x.SubjectVisit.VisitNum).FirstOrDefaultAsync();
@@ -1618,10 +1171,7 @@ namespace IRaCIS.Core.Application.Service
SouceReadModuleId = item.ReadModuleId,
TaskBlindName = item.ReadingName,
- DoctorUserId = oncologySubjectUser == null ? null : oncologySubjectUser.DoctorUserId,
- AllocateTime = oncologySubjectUser == null ? null : DateTime.Now,
- TaskAllocationState = oncologySubjectUser == null ? TaskAllocationState.NotAllocate : TaskAllocationState.Allocated,
- SuggesteFinishedTime = oncologySubjectUser == null ? null : GetSuggessFinishTime(true, UrgentType.NotUrget),
+
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)),
ReadingCategory = item.ReadingCategory,
diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
index 7f0a3004e..d70a1bcc7 100644
--- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs
@@ -37,9 +37,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
private readonly IRepository _visitTaskRepository;
private readonly IRepository _trialRepository;
private readonly IRepository _subjectVisitRepository;
- private readonly IRepository _taskAllocationRuleRepository;
private readonly IRepository _subjectRepository;
- private readonly IRepository _subjectUserRepository;
private readonly IRepository _readModuleRepository;
private readonly IRepository _visitTaskReReadingRepository;
@@ -47,43 +45,34 @@ namespace IRaCIS.Core.Application.Service.Allocation
private readonly IRepository _readingTaskQuestionAnswerRepository;
private readonly IRepository _readingClinicalDataReposiotry;
- private readonly IRepository _subjectCriteriaEvaluationRepository;
- private readonly IRepository _subjectCriteriaEvaluationVisitFilterRepository;
+
private readonly IRepository _trialReadingCriterionRepository;
- private readonly IRepository _subjectCriteriaEvaluationVisitStudyFilterRepository;
+
private readonly IRepository _PIAuditRepository;
public VisitTaskService(IRepository subjectVisitRepository, IRepository visitTaskRepository, IRepository trialRepository,
- IRepository subjectRepository, IRepository subjectUserRepository, IRepository taskAllocationRuleRepository,
+ IRepository subjectRepository,
IRepository readModuleRepository, IRepository visitTaskReReadingRepository,
IRepository taskMedicalReviewRepository,
IRepository readingTaskQuestionAnswerRepository
, IRepository trialReadingCriterionRepository,
IRepository readingClinicalDataReposiotry,
- IRepository subjectCriteriaEvaluationRepository,
- IRepository subjectCriteriaEvaluationVisitFilterRepository,
- IRepository subjectCriteriaEvaluationVisitStudyFilterRepository,
IRepository PIAuditRepository
)
{
_PIAuditRepository = PIAuditRepository;
_readingClinicalDataReposiotry = readingClinicalDataReposiotry;
- _taskAllocationRuleRepository = taskAllocationRuleRepository;
_visitTaskRepository = visitTaskRepository;
_trialRepository = trialRepository;
_subjectVisitRepository = subjectVisitRepository;
_subjectRepository = subjectRepository;
- _subjectUserRepository = subjectUserRepository;
_readModuleRepository = readModuleRepository;
_visitTaskReReadingRepository = visitTaskReReadingRepository;
_taskMedicalReviewRepository = taskMedicalReviewRepository;
_readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
-
_trialReadingCriterionRepository = trialReadingCriterionRepository;
- _subjectCriteriaEvaluationRepository = subjectCriteriaEvaluationRepository;
- _subjectCriteriaEvaluationVisitFilterRepository = subjectCriteriaEvaluationVisitFilterRepository;
- _subjectCriteriaEvaluationVisitStudyFilterRepository = subjectCriteriaEvaluationVisitStudyFilterRepository;
+
}
///
@@ -1196,7 +1185,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
await SetMedicalReviewInvalidAsync(influenceTaskList, false);
- await InfluenceAddtioncalEvaluationCritrionAsync(origenalTask, influenceTaskList.Where(t => t.Id != origenalTask.Id).Where(t => t.SourceSubjectVisitId != null).Select(t => (Guid)t.SourceSubjectVisitId).Distinct().ToList(), false);
+
}
@@ -1597,7 +1586,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
if (influenceTask.Id == task.Id)
{
- await InfluenceAddtioncalEvaluationCritrionAsync(task, influenceTaskList.Where(t => t.Id != task.Id).Where(t => t.SourceSubjectVisitId != null).Select(t => (Guid)t.SourceSubjectVisitId).Distinct().ToList());
+
await SetReReadingOrBackInfluenceAnalysisAsync(influenceTask.SubjectId);
@@ -1675,65 +1664,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
}
- ///
- /// 基线退回 影响附加评估标准 是否参与评估
- ///
- ///
- private async Task InfluenceAddtioncalEvaluationCritrionAsync(VisitTask task, List otherVisitIdList, bool isImageBack = true)
- {
-
- var criterion = await _trialReadingCriterionRepository.FindAsync(task.TrialReadingCriterionId);
-
- if (criterion.CriterionType == CriterionType.RECIST1Point1)
- {
- //影像回退了|| IR 申请及基线重阅
- if (_subjectVisitRepository.Any(t => t.Id == task.SourceSubjectVisitId && t.IsBaseLine))
- {
- await _subjectCriteriaEvaluationRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterion.IsAutoCreate == false && t.SubjectId == task.SubjectId, u => new SubjectCriteriaEvaluation()
- {
- IsJoinEvaluation = false
- });
-
- //删除筛选的访视数据
- await _subjectCriteriaEvaluationVisitFilterRepository.BatchDeleteNoTrackingAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectId == task.SubjectId);
-
- //删除筛选的序列数据
- await _subjectCriteriaEvaluationVisitStudyFilterRepository.BatchDeleteNoTrackingAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectVisit.SubjectId == task.SubjectId);
- }
- else if (isImageBack)
- {
- //当前访视筛选状态重置,任务生成状态重置
- if (task.SourceSubjectVisitId != null)
- {
- await _subjectCriteriaEvaluationVisitFilterRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectVisit.SubjectId == task.SubjectId && t.SubjectVisitId == task.SourceSubjectVisitId,
- t => new SubjectCriteriaEvaluationVisitFilter()
- {
- ImageFilterState = ImageFilterState.None,
- ImageDeterminationResultState = ImageDeterminationResultState.None,
- IsGeneratedTask = false
- });
-
- //删除序列数据
- await _subjectCriteriaEvaluationVisitStudyFilterRepository.BatchDeleteNoTrackingAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectVisit.SubjectId == task.SubjectId && t.SubjectVisitId == task.SourceSubjectVisitId);
- }
-
-
- //BM后续访视 ,筛选状态不变,任务生成状态重置(实际该访视任务状态 可能是重阅重置了或者失效了,需要后续生成,或者取消分配了,需要后续重新分配)
- await _subjectCriteriaEvaluationVisitFilterRepository.UpdatePartialFromQueryAsync(t => t.TrialReadingCriterion.CriterionType == CriterionType.RECIST1Pointt1_MB && t.SubjectVisit.SubjectId == task.SubjectId && otherVisitIdList.Contains(t.SubjectVisitId),
- t => new SubjectCriteriaEvaluationVisitFilter()
- {
- IsGeneratedTask = false
- });
- }
- else
- {
- //IR 端 非基线申请重阅 不影响
- }
- }
-
-
-
- }
+
//包括临床数据签名状态
private async Task VisitBackAsync(Guid? subjectVisitId)
diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
index 3ff2a3733..87f49d9ca 100644
--- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs
@@ -18,93 +18,30 @@ namespace IRaCIS.Core.Application.Service
CreateMap();
- CreateMap()
- .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
- .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
- .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
- .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName));
List subjectIdList = new List();
bool isJudgeDoctor = false;
-
- CreateMap()
- .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
- .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
- .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
- .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
- //.ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct()))
- .ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count()))
- .ForMember(o => o.SelfUndoTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId && t.ReadingTaskState != ReadingTaskState.HaveSigned)))
- .ForMember(o => o.TotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count()))
- .ForMember(o => o.SelfApplyedTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId)))
- .ForMember(o => o.ApplyedTotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId != null)))
-
- //.ForMember(o => o.SelfApplyedSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any(c => c.DoctorUserId != null)).Count()))
- .ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count()))
-
- .ForMember(o => o.ApplyedTotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count(c => c.SubjectVisitTaskList.Any(d => d.DoctorUserId != null))))
-
-
-
- //该医生未应用Subject 数量
- //.ForMember(o => o.WaitApplySelfSubjectCount, t => t.MapFrom(u =>
- // subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
- // : u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(t.SubjectId) && t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
- // ))
-
-
- .ForMember(o => o.WaitApplyTotalSubjectCount, t => t.MapFrom(u =>
- subjectIdList.Count == 0 ? u.Trial.SubjectList.Where(t => t.SubjectVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
- : u.Trial.SubjectList.Where(t => subjectIdList.Contains(t.Id) && t.SubjectVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any(c => c.DoctorUserId == null)).Count()
- ))
-
- //.ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u =>
- //subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count()
- //: u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null)).Count()
- // ))
-
- .ForMember(o => o.WaitApplyTotalTaskCount, t => t.MapFrom(u =>
- subjectIdList.Count == 0 ? u.Trial.VisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null).Count()
- : u.Trial.VisitTaskList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Where(t => t.DoctorUserId == null && subjectIdList.Contains(t.SubjectId)).Count()))
-
- ;
-
var trialReadingCriterionId = Guid.Empty;
- CreateMap()
- .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser))
- .ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId })))
- .ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.ReadingQuestionCriterionTrialList.Where(t => t.IsConfirm)))
- .ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId).OrderBy(t => t.ReadingCategory).Select(t => t.ReadingCategory).ToList()))
- ;
CreateMap()
.ForMember(t => t.TrialReadingCriterionId, u => u.MapFrom(c => c.Id))
.ForMember(t => t.TrialReadingCriterionName, u => u.MapFrom(c => c.CriterionName));
- CreateMap().IncludeBase()
- .ForMember(o => o.AssignedSubjectCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.TrialId == u.TrialId).Select(t => t.SubjectId).Distinct().Count()))
- .ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.TrialId == u.TrialId).Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count()))
- .ForMember(o => o.WaitDealAllTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count()));
-
-
CreateMap()
.ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code))
- .ForMember(o => o.VisitTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TrialReadingCriterionId==trialReadingCriterionId && t.TaskState==TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
+ .ForMember(o => o.VisitTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Visit && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
.ForMember(o => o.GlobalTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
.ForMember(o => o.OncologyTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Oncology && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
- .ForMember(o => o.JudgeTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()))
- .ForMember(o => o.DoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId)));
+ .ForMember(o => o.JudgeTaskTypeCount, t => t.MapFrom(u => u.SubjectVisitTaskList.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect).Select(t => t.VisitTaskNum).Distinct().Count()));
- CreateMap()
- .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser));
+
- CreateMap().IncludeBase()
- .ForMember(o => o.IsHaveReading, t => t.MapFrom(u => u.Subject.SubjectVisitTaskList.Any(t => t.ReadingTaskState != ReadingTaskState.WaitReading && t.TrialReadingCriterionId==u.TrialReadingCriterionId && t.DoctorUserId==u.DoctorUserId)));
+
CreateMap();
@@ -154,9 +91,7 @@ namespace IRaCIS.Core.Application.Service
- CreateMap();
-
- CreateMap();
+
@@ -189,22 +124,17 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.SubjectId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Code))
- .ForMember(o => o.IsJudge, t => t.MapFrom(u => isJudgeDoctor))
- .ForMember(o => o.IsAssignedDoctorUser, t => t.MapFrom(u => u.SubjectDoctorList.Where(t => isJudgeDoctor ? t.ArmEnum == Arm.JudgeArm : t.ArmEnum != Arm.JudgeArm).Any()))
+ .ForMember(o => o.IsJudge, t => t.MapFrom(u => isJudgeDoctor));
+
- .ForMember(o => o.TotalDoctorUserList, t => t.MapFrom(u => u.SubjectDoctorList.Where(t => isJudgeDoctor ? true : t.ArmEnum != Arm.JudgeArm).OrderBy(t => t.ArmEnum)));
-
- CreateMap()
- //.ForMember(o => o.AssignTime, t => t.MapFrom(u => u.AssignTime))
- .ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
- .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
- .ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
- .ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName));
+
- CreateMap();
+
+
+
CreateMap()
@@ -292,11 +222,6 @@ namespace IRaCIS.Core.Application.Service
//CreateMap()
// .ForMember(o => o.GeneratedSubjectCount, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == u.Id).Select(t => t.SubjectId).Distinct().Count())) ;
- CreateMap();
-
- CreateMap();
-
- CreateMap().ForMember(t => t.Id, u => u.Ignore()).ReverseMap();
CreateMap()
diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs
index cc5bf300d..9d5aa7e7f 100644
--- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs
+++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs
@@ -16,9 +16,7 @@ namespace IRaCIS.Application.Services
public class DictionaryService : BaseService, IDictionaryService
{
private readonly IRepository _dicRepository;
- private readonly IRepository _doctorDictionaryRepository;
private readonly IRepository _trialDictionaryRepository;
- private readonly IRepository _doctorRepository;
private readonly IRepository _trialRepository;
private readonly IRepository _systemCriterionDictionaryCodeRepository;
private readonly IRepository _trialCriterionDictionaryCodeRepository;
@@ -29,8 +27,8 @@ namespace IRaCIS.Application.Services
private readonly IRepository _readingQuestionCriterionTrial;
private readonly IReadingQuestionService _readingQuestionService;
- public DictionaryService(IRepository sysDicRepository, IRepository doctorDictionaryRepository, IRepository trialDictionaryRepository,
- IRepository doctorRepository, IRepository trialRepository,
+ public DictionaryService(IRepository sysDicRepository, IRepository trialDictionaryRepository,
+ IRepository trialRepository,
IRepository systemCriterionDictionaryCodeRepository,
IRepository trialCriterionDictionaryCodeRepository,
@@ -44,9 +42,9 @@ namespace IRaCIS.Application.Services
)
{
_dicRepository = sysDicRepository;
- _doctorDictionaryRepository = doctorDictionaryRepository;
+
_trialDictionaryRepository = trialDictionaryRepository;
- _doctorRepository = doctorRepository;
+
_trialRepository = trialRepository;
this._systemCriterionDictionaryCodeRepository = systemCriterionDictionaryCodeRepository;
this._trialCriterionDictionaryCodeRepository = trialCriterionDictionaryCodeRepository;
@@ -229,14 +227,6 @@ namespace IRaCIS.Application.Services
return ResponseOutput.NotOk(_localizer["Dictionary_SubitemDeletion"]);
}
- if ((await _doctorDictionaryRepository.AnyAsync(t => t.DictionaryId == id)) ||
- (await _doctorRepository.AnyAsync(t => t.SpecialityId == id || t.PositionId == id || t.DepartmentId == id || t.RankId == id))
-
- )
- {
- //---当前条目已经在阅片人的简历中被引用。
- return ResponseOutput.NotOk(_localizer["Dictionary_ResumeReference"]);
- }
if (await _trialDictionaryRepository.AnyAsync(t => t.DictionaryId == id) ||
await _trialRepository.AnyAsync(t => t.ReviewModeId == id))
diff --git a/IRaCIS.Core.Application/Service/Common/FileService.cs b/IRaCIS.Core.Application/Service/Common/FileService.cs
index ecbce02cd..492b460f3 100644
--- a/IRaCIS.Core.Application/Service/Common/FileService.cs
+++ b/IRaCIS.Core.Application/Service/Common/FileService.cs
@@ -11,180 +11,25 @@ namespace IRaCIS.Application.Services
public class FileService : IFileService
{
- private readonly IDoctorService _doctorService;
- private readonly IAttachmentService _attachmentService;
+
private readonly IWebHostEnvironment _hostEnvironment;
private string defaultUploadFilePath = string.Empty;
private readonly ILogger _logger;
- public FileService(IDoctorService doctorService, IAttachmentService attachmentService,
+ public FileService(
IWebHostEnvironment hostEnvironment, ILogger logger)
{
- _doctorService = doctorService;
- _attachmentService = attachmentService;
+
_hostEnvironment = hostEnvironment;
defaultUploadFilePath = FileStoreHelper.GetIRaCISRootPath(_hostEnvironment);
_logger = logger;
}
- ///
- /// 打包医生官方简历
- ///
- ///
- ///
- ///
- public async Task CreateOfficialResumeZip(int language, Guid[] doctorIds)
- {
-
- //准备下载文件的临时路径
- var guidStr = Guid.NewGuid().ToString();
-
- string uploadFolderPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "UploadFile");
-
-
-
- var tempSavePath = Path.Combine(uploadFolderPath, "temp", guidStr); //待压缩的文件夹,将需要下载的文件拷贝到此文件夹
- if (!Directory.Exists(tempSavePath))
- {
- Directory.CreateDirectory(tempSavePath);
- }
-
- //找到服务器简历路径 循环拷贝简历到临时路径
- foreach (var doctorId in doctorIds)
- {
- var doctor = await _doctorService.GetBasicInfo(doctorId);
- var doctorName = doctor.FirstName + "_" + doctor.LastName;
-
- //找官方简历存在服务器的相对路径
- var sourceCvPath = await _attachmentService.GetDoctorOfficialCV(language, doctorId);
- if (!string.IsNullOrWhiteSpace(sourceCvPath))
- {
- //服务器简历文件实际路径
- //var sourceCvFullPath = HostingEnvironment.MapPath(sourceCvPath);
- var sourceCvPathTemp = sourceCvPath.Substring(1, sourceCvPath.Length - 1);//.Replace('/','\\');
- string sourceCvFullPath = Path.Combine(defaultUploadFilePath, sourceCvPathTemp);
-
- var arr = sourceCvPath.Split('.');
- string extensionName = arr[arr.Length - 1]; //得到扩展名
-
- //需要拷贝到的路径
- var doctorPath = Path.Combine(tempSavePath, doctor.ReviewerCode.ToString() + "_" + doctorName + "." + extensionName);
-
- if (File.Exists(sourceCvFullPath))
- {
- File.Copy(sourceCvFullPath, doctorPath, true);
- }
- }
- }
-
- //创建ZIP
- DateTime now = DateTime.Now;
- StringBuilder sb = new StringBuilder();
- sb.Append(now.Year).Append(now.Month.ToString().PadLeft(2, '0')).Append(now.Day.ToString().PadLeft(2, '0'))
- .Append(now.Hour.ToString().PadLeft(2, '0')).Append(now.Minute.ToString().PadLeft(2, '0'))
- .Append(now.Second.ToString().PadLeft(2, '0')).Append(now.Millisecond.ToString().PadLeft(3, '0'));
-
- string targetZipPath = Path.Combine(uploadFolderPath, "CV_" + sb.ToString() + ".zip");
- ZipHelper.CreateZip(tempSavePath, targetZipPath);
-
- //返回Zip路径
- return Path.Combine("/IRaCISData/UploadFile/", "CV_" + sb.ToString() + ".zip");
- }
-
- ///
- /// 打包医生的所有附件
- ///
- ///
- ///
- public async Task CreateDoctorsAllAttachmentZip(Guid[] doctorIds)
- {
- //准备下载文件的临时路径
- var guidStr = Guid.NewGuid().ToString();
- //string uploadFolderPath = HostingEnvironment.MapPath("/UploadFile/");
- string uploadFolderPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "UploadFile");
- var tempSavePath = Path.Combine(uploadFolderPath, "temp", guidStr); //待压缩的文件夹,将需要下载的文件拷贝到此文件夹
- if (!Directory.Exists(tempSavePath))
- {
- Directory.CreateDirectory(tempSavePath);
- }
+
- foreach (var doctorId in doctorIds)
- {
- //获取医生基本信息
- var doctor = await _doctorService.GetBasicInfo(doctorId);
- var doctorName = doctor.FirstName + "_" + doctor.LastName;
- var doctorCode = doctor.ReviewerCode;
- var doctorDestPath = Path.Combine(tempSavePath, doctorCode + "_" + doctorName);
- if (!Directory.Exists(doctorDestPath))
- {
- Directory.CreateDirectory(doctorDestPath);
- }
-
- //服务器上传后的源路径
- string doctorFileSourcePath = Path.Combine(uploadFolderPath, doctorId.ToString());
-
- if (Directory.Exists(doctorFileSourcePath))
- {
- CopyDirectory(doctorFileSourcePath, doctorDestPath);
- }
- }
- string target = Guid.NewGuid().ToString();
- string targetPath = Path.Combine(uploadFolderPath, target + ".zip");
- ZipHelper.CreateZip(tempSavePath, targetPath);
- return Path.Combine("/IRaCISData/UploadFile/", target + ".zip");
- }
-
-
- public async Task CreateZipPackageByAttachment(Guid doctorId, Guid[] attachmentIds)
- {
- var doctor = await _doctorService.GetBasicInfo(doctorId);
- var doctorName = doctor.FirstName + "_" + doctor.LastName;
-
- Guid temp = Guid.NewGuid();
- //string root = HostingEnvironment.MapPath("/UploadFile/"); //文件根目录
- string root = Path.Combine(defaultUploadFilePath, "UploadFile");
-
- var tempPath = Path.Combine(root, "temp", temp.ToString(), doctor.ReviewerCode + doctorName); //待压缩的文件夹,将需要下载的文件拷贝到此文件夹
- var packagePath = Path.Combine(root, "temp", temp.ToString()); //打包目录
- if (!Directory.Exists(tempPath))
- {
- Directory.CreateDirectory(tempPath);
- }
- var attachemnts = (await _attachmentService.GetAttachments(doctorId)).Where(a => attachmentIds.Contains(a.Id));
-
- foreach (var item in attachemnts)
- {
- var arr = item.Path.Trim().Split('/');
- var myPath = string.Empty;
- var myFile = string.Empty;
- //需要改进
- if (arr.Length > 0)
- {
- myFile = arr[arr.Length - 1];
- foreach (var arrItem in arr)
- {
- if (arrItem != string.Empty && !"UploadFile".Equals(arrItem))
- {
- myPath += (arrItem + "/");
- }
- }
- myPath = myPath.TrimEnd('/');
- }
- var sourcePath = Path.Combine(root, myPath);
-
- if (!string.IsNullOrWhiteSpace(sourcePath) && File.Exists(sourcePath))
- {
- File.Copy(sourcePath, Path.Combine(tempPath, myFile), true);
- }
- }
- string target = Guid.NewGuid().ToString();
- string targetPath = Path.Combine(root, target + ".zip");
- ZipHelper.CreateZip(packagePath, targetPath);
-
- return Path.Combine("/IRaCISData/UploadFile/", target + ".zip");
- }
+
private static void CopyDirectory(string srcPath, string destPath)
{
diff --git a/IRaCIS.Core.Application/Service/Common/Interface/IFileService.cs b/IRaCIS.Core.Application/Service/Common/Interface/IFileService.cs
index 10c6c072a..de11278f9 100644
--- a/IRaCIS.Core.Application/Service/Common/Interface/IFileService.cs
+++ b/IRaCIS.Core.Application/Service/Common/Interface/IFileService.cs
@@ -8,10 +8,10 @@ namespace IRaCIS.Application.Interfaces
//IResponseOutput DownloadOfficialResume(Guid[] doctorIds);
- Task CreateOfficialResumeZip(int language, Guid[] doctorIds);
+
- Task CreateDoctorsAllAttachmentZip(Guid[] doctorIds);
+
- Task CreateZipPackageByAttachment(Guid doctorId, Guid[] attachmentIds);
+
}
}
diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs
index 5f6e58120..2a4e0bb2d 100644
--- a/IRaCIS.Core.Application/Service/Common/MailService.cs
+++ b/IRaCIS.Core.Application/Service/Common/MailService.cs
@@ -32,7 +32,7 @@ namespace IRaCIS.Application.Services
Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
- Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl);
+
}
@@ -53,7 +53,7 @@ namespace IRaCIS.Application.Services
private readonly IRepository _trialRepository;
private readonly IRepository _userTypeRepository;
- private readonly IRepository _doctorTypeRepository;
+
private readonly AsyncLock _mutex = new AsyncLock();
@@ -68,7 +68,6 @@ namespace IRaCIS.Application.Services
ITokenService tokenService,
IRepository trialRepository,
IRepository userTypeRepository,
- IRepository doctorTypeRepository,
IMapper mapper, IOptionsMonitor systemEmailConfig)
{
_systemEmailConfig = systemEmailConfig.CurrentValue;
@@ -84,7 +83,6 @@ namespace IRaCIS.Application.Services
_trialRepository = trialRepository;
_userTypeRepository = userTypeRepository;
- _doctorTypeRepository = doctorTypeRepository;
}
@@ -598,122 +596,6 @@ namespace IRaCIS.Application.Services
}
- //医生生成账号加入 或者已存在账号加入到项目中
- public async Task DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl)
- {
- var doctor = await _doctorTypeRepository.FindAsync(doctorId);
- User sysUserInfo = null;
-
- var userType = await _userTypeRepository.FirstAsync(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer);
-
- using (await _mutex.LockAsync())
- {
- var isDoctorHaveAccount = await _userRepository.AnyAsync(t => t.DoctorId == doctorId);
-
-
- if (!isDoctorHaveAccount)
- {
-
- var saveItem = new User() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail };
-
- var trialType = await _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefaultAsync();
-
- if (trialType == TrialType.NoneOfficial)
- {
- saveItem.IsTestUser = true;
- }
-
-
- saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
-
- saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User));
-
- saveItem.UserName = saveItem.UserCode;
-
- saveItem.UserTypeEnum = UserTypeEnum.IndependentReviewer;
-
- saveItem.DoctorId = doctorId;
- saveItem.UserTypeId = userType.Id;
-
- var savedUser = await _userRepository.AddAsync(saveItem);
-
- //下面获取Token 需要这部分信息
- sysUserInfo = savedUser.Clone();
-
- sysUserInfo.UserTypeRole = userType;
-
- await _userRepository.SaveChangesAsync();
-
- }
- else
- {
- sysUserInfo = (await _userRepository.Where(t => t.DoctorId == doctorId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
- }
- }
-
-
- var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
-
- var messageToSend = new MimeMessage();
- //发件地址
- messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
- //收件地址
- messageToSend.To.Add(new MailboxAddress(doctor.FullName, doctor.EMail));
- //主题
- // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信";
- messageToSend.Subject = _localizer["Mail_InvitationEmail", trialInfo.ResearchProgramNo];
-
-
- var builder = new BodyBuilder();
-
-
- var basicInfo = IRaCISClaims.Create(_mapper.Map(sysUserInfo));
-
- ////第一次添加的时候 注意赋值
- //basicInfo.PermissionStr = userType.PermissionStr;
- //basicInfo.UserTypeShortName = userType.UserTypeShortName;
-
- var token = _tokenService.GetToken(basicInfo);
-
- if (sysUserInfo.IsFirstAdd)
- {
- await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
- }
-
-
- var pathToFile = _hostEnvironment.WebRootPath
- + Path.DirectorySeparatorChar.ToString()
- + "EmailTemplate"
- + Path.DirectorySeparatorChar.ToString()
- + (sysUserInfo.IsFirstAdd ? (_userInfo.IsEn_Us ? "TrialDoctorFirstJoin_US.html" : "TrialDoctorFirstJoin.html") : (_userInfo.IsEn_Us ? "TrialDoctorExistJoin_US.html" : "TrialDoctorExistJoin.html") );
-
- using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
- {
- var templateInfo = SourceReader.ReadToEnd();
-
- var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + userType.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
-
- var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
-
- var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
-
- builder.HtmlBody = string.Format(templateInfo,
- sysUserInfo.FullName,
- trialInfo.ExperimentName,
- trialInfo.ResearchProgramNo,
- trialInfo.TrialCode,
- sysUserInfo.UserName,
- userType.UserTypeShortName,
- sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
- );
- }
-
- messageToSend.Body = builder.ToMessageBody();
-
- await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
-
- return sysUserInfo.Id;
- }
diff --git a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs
deleted file mode 100644
index 0d1f65194..000000000
--- a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs
+++ /dev/null
@@ -1,254 +0,0 @@
-using IRaCIS.Application.Interfaces;
-using IRaCIS.Application.Contracts;
-using IRaCIS.Core.Infra.EFCore;
-using IRaCIS.Core.Domain.Models;
-using IRaCIS.Core.Infrastructure.Extention;
-using Microsoft.AspNetCore.Mvc;
-using Panda.DynamicWebApi.Attributes;
-
-namespace IRaCIS.Application.Services
-{
- ///
- /// 医生文档关联关系维护
- ///
- [ApiExplorerSettings(GroupName = "Reviewer")]
- public class AttachmentService : BaseService, IAttachmentService
- {
- private readonly IRepository _attachmentrepository;
-
- public AttachmentService(IRepository attachmentrepository)
- {
- this._attachmentrepository = attachmentrepository;
- }
-
- ///
- /// 删除附件
- ///
- ///
- ///
-
- public async Task DeleteAttachment([FromBody]AttachementCommand param)
- {
- //var attachment = _doctorAttachmentApp.GetDetailById(id);
- //string file = HostingEnvironment.MapPath(attachment.Path);
-
- //if (File.Exists(file))
- //{
- // File.Delete(file);
- //}
- //var temp = HostingEnvironment.MapPath(param.Path);
- //if (File.Exists(temp))
- //{
- // File.Delete(temp);
- //}
-
- var success =await _attachmentrepository.BatchDeleteNoTrackingAsync(a => a.Id == param.Id);
- return ResponseOutput.Result(success);
- }
-
-
- ///
- /// 根据医生Id 和 附件类型,获取记录
- ///
- /// 医生Id
- /// 附件类型
- ///
- [HttpGet("{doctorId:guid}/{type}")]
- public async Task> GetAttachmentByType(Guid doctorId, string type)
- {
- var attachmentList = await _attachmentrepository.Where(a => a.DoctorId == doctorId && a.Type.Equals(type)).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
- attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
-
- return attachmentList;
- }
-
- ///
- /// 获取单个医生的多种证书附件
- ///
- /// 医生Id
- /// 类型数组
- ///
- [HttpPost("{doctorId:guid}")]
- public async Task> GetAttachmentByTypes(Guid doctorId, string[] types)
- {
-
- var attachmentList =await _attachmentrepository.Where(a => a.DoctorId == doctorId && types.Contains(a.Type)).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
- attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
-
- return attachmentList;
- }
-
- ///
- /// 根据医生Id获取医生附件
- ///
- /// 医生Id
- ///
- [HttpGet("{doctorId:guid}")]
- public async Task> GetAttachments(Guid doctorId)
- {
- var attachmentList =await _attachmentrepository.Where(a => a.DoctorId == doctorId).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
- attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
-
- return attachmentList;
- }
-
- [NonDynamicMethod]
- public async Task GetDetailById(Guid attachmentId)
- {
- var attachment = await _attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachmentId).IfNullThrowException();
- var temp= _mapper.Map(attachment);
- temp.FullPath = temp.Path + "?access_token=" + _userInfo.UserToken;
- return temp;
- }
-
- ///
- /// 保存多个附件
- ///
- ///
- ///
- public async Task> SaveAttachments(IEnumerable attachmentList)
- {
- var attachments = _mapper.Map>(attachmentList).ToList();
-
- //1 是中文 2是英文 中英文第一份简历默认设置为官方
-
- var zhCount = attachments.Count(t => t.Language == 1);
- var usCount = attachments.Count(t => t.Language == 2);
-
- if (zhCount == 1)
- {
- var k = attachments.First(t => t.Language == 1);
- k.IsOfficial = true;
- }
- if (usCount == 1)
- {
- var k = attachments.First(t => t.Language == 2);
- k.IsOfficial = true;
- }
-
-
- //处理重传
- var reUpload = attachmentList.FirstOrDefault(t => t.ReUpload == true);
- if (reUpload != null)
- {
- //因为界面现实的列表用了 接口返回的列表,所以要把返回的模型对应的字段也要更改
- var attach = attachments.First(t => t.Id == reUpload.Id);
- attach.CreateTime = DateTime.Now;
-
-
- //重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方
- if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2)
- {
- await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == reUpload.Id, u => new Attachment()
- {
- Path = reUpload.Path,
- CreateTime = DateTime.Now,
- Language = reUpload.Language,
- IsOfficial = false
- });
- attach.IsOfficial = false;
- }
- else //相同语言的重传
- {
- await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == reUpload.Id, u => new Attachment()
- {
- Path = reUpload.Path,
- CreateTime = DateTime.Now,
- Language = reUpload.Language
- });
-
- }
-
- }
-
-
- var newAttachment = attachments.Where(t => t.Id == Guid.Empty);
-
- await _repository.AddRangeAsync(newAttachment);
- await _repository.SaveChangesAsync();
-
- //_doctorAttachmentRepository.AddRange(newAttachment);
- //_doctorAttachmentRepository.SaveChanges();
-
- var list = _mapper.Map>(attachments).ToList();
-
- list.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
-
- return list;
- }
-
- public async Task> AddAttachment(AttachmentDTO attachment)
- {
-
- var newAttachment = _mapper.Map(attachment);
- //如果这个医生不存在 这个语言的官方简历 就设置为官方简历
- if (! await _attachmentrepository.AnyAsync(t => t.Type == "Resume" && t.DoctorId == attachment.DoctorId && t.Language == attachment.Language && t.IsOfficial))
- {
- newAttachment.IsOfficial = true;
-
- attachment.IsOfficial = true;
- }
-
- await _repository.AddAsync(newAttachment);
- var success = await _repository.SaveChangesAsync();
- return ResponseOutput.Result(success, attachment);
- }
-
-
- [NonDynamicMethod]
- public async Task GetDoctorOfficialCV(int language, Guid doctorId)
- {
- var result = await _attachmentrepository.FirstOrDefaultAsync(a => a.DoctorId == doctorId &&
- a.IsOfficial && a.Type.Equals("Resume") && a.Language == language);
- if (result != null)
- {
- return result.Path;
- }
- return string.Empty;
- }
-
-
- ///
- /// 将简历设置为官方简历
- ///
- ///
- ///
- ///
- ///
-
- [HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
- public async Task SetOfficial(Guid doctorId, Guid attachmentId, int language)
- {
- var resumeList = await _attachmentrepository.Where(t => t.DoctorId == doctorId && t.Type == "Resume" && t.Language == language).ToListAsync();
- foreach (var item in resumeList)
- {
- if (item.Id == attachmentId) item.IsOfficial = true;
- else item.IsOfficial = false;
- await _repository.UpdateAsync(item);
- }
-
- return ResponseOutput.Result(await _repository.SaveChangesAsync());
- }
-
- ///
- /// 设置简历的语言类型
- ///
- ///
- ///
- /// 0-未设置,1-中文,2-英文
- ///
-
- [HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
- public async Task SetLanguage(Guid doctorId, Guid attachmentId, int language)
- {
- bool result =await _attachmentrepository.BatchUpdateNoTrackingAsync(t => t.Id == attachmentId, a => new Attachment
- {
- Language = language,
- IsOfficial = false
- });
- return ResponseOutput.Result(result);
- }
-
-
- }
-}
diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs
deleted file mode 100644
index 1eb34fc03..000000000
--- a/IRaCIS.Core.Application/Service/Doctor/DTO/AttachmentModel.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace IRaCIS.Application.Contracts
-{
- public class AttachmentDTO
- {
- public Guid Id { get; set; }
- public Guid DoctorId { get; set; }
- public bool IsOfficial { get; set; }
- public string Type { get; set; } = string.Empty;
- public string Path { get; set; } = string.Empty;
- public string FullPath { get; set; } = string.Empty;
- public string FileName { get; set; } = string.Empty;
- public DateTime? CreateTime { get; set; }
- public int Language { get; set; }
-
- public bool ReUpload { get; set; } = false;
- }
-
- public class ReviewerAckDTO
- {
- public Guid Id { get; set; }
- public Guid DoctorId { get; set; }
- public string Type { get; set; } = string.Empty;
- public string Path { get; set; } = string.Empty;
- public string FullPath => Path;
- public string FileName { get; set; } = string.Empty;
- }
-
-
-
-
-
- public class TrialSOWPathDTO
- {
- public Guid TrialId { get; set; }
-
- public string SowName { get; set; } = string.Empty;
- public string SowPath { get; set; } = string.Empty;
- }
-
- public class DeleteSowPathDTO
- {
- public Guid TrialId { get; set; }
- public string Path { get; set; } = string.Empty;
-
- }
-
- public class UploadAgreementAttachmentDTO
- {
- public Guid Id { get; set; }
-
- public Guid DoctorId { get; set; }
- public string Type { get; set; } = string.Empty;
- public string Path { get; set; } = string.Empty;
- public string FullPath => Path;
-
- public string FileName { get; set; } = string.Empty;
- }
-
- public class AttachementCommand
- {
- public Guid Id { get; set; }
- public string Path { get; set; } = string.Empty;
- }
-}
diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorAccountRegisterModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorAccountRegisterModel.cs
deleted file mode 100644
index 456a61b78..000000000
--- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorAccountRegisterModel.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace IRaCIS.Application.Contracts
-{
- public class DoctorAccountRegisterModel : DoctorAccountLoginDTO
- {
- public string FirstName { get; set; } = string.Empty;
- public string LastName { get; set; } = string.Empty;
- public string EMail { get; set; } = string.Empty;
- public DateTime RegisterTime { get; set; }
- }
-}
\ No newline at end of file
diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs
index 890447734..1ecde5cb8 100644
--- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs
+++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs
@@ -244,12 +244,10 @@ namespace IRaCIS.Application.Contracts
public DoctorBasicInfoDTO BasicInfoView { get; set; }
public EmploymentDTO EmploymentView { get; set; }
public SpecialtyDTO SpecialtyView { get; set; }
- public IEnumerable EducationList { get; set; }
- public IEnumerable