Commit c4534545 by tangzhongyang

导出查询报告

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