CostCalculationItem/IRaCIS.Core.API/Controllers/Doctor/AttachmentController.cs

116 lines
4.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Api.Controllers
{
/// <summary>
/// 医生文档关联关系维护
/// </summary>
[Route("attachment")]
[ApiController, Authorize,ApiExplorerSettings(GroupName ="Reviewer")]
public class DocumentController : ControllerBase
{
private IAttachmentService _attachmentService;
public DocumentController(IAttachmentService doctorAttachmentApp)
{
_attachmentService = doctorAttachmentApp;
}
/// <summary>
/// 添加多个记录
/// </summary>
/// <param name="attachment"></param>
/// <returns></returns>
[HttpPost, Route("saveAttachments")]
public IResponseOutput<IEnumerable<AttachmentDTO>> AddDoctorAttachment(IEnumerable<AttachmentDTO> attachment)
{
return ResponseOutput.Ok(_attachmentService.SaveAttachmentRange(attachment));
}
/// <summary>
/// 删除记录
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpDelete, Route("deleteAttachment")]
public IResponseOutput DeleteAttachment(AttachementCommand param)
{
//var attachment = _doctorAttachmentApp.GetDetailById(id);
//string file = HostingEnvironment.MapPath(attachment.Path);
//if (File.Exists(file))
//{
// File.Delete(file);
//}
//var temp = HostingEnvironment.MapPath(param.Path);
//if (File.Exists(temp))
//{
// File.Delete(temp);
//}
return ResponseOutput.Ok(_attachmentService.DeleteAttachment(param.Id));
}
/// <summary>
/// 根据医生Id 和 附件类型,获取记录
/// </summary>
/// <param name="doctorId">医生Id</param>
/// <param name="type">附件类型</param>
/// <returns></returns>
[HttpGet, Route("getAttachmentByType/{doctorId:guid}/{type}")]
public IResponseOutput<IEnumerable<AttachmentDTO>> GetAttachmentListByType(Guid doctorId, string type)
{
return ResponseOutput.Ok(_attachmentService.GetAttachmentByType(doctorId, type));
}
/// <summary>
/// 获取单个医生的多种证书附件
/// </summary>
/// <param name="doctorId">医生Id</param>
/// <param name="types">类型数组</param>
/// <returns></returns>
[HttpPost, Route("getAttachmentByTypes/{doctorId:guid}")]
public IResponseOutput<IEnumerable<AttachmentDTO>> GetAttachmentListByTypes(Guid doctorId, string[] types)
{
return ResponseOutput.Ok(_attachmentService.GetAttachmentByTypes(doctorId, types));
}
/// <summary>
/// 根据医生Id获取医生附件
/// </summary>
/// <param name="doctorId">医生Id</param>
/// <returns></returns>
[HttpGet, Route("getAttachments/{doctorId:guid}")]
public IResponseOutput<IEnumerable<AttachmentDTO>> GetAttachmentList(Guid doctorId)
{
//var a = _attachmentService.GetAttachments(doctorId).ToList();
return ResponseOutput.Ok(_attachmentService.GetAttachments(doctorId));
}
/// <summary>
/// 将简历设置为官方简历
/// </summary>
/// <param name="doctorId"></param>
/// <param name="attachmentId"></param>
/// <returns></returns>
[HttpPost, Route("setOfficial/{doctorId:guid}/{attachmentId:guid}")]
public IResponseOutput SetOfficial(Guid doctorId, Guid attachmentId)
{
return _attachmentService.SetOfficial(doctorId, attachmentId);
}
}
}