修改医生既往阅片情况声明

This commit is contained in:
2023-01-31 09:35:52 +08:00
parent e18b890f96
commit 79d4c6a116
21 changed files with 242 additions and 117 deletions
@@ -98,7 +98,7 @@ namespace IRaCIS.Core.Application.Service
var trialReadingCriterionConfig = await _trialReadingCriterionRepository.Where(t => t.Id == confirmedTrialReadingCriterionId).Select(t => new { TrialReadingCriterionId = t.Id, t.ReadingTool, t.ReadingType, t.IsReadingTaskViewInOrder, t.IsFollowVisitAutoAssign, t.IsFollowGlobalVisitAutoAssign, t.FollowGlobalVisitAutoAssignDefaultState, t.FollowVisitAutoAssignDefaultState, t.TaskAllocateObjEnum, t.CriterionType }).FirstOrDefaultAsync();
//获取确认的临床数据配置
var clinicalDataConfirmList = _trialClinicalDataSetRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Include(t=>t.TrialClinicalDataSetCriteriaList).ToList();
var clinicalDataConfirmList = _trialClinicalDataSetRepository.Where(t => t.TrialId == trialId && t.IsConfirm).Include(t => t.TrialClinicalDataSetCriteriaList).ToList();
var visitBlindConfig = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.BlindBaseLineName, t.BlindFollowUpPrefix }).FirstOrDefault();
@@ -207,7 +207,7 @@ namespace IRaCIS.Core.Application.Service
}
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
@@ -215,7 +215,7 @@ 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)
if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null)
{
task1.TaskAllocationState = defaultState;
//分配给对应Arm的人
@@ -225,7 +225,7 @@ namespace IRaCIS.Core.Application.Service
task1.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2!=null)
if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null)
{
task2.TaskAllocationState = defaultState;
task2.DoctorUserId = assignConfigList.FirstOrDefault(t => t.ArmEnum == Arm.DoubleReadingArm2).DoctorUserId;
@@ -339,7 +339,7 @@ namespace IRaCIS.Core.Application.Service
{
return false;
}
var isClinicalDataSign = false;
@@ -391,7 +391,7 @@ namespace IRaCIS.Core.Application.Service
}
return isClinicalDataSign;
}
@@ -621,12 +621,19 @@ namespace IRaCIS.Core.Application.Service
else
{
var arm1 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm1);
if (arm1 != null)
{
arm1.TaskAllocationState = TaskAllocationState.Allocated;
arm1.AllocateTime = DateTime.Now;
arm1.DoctorUserId = task1.DoctorUserId;
arm1.SuggesteFinishedTime = DateTime.Now.AddDays(7);
//有可能仅仅只分配了一个Subject 未分配 那么
if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm1) && task1 != null)
{
arm1.TaskAllocationState = TaskAllocationState.Allocated;
arm1.AllocateTime = DateTime.Now;
arm1.DoctorUserId = task1.DoctorUserId;
arm1.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
}
else
{
@@ -677,10 +684,15 @@ namespace IRaCIS.Core.Application.Service
var arm2 = visitGroup.FirstOrDefault(t => t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.NotAllocate && t.DoctorUserId == null && t.ArmEnum == Arm.DoubleReadingArm2);
if (arm2 != null)
{
arm2.TaskAllocationState = TaskAllocationState.Allocated;
arm2.AllocateTime = DateTime.Now;
arm2.DoctorUserId = task2.DoctorUserId;
arm2.SuggesteFinishedTime = DateTime.Now.AddDays(7);
//有可能仅仅只分配了一个Subject
if (assignConfigList.Any(t => t.ArmEnum == Arm.DoubleReadingArm2) && task2 != null)
{
arm2.TaskAllocationState = TaskAllocationState.Allocated;
arm2.AllocateTime = DateTime.Now;
arm2.DoctorUserId = task2.DoctorUserId;
arm2.SuggesteFinishedTime = DateTime.Now.AddDays(7);
}
}
else
{
@@ -26,6 +26,9 @@
}
public class TrialSOWPathDTO
{
public Guid TrialId { get; set; }
@@ -691,6 +691,12 @@ namespace IRaCIS.Application.Contracts
{
public Guid? Id { get; set; }
public Guid? TrialId { get; set; }
public Guid? TrialReadingCriterionId { get; set; }
public string CriterionName { get; set; }
public bool IsEnable { get; set; } = true;
/// <summary>
@@ -772,6 +778,9 @@ namespace IRaCIS.Application.Contracts
/// CreateTime
/// </summary>
public DateTime CreateTime { get; set; }
}
public class GetDoctorCriterionFileInDto
@@ -72,7 +72,7 @@ namespace IRaCIS.Application.Services
{
return ResponseOutput.NotOk("The current phone number already existed!", new DoctorBasicInfoCommand());
}
if (await _doctorRepository.AnyAsync(t => t.EMail == doctor.EMail))
{
return ResponseOutput.NotOk("The current email already existed!", new DoctorBasicInfoCommand());
@@ -80,7 +80,7 @@ namespace IRaCIS.Application.Services
doctor.Code = (await _doctorRepository.MaxAsync(t => t.Code)) + 1;
doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code,nameof(Doctor)) ;
doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code, nameof(Doctor));
doctor.Password = MD5Helper.Md5(doctor.Phone);
@@ -103,7 +103,7 @@ namespace IRaCIS.Application.Services
var updateModel = basicInfoModel;
var phone = updateModel.Phone.Trim();
if ((await _doctorRepository.FirstOrDefaultAsync(t => t.Phone == phone && t.Id != updateModel.Id) )!= null)
if ((await _doctorRepository.FirstOrDefaultAsync(t => t.Phone == phone && t.Id != updateModel.Id)) != null)
{
return ResponseOutput.NotOk("The current phone number already existed!", new DoctorBasicInfoCommand());
}
@@ -116,10 +116,10 @@ namespace IRaCIS.Application.Services
var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException();
//删除中间表 Title对应的记录
await _repository.BatchDeleteAsync<DoctorDictionary>(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title);
await _repository.BatchDeleteAsync<DoctorDictionary>(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title);
var adddata=new List<DoctorDictionary>();
var adddata = new List<DoctorDictionary>();
//重新插入新的 Title记录
updateModel.TitleIds.ForEach(titleId => adddata.Add(new DoctorDictionary() { DoctorId = updateModel.Id.Value, KeyName = StaticData.Title, DictionaryId = titleId }));
@@ -284,7 +284,7 @@ namespace IRaCIS.Application.Services
}
[HttpPost]
public async Task<IResponseOutput> UpdateEmploymentInfo(EmploymentCommand doctorWorkInfoModel)
{
#region
@@ -314,7 +314,7 @@ namespace IRaCIS.Application.Services
//_mapper.Map(doctorWorkInfoModel, doctor);
//var success = _doctorRepository.SaveChanges();
#endregion
var entity = await _repository.InsertOrUpdateAsync<Doctor, EmploymentCommand>(doctorWorkInfoModel, true);
@@ -369,7 +369,7 @@ namespace IRaCIS.Application.Services
return test;
}
[HttpPost]
public async Task<IResponseOutput> UpdateSpecialtyInfo(SpecialtyCommand specialtyUpdateModel)
{
@@ -421,7 +421,7 @@ namespace IRaCIS.Application.Services
#endregion
#region
[HttpPost]
public async Task<IResponseOutput> UpdateAuditResume(ResumeConfirmCommand auditResumeParam)
{
@@ -441,8 +441,8 @@ namespace IRaCIS.Application.Services
ReviewStatus = auditResumeParam.ReviewStatus,
AcceptingNewTrial = auditResumeParam.AcceptingNewTrial,
ActivelyReading = auditResumeParam.ActivelyReading,
IsVirtual=auditResumeParam.IsVirtual,
BlindName=auditResumeParam.BlindName,
IsVirtual = auditResumeParam.IsVirtual,
BlindName = auditResumeParam.BlindName,
BlindNameCN = auditResumeParam.BlindNameCN,
BlindPublications = auditResumeParam.BlindPublications,
AuditTime = DateTime.Now,
@@ -479,11 +479,22 @@ namespace IRaCIS.Application.Services
public async Task<IResponseOutput> AddDoctorCriterionFile(AddDoctorCriterionFileDto inDto)
{
if (await _doctorCriterionFileRepository.AnyAsync(x =>inDto.IsEnable&& x.DoctorId == inDto.DoctorId && x.FileType == inDto.FileType && x.IsEnable && x.CriterionType == inDto.CriterionType && x.Id != inDto.Id))
if (await _doctorCriterionFileRepository.AnyAsync(x => inDto.IsEnable && x.DoctorId == inDto.DoctorId && x.FileType == inDto.FileType && x.TrialId==inDto.TrialId &&x.TrialReadingCriterionId==inDto.TrialReadingCriterionId && x.IsEnable && x.CriterionType == inDto.CriterionType && x.Id != inDto.Id))
{
throw new BusinessValidationFailedException("当前标准已添加过此类型文件");
}
var entity = await _doctorCriterionFileRepository.InsertOrUpdateAsync(inDto, true);
var entity = await _doctorCriterionFileRepository.InsertOrUpdateAsync(inDto);
if (inDto.TrialId != null)
{
entity.Remark = await _trialRepository.Where(t => t.Id == inDto.TrialId).Select(t => t.TrialCode).FirstOrDefaultAsync();
}
await _doctorCriterionFileRepository.SaveChangesAsync();
return ResponseOutput.Ok(entity.Id.ToString());
}
@@ -523,7 +534,7 @@ namespace IRaCIS.Application.Services
var doctor = (await _doctorRepository
.ProjectTo<ResumeConfirmDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync(t => t.Id == doctorId)).IfNullThrowException();
doctor.InHoliday = (await _repository.CountAsync<Vacation>(x=>x.DoctorId==doctorId&&x.EndDate<=DateTime.Now&&x.StartDate<=DateTime.Now)) > 0;
doctor.InHoliday = (await _repository.CountAsync<Vacation>(x => x.DoctorId == doctorId && x.EndDate <= DateTime.Now && x.StartDate <= DateTime.Now)) > 0;
return doctor;
}
@@ -1,5 +1,6 @@
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Application.Services
@@ -164,6 +165,7 @@ namespace IRaCIS.Application.Services
}
[AllowAnonymous]
public async Task<List<MenuTreeNode>> GetUserMenuTree()
{
@@ -182,7 +184,7 @@ namespace IRaCIS.Application.Services
return list;
}
[AllowAnonymous]
public async Task<List<string>> GetUserPermissions()
{
@@ -874,7 +874,7 @@ namespace IRaCIS.Core.Application
EnrollStatus = EnrollStatus.Finished
});
await _trialRepository.BatchUpdateNoTrackingAsync(u => u.Id == trialId, s => new Trial { TrialFinishedTime = DateTime.UtcNow.AddHours(8) });
await _trialRepository.BatchUpdateNoTrackingAsync(u => u.Id == trialId, s => new Trial { TrialFinishedTime = DateTime.Now });
}
@@ -340,11 +340,11 @@ namespace IRaCIS.Application.Contracts
public Guid Id { get; set; }
public Guid? TrialReadingCriterionId { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
public string FileName { get; set; }
/// <summary>
/// 文件路径
@@ -50,53 +50,63 @@ namespace IRaCIS.Application.Services
}
#region \
/// <summary>
/// 保存协议- ack Sow [AUTH]
/// </summary>
[HttpPost("{trialId}")]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> UploadReviewerAckSOW(Guid trialId,
ReviewerAckDTO attachmentViewModel)
{
var intoGroupItem = (await _enrollRepository.Where(t => t.TrialId == trialId && t.DoctorId == attachmentViewModel.DoctorId).FirstOrDefaultAsync()).IfNullThrowException();
if (attachmentViewModel.Id != Guid.Empty)
{
await _attachmentRepository.BatchDeleteNoTrackingAsync(t => t.Id == attachmentViewModel.Id);
}
#region
///// <summary>
///// 保存协议- ack Sow [AUTH]
///// </summary>
//[HttpPost("{trialId}")]
var attachment = await _attachmentRepository.InsertFromDTOAsync(attachmentViewModel);
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
//public async Task<IResponseOutput> UploadReviewerAckSOW(Guid trialId,
// ReviewerAckDTO attachmentViewModel)
//{
//intoGroupItem.AttachmentId = attachment.Id;
await _enrollRepository.UpdatePartialFromQueryAsync(intoGroupItem.Id, u => new Enroll() { AttachmentId = attachment.Id });
// var intoGroupItem = (await _enrollRepository.Where(t => t.TrialId == trialId && t.DoctorId == attachmentViewModel.DoctorId).FirstOrDefaultAsync()).IfNullThrowException();
var success = await _enrollRepository.SaveChangesAsync();
// if (attachmentViewModel.Id != Guid.Empty)
// {
// await _attachmentRepository.BatchDeleteNoTrackingAsync(t => t.Id == attachmentViewModel.Id);
// }
// var attachment = await _attachmentRepository.InsertFromDTOAsync(attachmentViewModel);
// //intoGroupItem.AttachmentId = attachment.Id;
// await _enrollRepository.UpdatePartialFromQueryAsync(intoGroupItem.Id, u => new Enroll() { AttachmentId = attachment.Id });
// var success = await _enrollRepository.SaveChangesAsync();
// return ResponseOutput.Result(success, attachment.Id.ToString());
//}
///// <summary>
///// 删除协议
///// </summary>
//[HttpDelete, Route("{trialId}/{doctorId}/{attachmentId}")]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
//public async Task<IResponseOutput> DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId)
//{
// var success1 = await _attachmentRepository.BatchDeleteNoTrackingAsync(a => a.Id == attachmentId);
// await _enrollRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u =>
// new Enroll()
// {
// AttachmentId = Guid.Empty
// }, true);
// return ResponseOutput.Ok(success1);
//}
#endregion
return ResponseOutput.Result(success, attachment.Id.ToString());
}
/// <summary>
/// 删除协议
/// </summary>
[HttpDelete, Route("{trialId}/{doctorId}/{attachmentId}")]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId)
{
var success1 = await _attachmentRepository.BatchDeleteNoTrackingAsync(a => a.Id == attachmentId);
await _enrollRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.DoctorId == doctorId, u =>
new Enroll()
{
AttachmentId = Guid.Empty
}, true);
return ResponseOutput.Ok(success1);
}
/// <summary>
/// 修改项目医生的阅片类型
@@ -207,22 +217,30 @@ namespace IRaCIS.Application.Services
IsEnable = allocateRule.IsEnable,
TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t=>t.IsConfirm).Select(t=>new TrialReadingCriterionDto() { TrialReadingCriterionId=t.Id,TrialReadingCriterionName=t.CriterionName,CriterionType=t.CriterionType,IsOncologyReading=t.IsOncologyReading,IsArbitrationReading=t.IsArbitrationReading,IsGlobalReading=t.IsGlobalReading,ReadingInfoSignTime=t.ReadingInfoSignTime,ReadingType=t.ReadingType}).ToList(),
CriterionFileList= doctor.CriterionFileList.Where(x=>x.IsEnable).Select(x=> new CriterionFile() {
CriterionType=x.CriterionType,
DoctorId=x.DoctorId,
FileName=x.FileName,
FilePath=x.FilePath,
FileType=x.FileType,
Remark=x.Remark,
Id=x.Id
}).ToList(),
CriterionReadingCategoryList =intoGroup.EnrollReadingCategoryList.Select(t=>new TrialCriterionReadingCategory() { EnrollId=t.EnrollId,ReadingCategory=t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList(),
ReadingTaskStateList=doctor.User.VisitTaskList.Where(x=>x.TaskState==TaskState.Effect&&x.TrialId== trialId).Select(x=> new DoctorUserTask() {
ReadingTaskState= x.ReadingTaskState,
CriterionType=x.TrialReadingCriterion.CriterionType,
CriterionFileList = doctor.CriterionFileList.Where(x => x.IsEnable && (x.TrialId==null ||x.TrialId==trialId)).Select(x => new CriterionFile()
{
CriterionType = x.CriterionType,
DoctorId = x.DoctorId,
FileName = x.FileName,
FilePath = x.FilePath,
FileType = x.FileType,
Remark = x.Remark,
TrialReadingCriterionId=x.TrialReadingCriterionId,
Id = x.Id
}).ToList(),
ReadingTaskStateList = doctor.User.VisitTaskList.Where(x => x.TaskState == TaskState.Effect && x.TrialId == trialId).Select(x => new DoctorUserTask()
{
ReadingTaskState = x.ReadingTaskState,
CriterionType = x.TrialReadingCriterion.CriterionType,
}).ToList(),
DoctorId = doctor.Id,
Code = doctor.ReviewerCode,
FirstName = doctor.FirstName,
@@ -5,14 +5,14 @@ namespace IRaCIS.Application.Services
public interface IDoctorWorkloadService
{
Task<IResponseOutput> AddOrUpdateWorkload(WorkloadCommand workLoadAddOrUpdateModel, Guid userId);
Task<IResponseOutput> DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId);
//Task<IResponseOutput> DeleteReviewerAckSOW(Guid trialId, Guid doctorId, Guid attachmentId);
Task<IResponseOutput> DeleteWorkload(Guid workloadId);
PageOutput<WorkLoadDetailDTO> GetEnrollmentWorkloadStatsDetail(WorkLoadStatsQueryDTO workLoadSearch);
Task<List<WorkLoadDetailViewModel>> GetReviewerWorkLoadListDetail(WorkLoadDetailQueryDTO workLoadSearch);
Task<PageOutput<WorkLoadAndAgreementDTO>> GetTrialEnrollmentWorkloadStats(WorkLoadDoctorQueryDTO doctorSearchModel);
Task<WorkloadDTO> GetWorkloadDetailById(Guid id);
Task<IResponseOutput> UpdateReviewerReadingType(Guid trialId, Guid doctorId, int type);
Task<IResponseOutput> UploadReviewerAckSOW(Guid trialId, ReviewerAckDTO attachmentViewModel);
//Task<IResponseOutput> UploadReviewerAckSOW(Guid trialId, ReviewerAckDTO attachmentViewModel);
Task<IResponseOutput<ExistWorkloadViewModel>> WorkloadExist(WorkloadExistQueryDTO param);
}
}