Commit c4534545 by tangzhongyang

导出查询报告

parent 302f23c5
......@@ -2,6 +2,8 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using QueryPlatform.Api.Infrastructure.Hubs;
using QueryPlatform.Api.Infrastructure.Modules;
using QueryPlatform.Api.Infrastructure.Queries;
using System;
......@@ -12,16 +14,18 @@
namespace QueryPlatform.Api.Controllers
{
[Authorize]
[Route("api/resource")]
[Route("api/home")]
[ApiController]
public class HomeController : Controller
{
private readonly HomeQueries _homeQueries;
private readonly IWebHostEnvironment environment;
public HomeController(HomeQueries homeQueries, IWebHostEnvironment environment)
private readonly IWebHostEnvironment _environment;
private readonly IHubContext<NotificationHub> _hubContext;
public HomeController(HomeQueries homeQueries, IWebHostEnvironment environment, IHubContext<NotificationHub> hubContext)
{
this._homeQueries = homeQueries;
this.environment = environment;
_homeQueries = homeQueries;
_environment = environment;
_hubContext = hubContext;
}
/// <summary>
/// 查询所有项目记录
......@@ -70,7 +74,7 @@ public void DemandAdd([FromBody] SYS_DEMAND sYS_Demand)
[AllowAnonymous]
public void DemandAddfu([FromForm] SYS_DEMANDSUBLIS sYS_DemandSublist)
{
_homeQueries.Demandfu(sYS_DemandSublist, environment.WebRootPath);
_homeQueries.Demandfu(sYS_DemandSublist, _environment.WebRootPath);
}
/// <summary>
/// 添加服务器
......@@ -117,8 +121,7 @@ public IEnumerable<dynamic> Funca()
{
var DemandQuery = _homeQueries.FuncaQuery();
return DemandQuery;
}
}
//[HttpGet("lingchuanglujingjiancha")]
//[AllowAnonymous]
......@@ -135,7 +138,7 @@ public IEnumerable<dynamic> Funca()
[AllowAnonymous]
public string Executes(DateTime StartTime, DateTime EndTime)
{
return _homeQueries.Executes(StartTime, EndTime, environment.WebRootPath);
return _homeQueries.Executes(StartTime, EndTime, _environment.WebRootPath);
}
/// <summary>
/// 南海核对数据下拉框
......@@ -259,7 +262,7 @@ public IActionResult SendMail(string title, string content, string zxr = "")
var export = "";
try
{
export = _homeQueries.Excelex(ExportTableName, environment.WebRootPath); ;
export = _homeQueries.Excelex(ExportTableName, _environment.WebRootPath); ;
}
catch (Exception e)
{
......@@ -305,8 +308,7 @@ public IActionResult ceshi()
{
return Ok(_homeQueries.ceshi());
}
}
}
\ No newline at end of file
......@@ -22,6 +22,7 @@ public override Task OnDisconnectedAsync(Exception exception)
var userId = Context.User.Claims.FirstOrDefault(w => w.Type == ClaimTypes.Sid)?.Value;
Groups.RemoveFromGroupAsync(Context.ConnectionId, userId);
return base.OnDisconnectedAsync(exception);
}
}
}
}
......@@ -3,6 +3,7 @@
using FluentEmail.Core;//
using FluentEmail.Smtp;//
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Data.SqlClient;
using Newtonsoft.Json;
using NPOI.HSSF.UserModel;
......@@ -18,10 +19,11 @@
using System.Net;//
using System.Net.Mail;//
using System.Text;
using System.Threading.Tasks;
namespace QueryPlatform.Api.Infrastructure.Queries
{
public class HomeQueries
{
private readonly string _configConnectionString;
......@@ -1410,9 +1412,12 @@ public List<string> ceshi()
return errs;
}
}
}
\ No newline at end of file
......@@ -299,8 +299,13 @@ UNION ALL
string filePath = $"{diz}/export/模板.html"; //$"E:/C盘文件/桌面/非小细胞癌药品分布.html"; //$"{diz}/export/模板.html"// 指定文件路径
var htmlContent = "";
string mb = @"<tr>
<td width='55' ><p align='right'><font size='2' style='font-size: 10pt'><span lang='zh-CN'><b><font face='宋体'>{nf}</font></b></span></font></p></td>
<td width='74'><p align='right'><font size='2' style='font-size: 10pt'><span lang='en-US'><font size='3' style='font-size: 12pt'>{rs}</font></span></font></p></td>
<td width='65%' bgcolor='#ffffff' style='background: #ffffff'>
<p style='text-align: center; font-weight: bold;'><font color='#000000'><font face='宋体'><font size='2' style='font-size: 12pt'><span lang='zh-CN'>{nf}</span></font></font></font></p>
</td>
<td width='35%' bgcolor='#ffffff' style='background: #ffffff'>
<p style='text-align: center; '><font face='宋体'><font size='2' style='font-size: 12pt'><span lang='zh-CN'><font face='宋体'>{rs}</font></span></font></font></p>
</td>
</tr> ";
string yearfbhtmlfh = "";
string sexfbhtmlfh = "";
......@@ -331,43 +336,41 @@ UNION ALL
}
mb = @"
<tr>
<td rowspan='{hbdyg}' width='28%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font color='#000000'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'>{fl}</span></font></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right' ><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hos}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hoss}</font></span></font></font></p>
</td>
<td width='37%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hzs}</font></span></font></font></p>
</td>
</tr>
";
<tr>
<td rowspan='{hbdyg}' width='28%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right' ><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{fl}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right' ><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{hos}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{hoss}</font></span></font></font></p>
</td>
<td width='37%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{hzs}</font></span></font></font></p>
</td>
</tr>";
var mb2 = @"
<tr>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hos}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hoss}</font></span></font></font></p>
</td>
<td>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{hzs}</font></span></font></font></p>
</td>
</tr>
";
var ksmb = @" <tr>
<tr>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{hos}</font></span></font></font></p>
</td>
<td width='17%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{hoss}</font></span></font></font></p>
</td>
<td>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{hzs}</font></span></font></font></p>
</td>
</tr>";
var ksmb = @"
<tr>
<td width='63%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 9pt'><span lang='zh-CN'><font face='宋体'>{dept_name}</font></span></font></font></p>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{dept_name}</font></span></font></font></p>
</td>
<td width='36%' bgcolor='#ffffff' style='background: #ffffff'>
<p align='right'><font face='宋体'><font size='2' style='font-size: 7pt'><span lang='zh-CN'><font face='宋体'>{rc}</font></span></font></font></p>
<p align='right'><font face='宋体'><font size='2' style='font-size: 13pt'><span lang='zh-CN'><font face='宋体'>{rc}</font></span></font></font></p>
</td>
</tr>
";
</tr>";
// 现在你可以使用htmlContent变量中的HTML代码
foreach (var item in dqfb.Select(s => s.classification).Distinct())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment