67 lines
2.4 KiB
C#
67 lines
2.4 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
/// 临床受试者
|
||
/// </summary>
|
||
[Route("subject")]
|
||
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Trial")]
|
||
public class SubjectController : ControllerBase
|
||
{
|
||
private readonly ISubjectService _subjectsService;
|
||
public SubjectController(ISubjectService subjectsService)
|
||
{
|
||
_subjectsService = subjectsService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加或更新受试者信息[New][AUTH]
|
||
/// </summary>
|
||
/// <param name="model">state:1-访视中,2-出组。0-全部</param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("addOrUpdate")]
|
||
public IResponseOutput AddOrUpdateSubject(SubjectCommand model)
|
||
{
|
||
return _subjectsService.AddOrUpdateSubject(model);
|
||
}
|
||
|
||
/// <summary> 删除受试者[New] </summary>
|
||
[HttpDelete, Route("delete/{id:guid}")]
|
||
public IResponseOutput DeleteSubject(Guid id)
|
||
{
|
||
return _subjectsService.DeleteSubject(id);
|
||
}
|
||
|
||
/// <summary> 分页获取受试者列表[New] </summary>
|
||
/// /// <param name="param">state:1-访视中,2-出组。0-全部</param>
|
||
[HttpPost, Route("getSubjectList")]
|
||
public IResponseOutput<PageOutput<SubjectQueryModel>> GetSubjectList(SubjectQueryParam param)
|
||
{
|
||
if (param.TrialId == Guid.Empty)
|
||
{
|
||
return ResponseOutput.NotOk("Trial Id needed.",new PageOutput<SubjectQueryModel>());
|
||
}
|
||
return ResponseOutput.Ok(_subjectsService.GetSubjectList(param));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 上传影像时 获取受试者选择下拉框列表
|
||
/// </summary>
|
||
/// <param name="siteId"></param>
|
||
/// <param name="trialId"></param>
|
||
/// <returns></returns>
|
||
[HttpGet, Route("getSubjectListBySiteId/{siteId:guid}/{trialId:guid}")]
|
||
public IResponseOutput<List<SubjectSelect>> GetSubjectListBySiteId(Guid siteId, Guid trialId)
|
||
{
|
||
return ResponseOutput.Ok(_subjectsService.GetSubjectListBySiteId(siteId, trialId));
|
||
}
|
||
}
|
||
}
|