Commit a89def6e by 刘军

提交修改后的报告

parent b0a21d5a
......@@ -30,12 +30,15 @@ namespace G.MES.API.Controllers
/// </summary>
/// <returns></returns>
[HttpPost]
[NoAuthAttribute]
public bool ImportChemotherapy()
{
try
{
HttpPostedFile file = HttpContext.Current.Request.Files["Excel"];
if (file == null)
{
returnWarn("文件不能为空");
}
return svc.ImportChemotherapy(file);
}
catch (Exception e)
......
using G.Buss.BaseInfo.Services.ClientInfoSVC;
using G.Buss.BaseInfo.ViewModel.ClientInfoModel;
using G.Buss.BaseInfo.ViewModel.PMIDModel;
using G.MES.API.App_Start;
using G.MES.ViewModel;
using System;
using System.Collections.Generic;
......@@ -34,6 +35,25 @@ namespace G.MES.API.Controllers
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>
......
......@@ -3,13 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using WordByDocx.Word;
namespace G.MES.API.Controllers
{
/// <summary>
/// 报告导出
/// </summary>
public class ExportWordController
public class ExportWordController : BasicController
{
/// <summary>
/// 获取所选人的报告
......@@ -19,7 +20,11 @@ namespace G.MES.API.Controllers
[HttpPost]
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 @@
<Project>{7E814C22-01A4-479E-BD7B-768E36062B99}</Project>
<Name>2.G.MES.ViewModel</Name>
</ProjectReference>
<ProjectReference Include="..\WordByDocx\WordByDocx.csproj">
<Project>{428bc45a-fe04-4f97-9df5-b9b9f5b931b3}</Project>
<Name>WordByDocx</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
......
......@@ -88,10 +88,12 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
}
}
#endregion
public List<CodeValueIDAndValueModel> GetClientDataSizeCodeValue() {
using (var context = new MsSqlContext(sqlConn)) {
public List<CodeValueIDAndValueModel> GetClientDataSizeCodeValue()
{
using (var context = new MsSqlContext(sqlConn))
{
List<CodeValueIDAndValueModel> AllSonDictionaryDirectory = context.Query<CodeValue>()
.Where(a =>a.CodeTableID== "ClientDataSize")
.Where(a => a.CodeTableID == "ClientDataSize")
.Select(a => new CodeValueIDAndValueModel
{
CodeID = a.CodeID,
......@@ -134,6 +136,36 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
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>
......@@ -197,7 +229,7 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
}
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)
{
//更新
......@@ -374,7 +406,7 @@ namespace G.Buss.BaseInfo.Services.ClientInfoSVC
DateTime.TryParse(Irow.GetCell(9).ToString(), out dtDate);
ClientInfo.ReceivedDate = dtDate;
}
if (Irow.GetCell(10) != null && string.IsNullOrEmpty(Irow.GetCell(10).ToString()))
{
DateTime dtDate;
......
......@@ -28,6 +28,7 @@
<add key="EnablePassWordStrength" value="1" />
<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="downLoadDic" value="../OutFile/"/>
</appSettings>
<connectionStrings>
<add name="MainDB" connectionString="Data Source=47.96.124.15;Database=JCBB_MB;User Id=sa;Password=valtai" />
......
......@@ -10,8 +10,7 @@ namespace UnitTestWord
[TestMethod]
public void TestMethod1()
{
CreateWordReport report = new CreateWordReport();
report.CreateWord();
CreateWordReport.CreateWord(Guid.Parse("FB21CDE7-90AB-4781-A432-AA463ABD83D0"));
//OperationFunc.GetExcel();
}
}
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xceed.Words.NET;
......@@ -10,15 +11,21 @@ namespace WordByDocx.Word
{
public class CreateWordReport
{
//public static readonly string BaseDic = ConfigurationManager.AppSettings["TemplateDic"];
//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 OutDic = @"F:\Work\Project\报告系统\Git\ReportingSystemAPI\UnitTestWord\bin\Debug\template\";
public string CreateWord()
public static readonly string BaseDic = ConfigurationManager.AppSettings["TemplateDic"];
public static readonly string OutDic = ConfigurationManager.AppSettings["OutDic"];
public static readonly string DownLoadDic = ConfigurationManager.AppSettings["downLoadDic"];
//public static readonly string BaseDic = @"F:\Work\Project\报告系统\Git\ReportingSystemAPI\UnitTestWord\bin\Debug\template\参考报告.docx";
//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();
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.ReplaceUserInfo(guids);
replaceText.ReplaceTMBTable();
......@@ -29,13 +36,14 @@ namespace WordByDocx.Word
replaceText.ReplaceSummary();
replaceText.ReplaceChemotherapy();
replaceText.ReplaceSampleQuality();
document.SaveToFile(OutDic + "out.docx");
using (var documentDocx = DocX.Load(OutDic + "out.docx"))
string fileName = "out-" + tick + ".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.Save();
}
return "";
return DownLoadDic + fileName;
}
}
}
......@@ -80,8 +80,6 @@ namespace WordByDocx.Word
p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
p3.AppendText(heards[i]);
}
bool mergeFlag = false;
string preOID = string.Empty;
for (int r = 0; r < summaries.Rows.Count; r++)
{
TableRow dataRow = table.Rows[r + 1];
......@@ -116,7 +114,7 @@ namespace WordByDocx.Word
string[] heards = new string[] { "药物", "基因", "检测位点", "基因型", "用药提示", "级别" };
string[] tableHeards = new string[] { "DrugPlan", "Gene", "TestSite", "Genotype", "MedicationPrompts", "Levels" };
Section section = document.Sections[0];
TextSelection selection = document.FindString("#{Chemotherapy}", true, true);
TextSelection selection = document.FindString("#{Chemotherapys}", true, true);
TextRange range = selection.GetAsOneRange();
Paragraph paragraph = range.OwnerParagraph;
Body body = paragraph.OwnerTextBody;
......@@ -136,8 +134,6 @@ namespace WordByDocx.Word
p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
p3.AppendText(heards[i]);
}
bool mergeFlag = false;
string preOID = string.Empty;
for (int r = 0; r < summaries.Rows.Count; r++)
{
TableRow dataRow = table.Rows[r + 1];
......@@ -153,10 +149,6 @@ namespace WordByDocx.Word
{
table.ApplyVerticalMerge(i, r, r + 1);
}
//else
//{
// preOID = summaries.Rows[r]["SummaryOID"].ToString();
//}
}
}
body.ChildObjects.Remove(paragraph);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论