using IRaCIS.Application.Interfaces; using IRaCIS.Application.ViewModels; using System; using System.Collections.Generic; using IRaCIS.Core.Application.Contracts.RequestAndResponse; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; namespace IRaCIS.Api.Controllers { /// /// 临床受试者 /// [Route("subject")] [ApiController, Authorize, ApiExplorerSettings(GroupName = "Trial")] public class SubjectController : ControllerBase { private readonly ISubjectService _subjectsService; public SubjectController(ISubjectService subjectsService) { _subjectsService = subjectsService; } /// /// 添加或更新受试者信息[New][AUTH] /// /// state:1-访视中,2-出组。0-全部 /// [HttpPost, Route("addOrUpdate")] public IResponseOutput AddOrUpdateSubject(SubjectCommand model) { return _subjectsService.AddOrUpdateSubject(model); } /// 删除受试者[New] [HttpDelete, Route("delete/{id:guid}")] public IResponseOutput DeleteSubject(Guid id) { return _subjectsService.DeleteSubject(id); } /// 分页获取受试者列表[New] /// /// state:1-访视中,2-出组。0-全部 [HttpPost, Route("getSubjectList")] public IResponseOutput> GetSubjectList(SubjectQueryParam param) { if (param.TrialId == Guid.Empty) { return ResponseOutput.NotOk("Trial Id needed.",new PageOutput()); } return ResponseOutput.Ok(_subjectsService.GetSubjectList(param)); } /// /// 上传影像时 获取受试者选择下拉框列表 /// /// /// /// [HttpGet, Route("getSubjectListBySiteId/{siteId:guid}/{trialId:guid}")] public IResponseOutput> GetSubjectListBySiteId(Guid siteId, Guid trialId) { return ResponseOutput.Ok(_subjectsService.GetSubjectListBySiteId(siteId, trialId)); } } }