46 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
| using AutoMapper.QueryableExtensions;
 | |
| using IRaCIS.Application.Interfaces;
 | |
| using IRaCIS.Application.Contracts;
 | |
| using IRaCIS.Core.Infra.EFCore;
 | |
| using IRaCIS.Core.Domain.Models;
 | |
| using IRaCIS.Core.Application.Filter;
 | |
| using IRaCIS.Core.Infrastructure.Extention;
 | |
| using Microsoft.AspNetCore.Mvc;
 | |
| 
 | |
| namespace IRaCIS.Application.Services
 | |
| {
 | |
|     [ApiExplorerSettings(GroupName = "Reviewer")]
 | |
|     public class ResearchPublicationService : BaseService, IResearchPublicationService
 | |
|     {
 | |
|         private readonly IRepository<ResearchPublication> researchPublicationRepository;
 | |
| 
 | |
|         public ResearchPublicationService(IRepository<ResearchPublication> _researchPublicationRepository)
 | |
|         {
 | |
|             researchPublicationRepository = _researchPublicationRepository;
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 查询-医生科学研究信息
 | |
|         /// </summary>
 | |
|         /// <param name="doctorId">医生Id</param>
 | |
|         /// <returns></returns>
 | |
|         [HttpGet("{doctorId:guid}")]
 | |
|         public async Task<ResearchPublicationDTO> GetResearchPublication(Guid doctorId)
 | |
|         {
 | |
|             var doctorScientificResearchInfo = await researchPublicationRepository.Where(o => o.DoctorId == doctorId)
 | |
|                 .ProjectTo<ResearchPublicationDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
 | |
| 
 | |
|             return doctorScientificResearchInfo;
 | |
|         }
 | |
| 
 | |
|        
 | |
|         [HttpPost]
 | |
|         public async Task<IResponseOutput> AddOrUpdateResearchPublication(ResearchPublicationDTO param)
 | |
|         {
 | |
| 
 | |
|             var entity = await _repository.InsertOrUpdateAsync<ResearchPublication, ResearchPublicationDTO>(param, true);
 | |
| 
 | |
|             return ResponseOutput.Ok(entity.Id);
 | |
|         }
 | |
|     }
 | |
| } |