108 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			108 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
| //using IRaCIS.Core.Application.Contracts.Dicom.DTO;
 | |
| //using IRaCIS.Core.Application.Contracts.Image;
 | |
| //using IRaCIS.Core.Infrastructure.Extention;
 | |
| //using IRaCIS.Core.Infra.EFCore;
 | |
| //using IRaCIS.Core.Domain.Models;
 | |
| //using Microsoft.AspNetCore.Authorization;
 | |
| //using Microsoft.AspNetCore.Mvc;
 | |
| 
 | |
| //namespace IRaCIS.Core.Application.Services
 | |
| //{
 | |
| //    [ ApiExplorerSettings(GroupName = "Image")]
 | |
| //    public class StudyDTFService : BaseService, IStudyDTFService
 | |
| //    {
 | |
| //        private readonly IRepository<StudyDTF> _studyDtfRepository;
 | |
|         
 | |
| //        private readonly IRepository<User> _userRepository;
 | |
| 
 | |
| 
 | |
| //        public StudyDTFService(IRepository<StudyDTF> studyDtfRepository,  IRepository<User> userRepository)
 | |
| //        {
 | |
| //            _studyDtfRepository = studyDtfRepository;
 | |
|             
 | |
| //            _userRepository = userRepository;
 | |
| //        }
 | |
| 
 | |
| //        public IResponseOutput AddStudyDTF(StudyDTFAddOrUpdateCommand studyDtfAddOrUpdate)
 | |
| //        {
 | |
| //            var studyDtf = _mapper.Map<StudyDTF>(studyDtfAddOrUpdate);
 | |
| 
 | |
| //            _studyDtfRepository.Add(studyDtf);
 | |
| 
 | |
| //            var success = _studyDtfRepository.SaveChanges();
 | |
| 
 | |
| //            return ResponseOutput.Result(success);
 | |
| //        }
 | |
| 
 | |
| //        //[NonDynamicMethod]
 | |
| //        //[AllowAnonymous]
 | |
| //        //public async Task<IResponseOutput> UpdateStudyDTF(StudyDTFAddOrUpdateCommand studyDtfAddOrUpdate)
 | |
| //        //{
 | |
| //        //    studyDtfAddOrUpdate.Id.IfNullThrowException();
 | |
| //        //    var studyDTF = await _studyDtfRepository.FindAsync( studyDtfAddOrUpdate.Id.Value );
 | |
| 
 | |
| //        //    studyDTF.Path = "9999";
 | |
| 
 | |
| //        //    //var success= await _efStudyDtfRepository.UpdateAsync(studyDTF,true);
 | |
| 
 | |
| //        //    var success = await _studyDtfRepository.SaveChangesAsync();
 | |
| 
 | |
| //        //    //_efStudyDtfRepository.UpdateAsync();
 | |
| 
 | |
| 
 | |
| //        //    return ResponseOutput.Ok(success);
 | |
| //        //}
 | |
| 
 | |
| //        [HttpDelete("{trialId:guid}/{studyDTFId:guid}")]
 | |
| //        public IResponseOutput DeleteStudyDTF(Guid studyDTFId)
 | |
| //        {
 | |
| //            return ResponseOutput.Result(_studyDtfRepository.Delete(t => t.Id == studyDTFId));
 | |
| //        }
 | |
| 
 | |
| //        [HttpGet("{trialId:guid}/{studyInstanceUid}")]
 | |
| //        public List<StudyDTFDTO> GetStudyDtfdtos(Guid trialId, string studyInstanceUid)
 | |
| //        {
 | |
| //            var studyId = IdentifierHelper.CreateGuid(studyInstanceUid, trialId.ToString());
 | |
| 
 | |
| //            var query = from studyDtf in _studyDtfRepository.Where(t => t.StudyId == studyId)
 | |
| //                        join user in _userRepository.AsQueryable() on studyDtf.CreateUserId equals user.Id
 | |
| //                        select new StudyDTFDTO()
 | |
| //                        {
 | |
| //                            CreateTime = studyDtf.CreateTime,
 | |
| //                            CreateUserId = studyDtf.CreateUserId,
 | |
| //                            FileName = studyDtf.FileName,
 | |
| //                            Id = studyDtf.Id,
 | |
| //                            FirstName = user.FirstName,
 | |
| //                            LastName = user.LastName,
 | |
| //                            UserName = user.UserName,
 | |
| //                            Path = studyDtf.Path
 | |
| //                        };
 | |
| 
 | |
| //            return query.ToList();
 | |
| //        }
 | |
| 
 | |
| 
 | |
| //        [HttpGet("{trialId:guid}/{studyId:guid}")]
 | |
| //        public List<StudyDTFDTO> GetStudyDtfList(Guid trialId, Guid studyId)
 | |
| //        {
 | |
| //            //var studyId = IdentifierHelper.CreateGuid(studyInstanceUid, trialId.ToString());
 | |
| 
 | |
| //            var query = from studyDtf in _studyDtfRepository.Where(t => t.StudyId == studyId)
 | |
| //                        join user in _userRepository.AsQueryable() on studyDtf.CreateUserId equals user.Id
 | |
| //                        select new StudyDTFDTO()
 | |
| //                        {
 | |
| //                            CreateTime = studyDtf.CreateTime,
 | |
| //                            CreateUserId = studyDtf.CreateUserId,
 | |
| //                            FileName = studyDtf.FileName,
 | |
| //                            Id = studyDtf.Id,
 | |
| //                            FirstName = user.FirstName,
 | |
| //                            LastName = user.LastName,
 | |
| //                            UserName = user.UserName,
 | |
| //                            Path = studyDtf.Path
 | |
| //                        };
 | |
| 
 | |
| //            return query.ToList();
 | |
| //        }
 | |
| 
 | |
| //    }
 | |
| //} |