Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
ReportingSystemAPI
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
刘军
ReportingSystemAPI
Commits
a89def6e
Commit
a89def6e
authored
Jan 02, 2020
by
刘军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交修改后的报告
parent
b0a21d5a
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
93 行增加
和
28 行删除
+93
-28
G.MES.API/Controllers/ChemotherapyController.cs
+4
-1
G.MES.API/Controllers/ClientInfoController.cs
+20
-0
G.MES.API/Controllers/ExportWordController.cs
+8
-2
G.MES.API/G.MES.API.csproj
+4
-0
G.MES.API/Template/Chemotherapy.xlsx
+0
-0
G.MES.Business/G.BaseInfo/Services/ClientInfoSVC/ClientInfoSVC.cs
+37
-5
UnitTestWord/App.config
+1
-0
UnitTestWord/UnitTest1.cs
+1
-2
WordByDocx/Word/CreateWordReport.cs
+17
-9
WordByDocx/Word/ReplaceText.cs
+1
-9
WordByDocx/template/参考报告.docx
+0
-0
没有找到文件。
G.MES.API/Controllers/ChemotherapyController.cs
查看文件 @
a89def6e
...
...
@@ -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
)
...
...
G.MES.API/Controllers/ClientInfoController.cs
查看文件 @
a89def6e
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>
...
...
G.MES.API/Controllers/ExportWordController.cs
查看文件 @
a89def6e
...
...
@@ -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
G.MES.API/G.MES.API.csproj
查看文件 @
a89def6e
...
...
@@ -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>
...
...
G.MES.API/Template/Chemotherapy.xlsx
查看文件 @
a89def6e
No preview for this file type
G.MES.Business/G.BaseInfo/Services/ClientInfoSVC/ClientInfoSVC.cs
查看文件 @
a89def6e
...
...
@@ -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
;
...
...
UnitTestWord/App.config
查看文件 @
a89def6e
...
...
@@ -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"
/>
...
...
UnitTestWord/UnitTest1.cs
查看文件 @
a89def6e
...
...
@@ -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();
}
}
...
...
WordByDocx/Word/CreateWordReport.cs
查看文件 @
a89def6e
...
...
@@ -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
;
}
}
}
WordByDocx/Word/ReplaceText.cs
查看文件 @
a89def6e
...
...
@@ -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
(
"#{Chemotherapy
s
}"
,
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
);
...
...
WordByDocx/template/参考报告.docx
查看文件 @
a89def6e
No preview for this file type
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论