Commit a89def6e by 刘军

提交修改后的报告

parent b0a21d5a
...@@ -30,12 +30,15 @@ namespace G.MES.API.Controllers ...@@ -30,12 +30,15 @@ namespace G.MES.API.Controllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
[NoAuthAttribute]
public bool ImportChemotherapy() public bool ImportChemotherapy()
{ {
try try
{ {
HttpPostedFile file = HttpContext.Current.Request.Files["Excel"]; HttpPostedFile file = HttpContext.Current.Request.Files["Excel"];
if (file == null)
{
returnWarn("文件不能为空");
}
return svc.ImportChemotherapy(file); return svc.ImportChemotherapy(file);
} }
catch (Exception e) catch (Exception e)
......
using G.Buss.BaseInfo.Services.ClientInfoSVC; using G.Buss.BaseInfo.Services.ClientInfoSVC;
using G.Buss.BaseInfo.ViewModel.ClientInfoModel; using G.Buss.BaseInfo.ViewModel.ClientInfoModel;
using G.Buss.BaseInfo.ViewModel.PMIDModel; using G.Buss.BaseInfo.ViewModel.PMIDModel;
using G.MES.API.App_Start;
using G.MES.ViewModel; using G.MES.ViewModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -34,6 +35,25 @@ namespace G.MES.API.Controllers ...@@ -34,6 +35,25 @@ namespace G.MES.API.Controllers
throw new Exception("获取受试者信息表格" + ex.Message); throw new Exception("获取受试者信息表格" + ex.Message);
} }
} }
/// <summary>
/// 获取所有受试者信息列表
/// </summary>
/// <param name="requestModel"></param>
/// <returns></returns>
[HttpPost]
public PageData GetAllClientInfo(ClientInfoRequestModel requestModel)
{
try
{
return ClientInfo.DoGetAllClientInfo(requestModel);
}
catch (Exception ex)
{
throw new Exception("获取受试者信息表格" + ex.Message);
}
}
/// <summary> /// <summary>
/// 获取详情 /// 获取详情
/// </summary> /// </summary>
......
...@@ -3,13 +3,14 @@ using System.Collections.Generic; ...@@ -3,13 +3,14 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.Http; using System.Web.Http;
using WordByDocx.Word;
namespace G.MES.API.Controllers namespace G.MES.API.Controllers
{ {
/// <summary> /// <summary>
/// 报告导出 /// 报告导出
/// </summary> /// </summary>
public class ExportWordController public class ExportWordController : BasicController
{ {
/// <summary> /// <summary>
/// 获取所选人的报告 /// 获取所选人的报告
...@@ -19,7 +20,11 @@ namespace G.MES.API.Controllers ...@@ -19,7 +20,11 @@ namespace G.MES.API.Controllers
[HttpPost] [HttpPost]
public string GetCurrentReport(List<Guid> ClientInfosOID) public string GetCurrentReport(List<Guid> ClientInfosOID)
{ {
return ""; if (ClientInfosOID.Count > 1)
{
returnWarn("暂不支持批量导出");
}
return CreateWordReport.CreateWord(ClientInfosOID[0]);
} }
} }
} }
\ No newline at end of file
...@@ -1011,6 +1011,10 @@ ...@@ -1011,6 +1011,10 @@
<Project>{7E814C22-01A4-479E-BD7B-768E36062B99}</Project> <Project>{7E814C22-01A4-479E-BD7B-768E36062B99}</Project>
<Name>2.G.MES.ViewModel</Name> <Name>2.G.MES.ViewModel</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\WordByDocx\WordByDocx.csproj">
<Project>{428bc45a-fe04-4f97-9df5-b9b9f5b931b3}</Project>
<Name>WordByDocx</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
......
...@@ -88,10 +88,12 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC ...@@ -88,10 +88,12 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
} }
} }
#endregion #endregion
public List<CodeValueIDAndValueModel> GetClientDataSizeCodeValue() { public List<CodeValueIDAndValueModel> GetClientDataSizeCodeValue()
using (var context = new MsSqlContext(sqlConn)) { {
using (var context = new MsSqlContext(sqlConn))
{
List<CodeValueIDAndValueModel> AllSonDictionaryDirectory = context.Query<CodeValue>() List<CodeValueIDAndValueModel> AllSonDictionaryDirectory = context.Query<CodeValue>()
.Where(a =>a.CodeTableID== "ClientDataSize") .Where(a => a.CodeTableID == "ClientDataSize")
.Select(a => new CodeValueIDAndValueModel .Select(a => new CodeValueIDAndValueModel
{ {
CodeID = a.CodeID, CodeID = a.CodeID,
...@@ -134,6 +136,36 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC ...@@ -134,6 +136,36 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
throw new Exception(ex.Message); throw new Exception(ex.Message);
} }
} }
public PageData DoGetAllClientInfo(ClientInfoRequestModel requestModel)
{
try
{
using (var context = new MsSqlContext(sqlConn))
{
var ClientInfoQuery = context.JoinQuery<ClientInfo, Sys_Organize>((ClientInfo, org) => new object[] {
JoinType.LeftJoin,ClientInfo.SYS_ORG == org.Sys_OrganizeOID
}).Select((ClientInfo, org) => new ClientInfoQueryModel
{
ClientInfoOID = ClientInfo.ClientInfoOID,
Name = ClientInfo.Name,
Sex = ClientInfo.Sex,
IDCard = ClientInfo.IDCard,
Birth = ClientInfo.Birth,
SampleCode = ClientInfo.SampleCode,
ClassCode = org.ClassCode
});
int TotalNum = ClientInfoQuery.Count();
List<ClientInfoQueryModel> ClientInfoList = ClientInfoQuery.OrderBy(a => a.Name).TakePage(requestModel.pageindex, requestModel.pagesize).ToList();
return PageData.Make(requestModel.pageindex, requestModel.pagesize, TotalNum, ClientInfoList);
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary> /// <summary>
/// 获取筛选条件 /// 获取筛选条件
/// </summary> /// </summary>
...@@ -197,7 +229,7 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC ...@@ -197,7 +229,7 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
} }
using (var context = new MsSqlContext(sqlConn)) using (var context = new MsSqlContext(sqlConn))
{ {
ClientInfo nowSam = context.Query<ClientInfo>().Where(a => a.SampleCode == ClientInfo.SampleCode).FirstOrDefault(); ClientInfo nowSam = context.Query<ClientInfo>().Where(a => a.ClientInfoOID == ClientInfo.ClientInfoOID).FirstOrDefault();
if (nowSam != null) if (nowSam != null)
{ {
//更新 //更新
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<add key="EnablePassWordStrength" value="1" /> <add key="EnablePassWordStrength" value="1" />
<add key="TemplateDic" value="F:\Work\Project\报告系统\Git\ReportingSystemAPI\G.MES.API\Template\参考报告.docx" /> <add key="TemplateDic" value="F:\Work\Project\报告系统\Git\ReportingSystemAPI\G.MES.API\Template\参考报告.docx" />
<add key="OutDic" value="F:\Work\Project\报告系统\Git\ReportingSystemAPI\G.MES.API\OutFile\" /> <add key="OutDic" value="F:\Work\Project\报告系统\Git\ReportingSystemAPI\G.MES.API\OutFile\" />
<add key="downLoadDic" value="../OutFile/"/>
</appSettings> </appSettings>
<connectionStrings> <connectionStrings>
<add name="MainDB" connectionString="Data Source=47.96.124.15;Database=JCBB_MB;User Id=sa;Password=valtai" /> <add name="MainDB" connectionString="Data Source=47.96.124.15;Database=JCBB_MB;User Id=sa;Password=valtai" />
......
...@@ -10,8 +10,7 @@ namespace UnitTestWord ...@@ -10,8 +10,7 @@ namespace UnitTestWord
[TestMethod] [TestMethod]
public void TestMethod1() public void TestMethod1()
{ {
CreateWordReport report = new CreateWordReport(); CreateWordReport.CreateWord(Guid.Parse("FB21CDE7-90AB-4781-A432-AA463ABD83D0"));
report.CreateWord();
//OperationFunc.GetExcel(); //OperationFunc.GetExcel();
} }
} }
......
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xceed.Words.NET; using Xceed.Words.NET;
...@@ -10,15 +11,21 @@ namespace WordByDocx.Word ...@@ -10,15 +11,21 @@ namespace WordByDocx.Word
{ {
public class CreateWordReport public class CreateWordReport
{ {
//public static readonly string BaseDic = ConfigurationManager.AppSettings["TemplateDic"]; public static readonly string BaseDic = ConfigurationManager.AppSettings["TemplateDic"];
//public static readonly string OutDic = ConfigurationManager.AppSettings["OutDic"]; public static readonly string OutDic = ConfigurationManager.AppSettings["OutDic"];
public static readonly string BaseDic = @"F:\Work\Project\报告系统\Git\ReportingSystemAPI\UnitTestWord\bin\Debug\template\参考报告.docx"; public static readonly string DownLoadDic = ConfigurationManager.AppSettings["downLoadDic"];
public static readonly string OutDic = @"F:\Work\Project\报告系统\Git\ReportingSystemAPI\UnitTestWord\bin\Debug\template\"; //public static readonly string BaseDic = @"F:\Work\Project\报告系统\Git\ReportingSystemAPI\UnitTestWord\bin\Debug\template\参考报告.docx";
public string CreateWord() //public static readonly string OutDic = @"F:\Work\Project\报告系统\Git\ReportingSystemAPI\UnitTestWord\bin\Debug\template\";
public static string CreateWord(Guid guids)
{ {
//for (int i = 0; i < guids.Count; i++)
//{
// ThreadPool.
//}
string tick = DateTime.Now.Ticks.ToString();
Spire.Doc.Document document = new Spire.Doc.Document(); Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(BaseDic); document.LoadFromFile(BaseDic);
Guid guids = new Guid("09B141B3-2E2A-4DF7-A9B9-B281B7AC0DAE"); //guids = new Guid("09B141B3-2E2A-4DF7-A9B9-B281B7AC0DAE");
ReplaceText replaceText = new ReplaceText(document); ReplaceText replaceText = new ReplaceText(document);
replaceText.ReplaceUserInfo(guids); replaceText.ReplaceUserInfo(guids);
replaceText.ReplaceTMBTable(); replaceText.ReplaceTMBTable();
...@@ -29,13 +36,14 @@ namespace WordByDocx.Word ...@@ -29,13 +36,14 @@ namespace WordByDocx.Word
replaceText.ReplaceSummary(); replaceText.ReplaceSummary();
replaceText.ReplaceChemotherapy(); replaceText.ReplaceChemotherapy();
replaceText.ReplaceSampleQuality(); replaceText.ReplaceSampleQuality();
document.SaveToFile(OutDic + "out.docx"); string fileName = "out-" + tick + ".docx";
using (var documentDocx = DocX.Load(OutDic + "out.docx")) document.SaveToFile(OutDic + fileName);
using (var documentDocx = DocX.Load(OutDic + fileName))
{ {
documentDocx.Paragraphs[0].ReplaceText("Evaluation Warning: The document was created with Spire.Doc for .NET.", ""); documentDocx.Paragraphs[0].ReplaceText("Evaluation Warning: The document was created with Spire.Doc for .NET.", "");
documentDocx.Save(); documentDocx.Save();
} }
return ""; return DownLoadDic + fileName;
} }
} }
} }
...@@ -80,8 +80,6 @@ namespace WordByDocx.Word ...@@ -80,8 +80,6 @@ namespace WordByDocx.Word
p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center; p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
p3.AppendText(heards[i]); p3.AppendText(heards[i]);
} }
bool mergeFlag = false;
string preOID = string.Empty;
for (int r = 0; r < summaries.Rows.Count; r++) for (int r = 0; r < summaries.Rows.Count; r++)
{ {
TableRow dataRow = table.Rows[r + 1]; TableRow dataRow = table.Rows[r + 1];
...@@ -116,7 +114,7 @@ namespace WordByDocx.Word ...@@ -116,7 +114,7 @@ namespace WordByDocx.Word
string[] heards = new string[] { "药物", "基因", "检测位点", "基因型", "用药提示", "级别" }; string[] heards = new string[] { "药物", "基因", "检测位点", "基因型", "用药提示", "级别" };
string[] tableHeards = new string[] { "DrugPlan", "Gene", "TestSite", "Genotype", "MedicationPrompts", "Levels" }; string[] tableHeards = new string[] { "DrugPlan", "Gene", "TestSite", "Genotype", "MedicationPrompts", "Levels" };
Section section = document.Sections[0]; Section section = document.Sections[0];
TextSelection selection = document.FindString("#{Chemotherapy}", true, true); TextSelection selection = document.FindString("#{Chemotherapys}", true, true);
TextRange range = selection.GetAsOneRange(); TextRange range = selection.GetAsOneRange();
Paragraph paragraph = range.OwnerParagraph; Paragraph paragraph = range.OwnerParagraph;
Body body = paragraph.OwnerTextBody; Body body = paragraph.OwnerTextBody;
...@@ -136,8 +134,6 @@ namespace WordByDocx.Word ...@@ -136,8 +134,6 @@ namespace WordByDocx.Word
p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center; p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
p3.AppendText(heards[i]); p3.AppendText(heards[i]);
} }
bool mergeFlag = false;
string preOID = string.Empty;
for (int r = 0; r < summaries.Rows.Count; r++) for (int r = 0; r < summaries.Rows.Count; r++)
{ {
TableRow dataRow = table.Rows[r + 1]; TableRow dataRow = table.Rows[r + 1];
...@@ -153,10 +149,6 @@ namespace WordByDocx.Word ...@@ -153,10 +149,6 @@ namespace WordByDocx.Word
{ {
table.ApplyVerticalMerge(i, r, r + 1); table.ApplyVerticalMerge(i, r, r + 1);
} }
//else
//{
// preOID = summaries.Rows[r]["SummaryOID"].ToString();
//}
} }
} }
body.ChildObjects.Remove(paragraph); body.ChildObjects.Remove(paragraph);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论