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 { /// /// 医生文档关联关系维护 /// [Route("attachment")] [ApiController, Authorize,ApiExplorerSettings(GroupName ="Reviewer")] public class DocumentController : ControllerBase { private IAttachmentService _attachmentService; public DocumentController(IAttachmentService doctorAttachmentApp) { _attachmentService = doctorAttachmentApp; } /// /// 添加多个记录 /// /// /// [HttpPost, Route("saveAttachments")] public IResponseOutput> AddDoctorAttachment(IEnumerable attachment) { return ResponseOutput.Ok(_attachmentService.SaveAttachmentRange(attachment)); } /// /// 删除记录 /// /// /// [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)); } /// /// 根据医生Id 和 附件类型,获取记录 /// /// 医生Id /// 附件类型 /// [HttpGet, Route("getAttachmentByType/{doctorId:guid}/{type}")] public IResponseOutput> GetAttachmentListByType(Guid doctorId, string type) { return ResponseOutput.Ok(_attachmentService.GetAttachmentByType(doctorId, type)); } /// /// 获取单个医生的多种证书附件 /// /// 医生Id /// 类型数组 /// [HttpPost, Route("getAttachmentByTypes/{doctorId:guid}")] public IResponseOutput> GetAttachmentListByTypes(Guid doctorId, string[] types) { return ResponseOutput.Ok(_attachmentService.GetAttachmentByTypes(doctorId, types)); } /// /// 根据医生Id获取医生附件 /// /// 医生Id /// [HttpGet, Route("getAttachments/{doctorId:guid}")] public IResponseOutput> GetAttachmentList(Guid doctorId) { //var a = _attachmentService.GetAttachments(doctorId).ToList(); return ResponseOutput.Ok(_attachmentService.GetAttachments(doctorId)); } /// /// 将简历设置为官方简历 /// /// /// /// [HttpPost, Route("setOfficial/{doctorId:guid}/{attachmentId:guid}")] public IResponseOutput SetOfficial(Guid doctorId, Guid attachmentId) { return _attachmentService.SetOfficial(doctorId, attachmentId); } } }