|
|
|
|
@ -918,9 +918,25 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
[HttpDelete]
|
|
|
|
|
public async Task<IResponseOutput> DeletePatientStudy(Guid patiendId, Guid scpStudyId,
|
|
|
|
|
[FromServices] IRepository<SCPSeries> _SeriesRepository,
|
|
|
|
|
[FromServices] IRepository<SCPInstance> _instanceRepository)
|
|
|
|
|
[FromServices] IRepository<SCPInstance> _instanceRepository,
|
|
|
|
|
[FromServices] IRepository<SCPStudyHospitalGroup> _scpStudyHospitalGroupRepository)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var existList = _scpStudyHospitalGroupRepository.Where(t => t.SCPStudyId == scpStudyId).Select(t => t.HospitalGroupId).ToList();
|
|
|
|
|
|
|
|
|
|
var isAdminOrOAOrGA = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.Admin || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.OA
|
|
|
|
|
|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA;
|
|
|
|
|
|
|
|
|
|
// abc 课题组,人属于AB 课题组,删除仅仅删除这个标签 直接返回
|
|
|
|
|
if (!isAdminOrOAOrGA && existList.Count > _userInfo.HospitalGroupList.Count)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _scpStudyHospitalGroupRepository.BatchDeleteNoTrackingAsync(t => t.SCPStudyId == scpStudyId && _userInfo.HospitalGroupIdList.Contains(t.HospitalGroupId));
|
|
|
|
|
|
|
|
|
|
return ResponseOutput.Ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_studySubjectVisitRepository.Any(t => t.SCPStudyId == scpStudyId && t.StudyId != null))
|
|
|
|
|
{
|
|
|
|
|
@ -928,11 +944,15 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await _subjectPatientRepository.DeleteFromQueryAsync(t => t.PatientId == patiendId);
|
|
|
|
|
await _studySubjectVisitRepository.DeleteFromQueryAsync(t => t.SCPStudyId == scpStudyId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _scpStudyHospitalGroupRepository.BatchDeleteNoTrackingAsync(t => t.SCPStudyId == scpStudyId);
|
|
|
|
|
|
|
|
|
|
await _studyRepository.BatchDeleteNoTrackingAsync(t => t.Id == scpStudyId);
|
|
|
|
|
await _SeriesRepository.BatchDeleteNoTrackingAsync(t => t.StudyId == scpStudyId);
|
|
|
|
|
await _instanceRepository.BatchDeleteNoTrackingAsync(t => t.StudyId == scpStudyId);
|
|
|
|
|
@ -3381,7 +3401,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
var resultInstanceUidList = result.Select(t => t.StudyInstanceUID).ToList();
|
|
|
|
|
|
|
|
|
|
var existStudyIdList = _studyRepository.Where(t => resultInstanceUidList.Contains(t.StudyInstanceUid))
|
|
|
|
|
.Select(t => new { t.StudyInstanceUid, HospitalGroupList = t.HospitalGroupList.Select(t => new HospitalGroupInfo { Id = t.HospitalGroupId, Name = t.HospitalGroup.Name, Code = t.HospitalGroup.Code }).ToList() }).ToList();
|
|
|
|
|
.Select(t => new { SCPStudyId = t.Id, t.StudyInstanceUid, HospitalGroupList = t.HospitalGroupList.Select(t => new HospitalGroupInfo { Id = t.HospitalGroupId, Name = t.HospitalGroup.Name, Code = t.HospitalGroup.Code }).ToList() }).ToList();
|
|
|
|
|
|
|
|
|
|
var allHospitalGroupList = _hospitalGroupRepository.Where(t => t.IsEnable).Select(t => new HospitalGroupInfo() { Name = t.Name, Id = t.Id, Code = t.Code }).ToList();
|
|
|
|
|
|
|
|
|
|
@ -3390,6 +3410,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
foreach (var item in result)
|
|
|
|
|
{
|
|
|
|
|
item.SCPStudyId = existStudyIdList.FirstOrDefault(t => t.StudyInstanceUid == item.StudyInstanceUID).SCPStudyId;
|
|
|
|
|
item.IsStudyExist = existStudyIdList.Any(t => t.StudyInstanceUid == item.StudyInstanceUID);
|
|
|
|
|
item.HospitalGroupList = existStudyIdList.FirstOrDefault(t => t.StudyInstanceUid == item.StudyInstanceUID)?.HospitalGroupList;
|
|
|
|
|
|
|
|
|
|
|