using Microsoft.EntityFrameworkCore;
using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Xceed.Document.NET;
using Xceed.Words.NET;
namespace Shentun.Peis.ReportTemplates
{
///
/// 单位体检报告管理
///
public class CustomerOrgReportManager : DomainService
{
private readonly IRepository _patientRegisterRepository;
private readonly CustomerOrgManager _customerOrgManager;
private readonly IRepository _registerCheckRepository;
private readonly IRepository _registerAsbitemRepository;
private readonly IRepository _asbitemRepository;
private readonly IRepository _itemTypeRepository;
private readonly IRepository _sexRepository;
private readonly IRepository _sumSummaryHeaderRepository;
private readonly IRepository _sumDiagnosisRepository;
private readonly IRepository _sumSuggestionHeaderRepository;
private readonly IRepository _customerOrgRepository;
private readonly CacheService _cacheService;
private readonly string DirectoryName = System.AppDomain.CurrentDomain.BaseDirectory + @"\ReportFile";
public CustomerOrgReportManager(
IRepository patientRegisterRepository,
CustomerOrgManager customerOrgManager,
IRepository registerCheckRepository,
IRepository registerAsbitemRepository,
IRepository asbitemRepository,
IRepository itemTypeRepository,
IRepository sexRepository,
IRepository sumSummaryHeaderRepository,
IRepository sumDiagnosisRepository,
IRepository sumSuggestionHeaderRepository,
IRepository customerOrgRepository,
CacheService cacheService)
{
_patientRegisterRepository = patientRegisterRepository;
_customerOrgManager = customerOrgManager;
_registerCheckRepository = registerCheckRepository;
_registerAsbitemRepository = registerAsbitemRepository;
_asbitemRepository = asbitemRepository;
_itemTypeRepository = itemTypeRepository;
_sexRepository = sexRepository;
_sumSummaryHeaderRepository = sumSummaryHeaderRepository;
_sumDiagnosisRepository = sumDiagnosisRepository;
_sumSuggestionHeaderRepository = sumSuggestionHeaderRepository;
_customerOrgRepository = customerOrgRepository;
_cacheService = cacheService;
}
///
/// 根据模板创建报告
///
///
public string CreateCustomerOrgPeisFromTemplate(UnitPhysicalExaminationReportExportWordData documentData)
{
DocX template = DocX.Load(DirectoryName + @"\CustomerOrgTemplate\单位体检报告模板.docx");
template.DifferentFirstPage = true;
template.AddHeaders();
Header header = template.Headers.Odd;
// Insert Paragraph in header
Paragraph paragraph = header.InsertParagraph();
Xceed.Document.NET.Image logo = template.AddImage(DirectoryName + @"\CustomerOrgTemplate\logo.jpg");
var pic = logo.CreatePicture();
pic.Width = 40f;
pic.Height = 40f;
paragraph.AppendPicture(pic);
paragraph.Append("\t\t\t\t健康体检中心");
template.AddFooters();
Footer footer = template.Footers.Odd;
// Insert Paragraph in header
//Paragraph paragraph1 = footer.InsertParagraph();
//paragraph1.Append("File Format Develoer Guide");
#region 封面
template.ReplaceText(new StringReplaceTextOptions
{
SearchValue = "{MedicalTitle}",
NewValue = documentData.MedicalTitle
});
template.ReplaceText(new StringReplaceTextOptions
{
SearchValue = "{MedicalTimes}",
NewValue = documentData.MedicalTimes.ToString()
});
template.ReplaceText(new StringReplaceTextOptions
{
SearchValue = "{MedicalStartDate}",
NewValue = documentData.MedicalStartDate
});
template.ReplaceText(new StringReplaceTextOptions
{
SearchValue = "{MedicalEndDate}",
NewValue = documentData.MedicalEndDate
});
template.ReplaceText(new StringReplaceTextOptions
{
SearchValue = "{TabulationDate}",
NewValue = documentData.TabulationDate
});
template.ReplaceText(new StringReplaceTextOptions
{
SearchValue = "{PrintDate}",
NewValue = documentData.PrintDate
});
#endregion
#region 参检人员构成情况
template.AddCustomProperty(new CustomProperty("Register_MaleNumber", documentData.RegisterDetail.MaleNumber));
template.AddCustomProperty(new CustomProperty("Register_FemaleNumber", documentData.RegisterDetail.FemaleNumber));
template.AddCustomProperty(new CustomProperty("Register_OtherNumber", documentData.RegisterDetail.OtherNumber));
template.AddCustomProperty(new CustomProperty("Register_TotalNumber", documentData.RegisterDetail.TotalNumber));
template.AddCustomProperty(new CustomProperty("Register_MaleRatio", documentData.RegisterDetail.MaleRatio));
template.AddCustomProperty(new CustomProperty("Register_FemaleRatio", documentData.RegisterDetail.FemaleRatio));
template.AddCustomProperty(new CustomProperty("Checked_MaleNumber", documentData.CheckedDetail.MaleNumber));
template.AddCustomProperty(new CustomProperty("Checked_FemaleNumber", documentData.CheckedDetail.FemaleNumber));
template.AddCustomProperty(new CustomProperty("Checked_OtherNumber", documentData.CheckedDetail.OtherNumber));
template.AddCustomProperty(new CustomProperty("Checked_TotalNumber", documentData.CheckedDetail.TotalNumber));
template.AddCustomProperty(new CustomProperty("Checked_MaleRatio", documentData.CheckedDetail.MaleRatio));
template.AddCustomProperty(new CustomProperty("Checked_FemaleRatio", documentData.CheckedDetail.FemaleRatio));
template.AddCustomProperty(new CustomProperty("Checked_MaleExamineRatio", documentData.CheckedDetail.MaleExamineRatio));
template.AddCustomProperty(new CustomProperty("Checked_FemaleExamineRatio", documentData.CheckedDetail.FemaleExamineRatio));
template.AddCustomProperty(new CustomProperty("Checked_AverageExamineRatio", documentData.CheckedDetail.AverageExamineRatio));
template.AddCustomProperty(new CustomProperty("UnCheck_MaleNumber", documentData.UnCheckedDetail.MaleNumber));
template.AddCustomProperty(new CustomProperty("UnCheck_FemaleNumber", documentData.UnCheckedDetail.FemaleNumber));
template.AddCustomProperty(new CustomProperty("UnCheck_OtherNumber", documentData.UnCheckedDetail.OtherNumber));
template.AddCustomProperty(new CustomProperty("UnCheck_TotalNumber", documentData.UnCheckedDetail.TotalNumber));
template.AddCustomProperty(new CustomProperty("UnCheck_MaleRatio", documentData.UnCheckedDetail.MaleRatio));
template.AddCustomProperty(new CustomProperty("UnCheck_FemaleRatio", documentData.UnCheckedDetail.FemaleRatio));
template.AddCustomProperty(new CustomProperty("UnCheck_MaleExamineRatio", documentData.UnCheckedDetail.MaleExamineRatio));
template.AddCustomProperty(new CustomProperty("UnCheck_FemaleExamineRatio", documentData.UnCheckedDetail.FemaleExamineRatio));
template.AddCustomProperty(new CustomProperty("UnCheck_AverageExamineRatio", documentData.UnCheckedDetail.AverageExamineRatio));
#endregion
#region 参检百分比
var p3Paragraphs1 = template.Paragraphs.Where(p => p.Text.Equals("参检百分比:")).FirstOrDefault();
var p3Chat1 = template.AddChart();
p3Chat1.AddLegend(ChartLegendPosition.Right, true);
var p3ChatData1 = new List();
p3ChatData1.Add(new ChartData() { Category = "未检", Expenses = documentData.UnCheckedDetail.TotalNumber });
p3ChatData1.Add(new ChartData() { Category = "已检", Expenses = documentData.CheckedDetail.TotalNumber });
// 创建饼图并绑定数据
var p3Chats1 = new Series("参检百分比");
p3Chats1.Bind(p3ChatData1, "Category", "Expenses");
p3Chat1.AddSeries(p3Chats1);
template.InsertChartAfterParagraph(p3Chat1, p3Paragraphs1.NextParagraph, 200f, 150f);
#endregion
#region 参检性别百分比
var p3Paragraphs2 = template.Paragraphs.Where(p => p.Text.Equals("参检性别百分比:")).FirstOrDefault();
var p3Chat2 = template.AddChart();
p3Chat2.AddLegend(ChartLegendPosition.Right, true);
var p3ChatData2 = new List();
p3ChatData2.Add(new ChartData() { Category = "男性", Expenses = documentData.CheckedDetail.MaleNumber });
p3ChatData2.Add(new ChartData() { Category = "女性", Expenses = documentData.CheckedDetail.FemaleNumber });
p3ChatData2.Add(new ChartData() { Category = "其他", Expenses = documentData.CheckedDetail.OtherNumber });
// 创建饼图并绑定数据
var p3Chats2 = new Series("参检性别百分比");
p3Chats2.Bind(p3ChatData2, "Category", "Expenses");
p3Chat2.AddSeries(p3Chats2);
template.InsertChartAfterParagraph(p3Chat2, p3Paragraphs2.NextParagraph, 200f, 150f);
#endregion
#region 第二部分 体检项目得参检情况
var table4 = template.Tables[4];
var table4Data = documentData.MedicalItemExamineSituations;
int rowIndex = 2;
if (table4Data.Any())
{
foreach (var item in table4Data)
{
table4.Rows[rowIndex].Cells[0].Paragraphs[0].Append(item.ItemTypeName);
table4.Rows[rowIndex].Cells[1].Paragraphs[0].Append(item.AsbitemName);
table4.Rows[rowIndex].Cells[2].Paragraphs[0].Append(item.MaleAsbitemCheckNumber.ToString());
table4.Rows[rowIndex].Cells[3].Paragraphs[0].Append(item.FemaleAsbitemCheckNumber.ToString());
table4.Rows[rowIndex].Cells[4].Paragraphs[0].Append(item.TotalAsbitemCheckNumber.ToString());
table4.Rows[rowIndex].Cells[5].Paragraphs[0].Append(item.MaleSumCheckNumber.ToString());
table4.Rows[rowIndex].Cells[6].Paragraphs[0].Append(item.FemaleSumCheckNumber.ToString());
table4.Rows[rowIndex].Cells[7].Paragraphs[0].Append(item.TotalSumCheckNumber.ToString());
table4.Rows[rowIndex].Cells[8].Paragraphs[0].Append(item.MaleAsbitemCheckRatio.ToString());
table4.Rows[rowIndex].Cells[9].Paragraphs[0].Append(item.FemaleAsbitemCheckRatio.ToString());
table4.Rows[rowIndex].Cells[10].Paragraphs[0].Append(item.TotalAsbitemCheckRatio.ToString());
rowIndex++;
if (rowIndex - 2 < table4Data.Count) table4.InsertRow();
}
}
#endregion
#region 第三部分 全体员工体检结果汇总
var table5 = template.Tables[5];
var table5Data = documentData.MedicalResultSummarys;
rowIndex = 1;
if (table5Data.Any())
{
foreach (var item in table5Data)
{
table5.Rows[rowIndex].Cells[0].Paragraphs[0].Append(item.PatientNo);
table5.Rows[rowIndex].Cells[1].Paragraphs[0].Append(item.PatientName);
table5.Rows[rowIndex].Cells[2].Paragraphs[0].Append(item.SexName);
table5.Rows[rowIndex].Cells[3].Paragraphs[0].Append(item.Age);
table5.Rows[rowIndex].Cells[4].Paragraphs[0].Append(item.MedicalResult);
rowIndex++;
if (rowIndex - 1 < table5Data.Count) table5.InsertRow();
}
}
#endregion
#region 第四部分 体检异常结果检出统计
var table6 = template.Tables[6];
var table6Data = documentData.MedicalAbnormalResultStatistics;
rowIndex = 2;
if (table6Data.Any())
{
foreach (var item in table6Data)
{
table6.Rows[rowIndex].Cells[0].Paragraphs[0].Append(item.DiagnosisName);
table6.Rows[rowIndex].Cells[1].Paragraphs[0].Append(item.PatientDetail);
table6.Rows[rowIndex].Cells[2].Paragraphs[0].Append(item.MaleNumber.ToString());
table6.Rows[rowIndex].Cells[3].Paragraphs[0].Append(item.FemaleNumber.ToString());
table6.Rows[rowIndex].Cells[4].Paragraphs[0].Append(item.TotalNumber.ToString());
table6.Rows[rowIndex].Cells[5].Paragraphs[0].Append(item.MaleRatio);
table6.Rows[rowIndex].Cells[6].Paragraphs[0].Append(item.FemaleRatio);
table6.Rows[rowIndex].Cells[7].Paragraphs[0].Append(item.AverageRatio);
rowIndex++;
if (rowIndex - 2 < table6Data.Count) table6.InsertRow();
}
}
#endregion
#region 十大异常柱状图
var p3Paragraphs3 = template.Paragraphs.Where(p => p.Text.Equals("前十大异常结果柱状图:")).FirstOrDefault();
var p6Chat1 = template.AddChart();
p6Chat1.AddLegend(ChartLegendPosition.Right, false);
p6Chat1.BarDirection = BarDirection.Column;//指示柱状图是横向的还是纵向的:Column纵向,Bar横向
p6Chat1.BarGrouping = BarGrouping.Stacked;//这个不好解释,一个4个枚举值,你一一试一遍就知道了
p6Chat1.GapWidth = 200;//柱状图表的宽度
p6Chat1.GapWidth = 200;
var p6ChatData = new List();
if (documentData.MedicalAbnormalResultStatistics.Any())
{
var medicalAbnormalResultStatisticsTop10 = documentData.MedicalAbnormalResultStatistics.Take(10);
foreach (var item in medicalAbnormalResultStatisticsTop10)
{
p6ChatData.Add(new ChartData() { Category = item.DiagnosisName, Expenses = item.TotalNumber });
}
}
var p6Chats1 = new Series("疾病人数");
p6Chats1.Color = Color.FromArgb(79, 129, 189);
p6Chats1.Bind(p6ChatData, "Category", "Expenses");
p6Chat1.AddSeries(p6Chats1);
template.InsertChartAfterParagraph(p6Chat1, p3Paragraphs3.NextParagraph);
#endregion
#region 十大异常饼状图
var p3Paragraphs4 = template.Paragraphs.Where(p => p.Text.Equals("前十大异常结果饼图:")).FirstOrDefault();
var p6Chat2 = template.AddChart();
p6Chat2.AddLegend(ChartLegendPosition.Right, true);
//var p6ChatData2 = new List();
//p6ChatData2.Add(new ChartData() { Category = "疾病1", Expenses = 22 });
//p6ChatData2.Add(new ChartData() { Category = "疾病2", Expenses = 22 });
//p6ChatData2.Add(new ChartData() { Category = "疾病3", Expenses = 22 });
//p6ChatData2.Add(new ChartData() { Category = "疾病4", Expenses = 4 });
//p6ChatData2.Add(new ChartData() { Category = "疾病5", Expenses = 5 });
//p6ChatData2.Add(new ChartData() { Category = "疾病6", Expenses = 6 });
//p6ChatData2.Add(new ChartData() { Category = "疾病7", Expenses = 7 });
//p6ChatData2.Add(new ChartData() { Category = "疾病8", Expenses = 8 });
//p6ChatData2.Add(new ChartData() { Category = "疾病9", Expenses = 9 });
//p6ChatData2.Add(new ChartData() { Category = "疾病10", Expenses = 10 });
// 创建饼图并绑定数据
var p6Chats2 = new Series("疾病人数百分比");
p6Chats2.Bind(p6ChatData, "Category", "Expenses");
p6Chat2.AddSeries(p6Chats2);
template.InsertChartAfterParagraph(p6Chat2, p3Paragraphs4.NextParagraph);
#endregion
#region 第五部分 十大异常结果分析
var table7 = template.Tables[7];
var table7Data = documentData.MedicalTenAbnormalResults;
rowIndex = 1;
if (table7Data.Any())
{
foreach (var item in table7Data)
{
table7.Rows[rowIndex].Cells[0].Paragraphs[0].Append(item.DiagnosisName);
table7.Rows[rowIndex].Cells[1].Paragraphs[0].Append(item.DiagnosisSuggestion);
rowIndex++;
if (rowIndex - 1 < table7Data.Count) table7.InsertRow();
}
}
#endregion
#region 第六部分 体检者未完成情况
var table8 = template.Tables[8];
var table8Data = documentData.MedicalUnCheckedStatistics;
rowIndex = 1;
if (table8Data.Any())
{
foreach (var item in table8Data)
{
table8.Rows[rowIndex].Cells[0].Paragraphs[0].Append(item.PatientNo);
table8.Rows[rowIndex].Cells[1].Paragraphs[0].Append(item.PatientName);
table8.Rows[rowIndex].Cells[2].Paragraphs[0].Append(item.SexName);
table8.Rows[rowIndex].Cells[3].Paragraphs[0].Append(item.Age);
table8.Rows[rowIndex].Cells[4].Paragraphs[0].Append(item.DepartmentName);
rowIndex++;
if (rowIndex - 1 < table8Data.Count) table8.InsertRow();
}
}
#endregion
string documentName = $"{documentData.MedicalTitle}单位体检报告_{Guid.NewGuid().ToString()}.docx";
string savaUrl = DirectoryName + $@"\CustomerOrgTemplate\docs\{DateTime.Now.Year}\{DateTime.Now.Month}\{DateTime.Now.Day}";
if (!Directory.Exists(savaUrl))
{
Directory.CreateDirectory(savaUrl); //创建新文件夹
}
template.SaveAs($@"{savaUrl}\{documentName}");
return $"/ReportFile/CustomerOrgTemplate/docs/{DateTime.Now.Year}/{DateTime.Now.Month}/{DateTime.Now.Day}/{documentName}";
}
///
/// 创建模板
///
public void CreateCustomerOrgPeisTemplate()
{
DocX document = DocX.Create(DirectoryName + @"\CustomerOrgTemplate\单位体检报告模板.docx");
//第一页
Table p1Titletable = document.AddTable(1, 2);
p1Titletable.Design = TableDesign.TableNormal;
p1Titletable.Alignment = Alignment.center;
Border b = new Border();
b.Color = Color.FromArgb(51, 153, 102);
b.Size = BorderSize.six;
p1Titletable.SetBorder(TableBorderType.Bottom, b);
List rows = p1Titletable.Rows;
Row row0 = rows[0];
row0.Height = 65f;
row0.Cells[0].Width = 50f;
Xceed.Document.NET.Image logo = document.AddImage(DirectoryName + @"\CustomerOrgTemplate\logo_template.jpg");
Formatting p1TitleFormatting = new Formatting();
p1TitleFormatting.FontFamily = new Xceed.Document.NET.Font("宋体");
p1TitleFormatting.FontColor = Color.FromArgb(0, 128, 0);
var pic = logo.CreatePicture();
pic.Width = 65f;
pic.Height = 65f;
row0.Cells[0].Paragraphs[0].AppendPicture(pic);
row0.Cells[0].VerticalAlignment = VerticalAlignment.Center;
row0.Cells[1].Width = document.PageWidth - document.MarginLeft - document.MarginRight - 30f;
row0.Cells[1].Paragraphs[0].Append("团体体检健康检查统计报告", p1TitleFormatting).FontSize(22).Alignment = Alignment.center;
row0.Cells[1].VerticalAlignment = VerticalAlignment.Center;
var pTitle = document.InsertParagraph();
pTitle.InsertTableAfterSelf(p1Titletable);
Formatting p1TitleSecFormatting = new Formatting();
p1TitleSecFormatting.FontFamily = new Xceed.Document.NET.Font("楷体");
p1TitleSecFormatting.Size = 26;
var p1TitleSec = document.InsertParagraph();
p1TitleSec.Alignment = Alignment.right;
p1TitleSec.Append("{MedicalTitle}", p1TitleSecFormatting);
var p1TitleSecExt = document.InsertParagraph();
p1TitleSecFormatting.FontFamily = new Xceed.Document.NET.Font("隶书");
p1TitleSecFormatting.Size = 26;
p1TitleSecExt.Alignment = Alignment.right;
p1TitleSecExt.Append("团检报告", p1TitleSecFormatting);
document.InsertParagraph();
Xceed.Document.NET.Image titleImg = document.AddImage(DirectoryName + @"\CustomerOrgTemplate\Page1.jpg");
var p1TitleImg = document.InsertParagraph();
p1TitleImg.Alignment = Alignment.center;
p1TitleImg.AppendPicture(titleImg.CreatePicture());
Table p1Contenttable = document.AddTable(5, 4);
p1Contenttable.Design = TableDesign.TableNormal;
List rowsContent = p1Contenttable.Rows;
Row row0Content = rowsContent[0];
Formatting p1TableContentFormatting = new Formatting();
p1TableContentFormatting.FontFamily = new Xceed.Document.NET.Font("楷体");
Border bTableContent = new Border();
bTableContent.Color = Color.FromArgb(0, 128, 0);
bTableContent.Size = BorderSize.four;
Formatting p1TableColumn1ContentFormatting = new Formatting();
p1TableColumn1ContentFormatting.FontFamily = new Xceed.Document.NET.Font("楷体");
p1TableColumn1ContentFormatting.Size = 18;
row0Content.Cells[0].Width = 200f;
row0Content.Cells[1].Width = 150f;
row0Content.Cells[2].Width = 300f;
row0Content.Cells[1].Paragraphs[0].Append("体检次数", p1TableContentFormatting).FontSize(18).Alignment = Alignment.right;
row0Content.Cells[1].VerticalAlignment = VerticalAlignment.Center;
row0Content.Cells[2].Paragraphs[0].Append("{MedicalTimes}", p1TableColumn1ContentFormatting).Alignment = Alignment.left;
row0Content.Cells[2].VerticalAlignment = VerticalAlignment.Center;
row0Content.Cells[2].SetBorder(TableCellBorderType.Bottom, bTableContent);
Row row1Content = rowsContent[1];
row1Content.Cells[1].Paragraphs[0].Append("体检日期", p1TableContentFormatting).FontSize(18).Alignment = Alignment.right;
row1Content.Cells[1].VerticalAlignment = VerticalAlignment.Center;
row1Content.Cells[2].Paragraphs[0].Append("{MedicalStartDate}", p1TableColumn1ContentFormatting).FontSize(18).Alignment = Alignment.left;
row1Content.Cells[2].VerticalAlignment = VerticalAlignment.Center;
row1Content.Cells[2].SetBorder(TableCellBorderType.Bottom, bTableContent);
Row row2Content = rowsContent[2];
row2Content.Cells[1].Paragraphs[0].Append("结束月份", p1TableContentFormatting).FontSize(18).Alignment = Alignment.right;
row2Content.Cells[1].VerticalAlignment = VerticalAlignment.Center;
row2Content.Cells[2].Paragraphs[0].Append("{MedicalEndDate}", p1TableColumn1ContentFormatting).Alignment = Alignment.left;
row2Content.Cells[2].VerticalAlignment = VerticalAlignment.Center;
row2Content.Cells[2].SetBorder(TableCellBorderType.Bottom, bTableContent);
Row row3Content = rowsContent[3];
row3Content.Cells[1].Paragraphs[0].Append("制表日期", p1TableContentFormatting).FontSize(18).Alignment = Alignment.right;
row3Content.Cells[1].VerticalAlignment = VerticalAlignment.Center;
row3Content.Cells[2].Paragraphs[0].Append("{TabulationDate}", p1TableColumn1ContentFormatting).Alignment = Alignment.left;
row3Content.Cells[2].VerticalAlignment = VerticalAlignment.Center;
Row row4Content = rowsContent[4];
row4Content.Cells[1].Paragraphs[0].Append("打印日期", p1TableContentFormatting).FontSize(18).Alignment = Alignment.right;
row4Content.Cells[1].VerticalAlignment = VerticalAlignment.Center;
row4Content.Cells[2].Paragraphs[0].Append("{PrintDate}", p1TableColumn1ContentFormatting).Alignment = Alignment.left;
row4Content.Cells[2].VerticalAlignment = VerticalAlignment.Center;
var p1Content = document.InsertParagraph();
p1Content.InsertTableAfterSelf(p1Contenttable);
for (int i = 0; i <= 10; i++) document.InsertParagraph();
Table p1FootTable = document.AddTable(1, 1);
p1FootTable.Design = TableDesign.TableNormal;
List rowsFootTable = p1FootTable.Rows;
Row row0Foot = rowsFootTable[0];
row0Foot.Cells[0].Paragraphs[0].Append("医院体检中心 编制", p1TableContentFormatting).FontSize(14).Alignment = Alignment.right;
row0Foot.Cells[0].VerticalAlignment = VerticalAlignment.Center;
row0Foot.Cells[0].SetBorder(TableCellBorderType.Bottom, bTableContent);
var p1Foot = document.InsertParagraph();
p1Foot.InsertTableAfterSelf(p1FootTable);
var p1Foot1 = document.InsertParagraph();
p1Foot1.Append("体检中心地址:", p1TableContentFormatting).FontSize(10).Alignment = Alignment.right;
//第二页
p1Foot1.InsertPageBreakAfterSelf();
Xceed.Document.NET.Font f = new Xceed.Document.NET.Font("宋体");
var p2_1 = document.InsertParagraph("前言").Font(f).FontSize(14);
document.InsertParagraph();
document.InsertParagraph("这是一本针对贵单位员工体检结果的综合分析资料,希望透过本资料,让贵单位主管能够了解员工的健康状况及可以改善的方向。").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"这份报告包括五大部份:基础资料、体检异常情况统计、员工健康问题分析及保健建议、女性员工健康问题分析及保健建议、男性员工健康问题分析及保健建议、全体员工体检结果汇总。我们在每个部份都会提供重要的健康与疾病相关知识,以及后续应该如何处理等信息。让非常关心员工健康的您,知道如何再进一步改善或提倡健康促进活动。").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第一部份:参检人员构成情况").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第二部份:体检项目与体检项目的参检情况").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第三部份:全体员工体检结果汇总").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第四部份:本次体检异常结果检出统计").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第五部份: 本次体检前十大异常结果分析").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第六部份: 体检者未完成情况").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph(@"第七部分:常见体检异常结果分析及健康指导").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph();
document.InsertParagraph(@"医院体检中心另提供完善的后续服务,包括护理咨询服务、特色医院导诊服务、营养咨询等。有任何需要,请电洽相关部门,或拨打咨询专线咨询相关事宜。").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph();
document.InsertParagraph(@"定期健康检查对于员工健康的重要性相信您已知道,然而,更重要的是完成健康检查后,改善健康活动的开始,也就是健康促进的一级预防医学(适当的运动、均衡的饮食、身心休闲),这才是健康检查最终的目标。").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
document.InsertParagraph();
document.InsertParagraph(@"完全依赖治疗的时代已经过去了,应定期健康检查,并落实健康促进的一级预防医学,这将是未来人类健康的不二法门。").Font(f).FontSize(12).IndentationFirstLine = 32.0f;
//第三页
var p2_last = document.InsertParagraph();
p2_last.InsertPageBreakAfterSelf();
document.InsertParagraph(@"一、参检人员构成情况").Font(f).FontSize(16);
Table p3Contenttable = document.AddTable(5, 10);
p3Contenttable.Design = TableDesign.TableGrid;
List p3rowsContent = p3Contenttable.Rows;
Row p3Row0 = p3rowsContent[0];
p3Contenttable.MergeCellsInColumn(0, 0, 1);
p3Row0.Cells[0].Paragraphs[0].Append("情况类型").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row0.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p3Row0.MergeCells(1, 4);
p3Row0.Cells[1].Paragraphs[0].Append("人数").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row0.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p3Row0.MergeCells(2, 3);
p3Row0.Cells[2].Paragraphs[0].Append("构成比率").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row0.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p3Row0.MergeCells(3, 5);
p3Row0.Cells[3].Paragraphs[0].Append("参检比率").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row0.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
p3Contenttable.SetColumnWidth(0, 35f);
Row p3Row1 = p3rowsContent[1];
p3Row1.Cells[1].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[2].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[3].Paragraphs[0].Append("其它").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[4].Paragraphs[0].Append("合计").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[4].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[5].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[5].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[6].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[6].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[7].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[7].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[8].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[8].FillColor = Color.FromArgb(209, 245, 203);
p3Row1.Cells[9].Paragraphs[0].Append("平均").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row1.Cells[9].FillColor = Color.FromArgb(209, 245, 203);
Formatting p3TableFormatting = new Formatting();
p3TableFormatting.FontFamily = new Xceed.Document.NET.Font("宋体");
p3TableFormatting.Size = 10.5;
CustomProperty p3_Register_MaleNumber = new CustomProperty("Register_MaleNumber", "{男性登记人数}");
CustomProperty p3_Register_FemaleNumber = new CustomProperty("Register_FemaleNumber", "{女性登记人数}");
CustomProperty p3_Register_OtherNumber = new CustomProperty("Register_OtherNumber", "{其它登记人数}");
CustomProperty p3_Register_TotalNumber = new CustomProperty("Register_TotalNumber", "{总登记人数}");
CustomProperty p3_Register_MaleRatio = new CustomProperty("Register_MaleRatio", "{男性登记人数占总登记人数百分比}");
CustomProperty p3_Register_FemaleRatio = new CustomProperty("Register_FemaleRatio", "{女性登记人数占总登记人数百分比}");
CustomProperty p3_Checked_MaleNumber = new CustomProperty("Checked_MaleNumber", "{男性实检人数}");
CustomProperty p3_Checked_FemaleNumber = new CustomProperty("Checked_FemaleNumber", "{女性实检人数}");
CustomProperty p3_Checked_OtherNumber = new CustomProperty("Checked_OtherNumber", "{其它实检人数}");
CustomProperty p3_Checked_TotalNumber = new CustomProperty("Checked_TotalNumber", "{总实检人数}");
CustomProperty p3_Checked_MaleRatio = new CustomProperty("Checked_MaleRatio", "{男性实检人数占总实检人数百分比}");
CustomProperty p3_Checked_FemaleRatio = new CustomProperty("Checked_FemaleRatio", "{女性实检人数占总实检人数百分比}");
CustomProperty p3_Checked_MaleExamineRatio = new CustomProperty("Checked_MaleExamineRatio", "{男性实检人数占男性登记人数百分比}");
CustomProperty p3_Checked_FemaleExamineRatio = new CustomProperty("Checked_FemaleExamineRatio", "{女性实检人数占女性登记人数百分比}");
CustomProperty p3_Checked_AverageExamineRatio = new CustomProperty("Checked_AverageExamineRatio", "{总实检人数占总登记人数百分比}");
CustomProperty p3_UnCheck_MaleNumber = new CustomProperty("UnCheck_MaleNumber", "{男性未检人数}");
CustomProperty p3_UnCheck_FemaleNumber = new CustomProperty("UnCheck_FemaleNumber", "{女性未检人数}");
CustomProperty p3_UnCheck_OtherNumber = new CustomProperty("UnCheck_OtherNumber", "{其他未检人数}");
CustomProperty p3_UnCheck_TotalNumber = new CustomProperty("UnCheck_TotalNumber", "{总未检人数}");
CustomProperty p3_UnCheck_MaleRatio = new CustomProperty("UnCheck_MaleRatio", "{男性未检人数占总未检人数百分比}");
CustomProperty p3_UnCheck_FemaleRatio = new CustomProperty("UnCheck_FemaleRatio", "{女性未检人数占总未检人数百分比}");
CustomProperty p3_UnCheck_MaleExamineRatio = new CustomProperty("UnCheck_MaleExamineRatio", "{男性未检人数占男性登记人数百分比}");
CustomProperty p3_UnCheck_FemaleExamineRatio = new CustomProperty("UnCheck_FemaleExamineRatio", "{女性未检人数占女性登记人数百分比}");
CustomProperty p3_UnCheck_AverageExamineRatio = new CustomProperty("UnCheck_AverageExamineRatio", "{总未检人数占总登记人数百分比}");
Row p3Row2 = p3rowsContent[2];
p3Row2.Cells[0].Paragraphs[0].Append("登记").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[1].Paragraphs[0].AppendDocProperty(p3_Register_MaleNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[2].Paragraphs[0].AppendDocProperty(p3_Register_FemaleNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[3].Paragraphs[0].AppendDocProperty(p3_Register_OtherNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[4].Paragraphs[0].AppendDocProperty(p3_Register_TotalNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[5].Paragraphs[0].AppendDocProperty(p3_Register_MaleRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[6].Paragraphs[0].AppendDocProperty(p3_Register_FemaleRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[7].Paragraphs[0].Append("100%").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[8].Paragraphs[0].Append("100%").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row2.Cells[9].Paragraphs[0].Append("100%").Font(f).FontSize(10.5).Alignment = Alignment.center;
Row p3Row3 = p3rowsContent[3];
p3Row3.Cells[0].Paragraphs[0].Append("实检").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[1].Paragraphs[0].AppendDocProperty(p3_Checked_MaleNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[2].Paragraphs[0].AppendDocProperty(p3_Checked_FemaleNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[3].Paragraphs[0].AppendDocProperty(p3_Checked_OtherNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[4].Paragraphs[0].AppendDocProperty(p3_Checked_TotalNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[5].Paragraphs[0].AppendDocProperty(p3_Checked_MaleRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[6].Paragraphs[0].AppendDocProperty(p3_Checked_FemaleRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[7].Paragraphs[0].AppendDocProperty(p3_Checked_MaleExamineRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[8].Paragraphs[0].AppendDocProperty(p3_Checked_FemaleExamineRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row3.Cells[9].Paragraphs[0].AppendDocProperty(p3_Checked_AverageExamineRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
Row p3Row4 = p3rowsContent[4];
p3Row4.Cells[0].Paragraphs[0].Append("未检").Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[1].Paragraphs[0].AppendDocProperty(p3_UnCheck_MaleNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[2].Paragraphs[0].AppendDocProperty(p3_UnCheck_FemaleNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[3].Paragraphs[0].AppendDocProperty(p3_UnCheck_OtherNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[4].Paragraphs[0].AppendDocProperty(p3_UnCheck_TotalNumber).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[5].Paragraphs[0].AppendDocProperty(p3_UnCheck_MaleRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[6].Paragraphs[0].AppendDocProperty(p3_UnCheck_FemaleRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[7].Paragraphs[0].AppendDocProperty(p3_UnCheck_MaleExamineRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[8].Paragraphs[0].AppendDocProperty(p3_UnCheck_FemaleExamineRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
p3Row4.Cells[9].Paragraphs[0].AppendDocProperty(p3_UnCheck_AverageExamineRatio).Font(f).FontSize(10.5).Alignment = Alignment.center;
var p3Content = document.InsertParagraph();
p3Content.InsertTableAfterSelf(p3Contenttable);
document.InsertParagraph("参检百分比:").Font(f).FontSize(14).Alignment = Alignment.left;
document.InsertParagraph().Alignment = Alignment.center;
//var p3Chat1 = document.AddChart();
//p3Chat1.AddLegend(ChartLegendPosition.Right, true);
//var p3ChatData1 = ChartData.CreateReferenceRate();
//// 创建饼图并绑定数据
//var p3Chats1 = new Series("参检率");
//p3Chats1.Bind(p3ChatData1, "Category", "Expenses");
//p3Chat1.AddSeries(p3Chats1);
//document.InsertChart(p3Chat1, 200f, 150f);
//document.Paragraphs[document.Paragraphs.Count - 1].Alignment = Alignment.center;
document.InsertParagraph("参检性别百分比:").Font(f).FontSize(14).Alignment = Alignment.left;
document.InsertParagraph().Alignment = Alignment.center;
//var p3Chat2 = document.AddChart();
//p3Chat2.AddLegend(ChartLegendPosition.Right, true);
//var p3ChatData2 = ChartData.CreateReferenceRateSex();
//// 创建饼图并绑定数据
//var p3Chats2 = new Series("参检性别百分比");
//p3Chats2.Bind(p3ChatData2, "Category", "Expenses");
//p3Chat2.AddSeries(p3Chats2);
//document.InsertChart(p3Chat2, 200f, 150f);
//document.Paragraphs[document.Paragraphs.Count - 1].Alignment = Alignment.center;
//var p3Paragraphs1 = document.Paragraphs.Where(p => p.Text.Equals("参检百分比:")).FirstOrDefault();
//第四页
document.Paragraphs[document.Paragraphs.Count - 1].InsertPageBreakAfterSelf();
document.InsertParagraph(@"二、体检项目与体检项目的参检情况").Font(f).FontSize(16);
Table p4Contenttable = document.AddTable(3, 11);
p4Contenttable.Design = TableDesign.TableGrid;
List p4rowsContent = p4Contenttable.Rows;
p4Contenttable.SetColumnWidth(0, 55f);
p4Contenttable.SetColumnWidth(1, 85f);
Row p4Row0 = p4rowsContent[0];
p4Row0.MergeCells(0, 1);
p4Row0.Cells[0].Paragraphs[0].Append("体检项目").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row0.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p4Row0.MergeCells(1, 3);
p4Row0.Cells[1].Paragraphs[0].Append("该项参检人数").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row0.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p4Row0.MergeCells(2, 4);
p4Row0.Cells[2].Paragraphs[0].Append("总体参检人数").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row0.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p4Row0.MergeCells(3, 5);
p4Row0.Cells[3].Paragraphs[0].Append("该项参检百分比").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row0.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
Row p4Row1 = p4rowsContent[1];
p4Row1.Cells[0].Paragraphs[0].Append("检查科室").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[1].Paragraphs[0].Append("项目名称").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[2].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[3].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[4].Paragraphs[0].Append("合计").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[4].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[5].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[5].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[6].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[6].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[7].Paragraphs[0].Append("合计").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[7].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[8].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[8].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[9].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[9].FillColor = Color.FromArgb(209, 245, 203);
p4Row1.Cells[10].Paragraphs[0].Append("合计").Font(f).FontSize(10.5).Alignment = Alignment.center;
p4Row1.Cells[10].FillColor = Color.FromArgb(209, 245, 203);
var p4Content = document.InsertParagraph();
p4Content.InsertTableAfterSelf(p4Contenttable);
//第五页
document.InsertParagraph().InsertPageBreakAfterSelf();
document.InsertParagraph(@"三、全体员工体检结果汇总").Font(f).FontSize(16);
var p5Content = document.InsertParagraph(@"个人隐私请保密,仅供贵单位领导参阅").Font(f).FontSize(10.5);
Table p5Contenttable = document.AddTable(2, 5);
p5Contenttable.Design = TableDesign.TableGrid;
p5Contenttable.SetColumnWidth(0, 110f);
p5Contenttable.SetColumnWidth(1, 75f);
p5Contenttable.SetColumnWidth(2, 35f);
p5Contenttable.SetColumnWidth(3, 45f);
p5Contenttable.SetColumnWidth(4, document.PageWidth - document.MarginLeft - document.MarginRight - 265f);
List p5rowsContent = p5Contenttable.Rows;
Row p5Row0 = p5rowsContent[0];
p5Row0.Cells[0].Paragraphs[0].Append("档案号").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Row0.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p5Row0.Cells[1].Paragraphs[0].Append("姓名").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Row0.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p5Row0.Cells[2].Paragraphs[0].Append("性别").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Row0.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p5Row0.Cells[3].Paragraphs[0].Append("年龄").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Row0.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
p5Row0.Cells[4].Paragraphs[0].Append("体检结果").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Row0.Cells[4].FillColor = Color.FromArgb(209, 245, 203);
p5Content.InsertTableAfterSelf(p5Contenttable);
document.InsertParagraph("(注: 敬请保护个人隐私, 本档案仅供贵单位负责职工健康体检的人员查阅! 未经员工本人同意, 不得外泄资料, 否则, 造成不良影响由贵单位承担, 与本中心无关!)").Font(f).FontSize(10.5);
document.InsertParagraph();
document.InsertParagraph(@"四、本次体检异常结果检出统计").Font(f).FontSize(16);
var p5Content1 = document.InsertParagraph(@"贵单位此次在我中心进行员工体检,内容包括[登记组合项目][实检组合项目],现将检出的按男女综合检出数量最高的部分异常情况进行统计分析,以反映出员工的健康状况。").Font(f).FontSize(10.5);
Table p5Contenttable2 = document.AddTable(3, 8);
p5Contenttable2.Design = TableDesign.TableGrid;
p5Contenttable2.SetColumnWidth(0, 95f);
p5Contenttable2.SetColumnWidth(1, 130f);
p5Contenttable2.SetColumnWidth(2, 40f);
p5Contenttable2.SetColumnWidth(3, 40f);
p5Contenttable2.SetColumnWidth(4, 40f);
p5Contenttable2.SetColumnWidth(5, 40f);
p5Contenttable2.SetColumnWidth(6, 40f);
p5Contenttable2.SetColumnWidth(7, 40f);
List p5rowsContent2 = p5Contenttable2.Rows;
Row p5Table2Row0 = p5rowsContent2[0];
p5Table2Row0.MergeCells(0, 1);
p5Table2Row0.Cells[0].Paragraphs[0].Append("体检结论").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row0.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row0.MergeCells(1, 3);
p5Table2Row0.Cells[1].Paragraphs[0].Append("人数").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row0.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row0.MergeCells(2, 4);
p5Table2Row0.Cells[2].Paragraphs[0].Append("百分比").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row0.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
Row p5Table2Row1 = p5rowsContent2[1];
p5Table2Row1.Cells[0].Paragraphs[0].Append("结论").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[1].Paragraphs[0].Append("人员名单").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[2].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[3].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[4].Paragraphs[0].Append("合计").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[4].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[5].Paragraphs[0].Append("男性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[5].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[6].Paragraphs[0].Append("女性").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[6].FillColor = Color.FromArgb(209, 245, 203);
p5Table2Row1.Cells[7].Paragraphs[0].Append("平均").Font(f).FontSize(10.5).Alignment = Alignment.center;
p5Table2Row1.Cells[7].FillColor = Color.FromArgb(209, 245, 203);
p5Content1.InsertTableAfterSelf(p5Contenttable2);
//第六页
document.InsertParagraph().InsertPageBreakAfterSelf();
document.InsertParagraph(@"前十大异常结果柱状图:").Font(f).FontSize(16);
document.InsertParagraph().Alignment = Alignment.center;
//var p6Chat1 = document.AddChart();
//p6Chat1.AddLegend(ChartLegendPosition.Right, false);
//p6Chat1.BarDirection = BarDirection.Column;//指示柱状图是横向的还是纵向的:Column纵向,Bar横向
//p6Chat1.BarGrouping = BarGrouping.Stacked;//这个不好解释,一个4个枚举值,你一一试一遍就知道了
//p6Chat1.GapWidth = 200;//柱状图表的宽度
//p6Chat1.GapWidth = 200;
//var usa = ChartData.CreateDisease();
//var p6Chats1 = new Series("疾病人数");
//p6Chats1.Color = Color.FromArgb(79, 129, 189);
//p6Chats1.Bind(usa, "Category", "Expenses");
//p6Chat1.AddSeries(p6Chats1);
//document.InsertChart(p6Chat1);
document.InsertParagraph();
document.InsertParagraph(@"前十大异常结果饼图:").Font(f).FontSize(16);
document.InsertParagraph().Alignment = Alignment.center;
//var p6Chat2 = document.AddChart();
//p6Chat2.AddLegend(ChartLegendPosition.Right, true);
//var p6ChatData2 = ChartData.CreateException();
//// 创建饼图并绑定数据
//var p6Chats2 = new Series("疾病人数百分比");
//p6Chats2.Bind(p6ChatData2, "Category", "Expenses");
//p6Chat2.AddSeries(p6Chats2);
//document.InsertChart(p6Chat2);
//第七页
document.InsertParagraph().InsertPageBreakAfterSelf();
document.InsertParagraph(@"该部分针对贵单位员工在我中心体检时,所检出的各种异常情况提供相关的分析与医疗保健建议").Font(f).FontSize(10.5);
var p7Content = document.InsertParagraph(@"五、本次体检前十大异常结果分析").Font(f).FontSize(16);
Table p7Contenttable = document.AddTable(2, 2);
p7Contenttable.Design = TableDesign.TableGrid;
p7Contenttable.SetColumnWidth(0, 130f);
p7Contenttable.SetColumnWidth(1, document.PageWidth - document.MarginLeft - document.MarginRight - 130f);
List p7rowsContent = p7Contenttable.Rows;
Row p7TableRow0 = p7rowsContent[0];
p7TableRow0.Cells[0].Paragraphs[0].Append("疾病").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7TableRow0.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p7TableRow0.Cells[1].Paragraphs[0].Append("建议").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7TableRow0.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p7Content.InsertTableAfterSelf(p7Contenttable);
document.InsertParagraph();
var p7Content1 = document.InsertParagraph(@"六、体检者未完成情况").Font(f).FontSize(16);
Table p7Contenttable1 = document.AddTable(2, 5);
p7Contenttable1.Design = TableDesign.TableGrid;
p7Contenttable1.SetColumnWidth(0, 110f);
p7Contenttable1.SetColumnWidth(1, 95f);
p7Contenttable1.SetColumnWidth(2, 45f);
p7Contenttable1.SetColumnWidth(3, 45f);
p7Contenttable1.SetColumnWidth(4, document.PageWidth - document.MarginLeft - document.MarginRight - 295f);
List p7rowsContent1 = p7Contenttable1.Rows;
Row p7Table2Row0 = p7rowsContent1[0];
p7Table2Row0.Cells[0].Paragraphs[0].Append("体检号").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7Table2Row0.Cells[0].FillColor = Color.FromArgb(209, 245, 203);
p7Table2Row0.Cells[1].Paragraphs[0].Append("姓名").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7Table2Row0.Cells[1].FillColor = Color.FromArgb(209, 245, 203);
p7Table2Row0.Cells[2].Paragraphs[0].Append("性别").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7Table2Row0.Cells[2].FillColor = Color.FromArgb(209, 245, 203);
p7Table2Row0.Cells[3].Paragraphs[0].Append("年龄").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7Table2Row0.Cells[3].FillColor = Color.FromArgb(209, 245, 203);
p7Table2Row0.Cells[4].Paragraphs[0].Append("部门").Font(f).FontSize(10.5).Alignment = Alignment.center;
p7Table2Row0.Cells[4].FillColor = Color.FromArgb(209, 245, 203);
p7Content1.InsertTableAfterSelf(p7Contenttable1);
/*
var numberedList = document.AddList("First List Item.", 0, ListItemType.Numbered);
//Add a numbered list starting at 2
document.AddListItem(numberedList, "Second List Item.");
document.AddListItem(numberedList, "Third list item.");
document.AddListItem(numberedList, "First sub list item", 1);
document.AddListItem(numberedList, "Nested item.", 3);
document.AddListItem(numberedList, "Fourth nested item.");
var bulletedList = document.AddList("First Bulleted Item.", 0, ListItemType.Bulleted);
document.AddListItem(bulletedList, "Second bullet item");
document.AddListItem(bulletedList, "Sub bullet item", 1);
document.AddListItem(bulletedList, "Second sub bullet item", 2);
document.AddListItem(bulletedList, "Third bullet item");
document.InsertList(numberedList);
document.InsertList(bulletedList);
*/
document.InsertParagraph();
document.InsertParagraph(@"七、常见体检异常结果分析及健康指导").Font(f).FontSize(16).SpacingAfter(10d).SetLineSpacing(LineSpacingType.Line, 13.8f);
document.InsertParagraph(@"◆ 颈椎疾病健康指导").Font(f).FontSize(14).SpacingAfter(10d).SetLineSpacing(LineSpacingType.Line, 13.8f);
document.InsertParagraph(@"【健康指导】").Font(f).FontSize(14).SpacingAfter(10d).SetLineSpacing(LineSpacingType.Line, 13.8f);
int index = document.Paragraphs.Count;
Formatting p7Formatting = new Formatting();
p7Formatting.FontFamily = new Xceed.Document.NET.Font("宋体");
p7Formatting.Size = 14;
var numberedList = document.AddList("颈椎病是指由于各种原因所致的颈椎结构的改变,如椎间盘的变性、突出,颈椎体边缘骨质增生,黄韧带肥厚、钙化或后纵韧带钙化,颈椎曲度异 常、椎间不稳等,直接压迫、刺激或通过压迫影响血液循环,使脊髓颈段、神经根、椎动脉或交感神经的功能损害,进而 发生组织结构损害,出现一系列临床征象,又有颈椎综合征之称。概括起来就是颈椎的椎间盘突出、骨质增生等压迫颈椎周围的神经、血管等导致的各种不适表现。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList, "哪些人易患颈椎病,从事文字、电脑工作人员及学生最易患颈椎病。颈椎病的发病,年青人主要是外因,即姿势式疲劳和损伤,主要以姿势 疲劳为主。长时间同一姿势伏案工作,颈肩部的肌肉一 下处于紧张强下状态,血液循环不畅,极易导致颈椎肌肉劳损。中学生的书包越来越重,导致姿势不适合人体正常的生理弯曲,久而久之易患颈椎病;喜欢玩电脑、打游戏机的中学生也因长时间颈部保持一个姿势而导致颈部肌肉痉挛、劳损而发生颈椎病;对于中老年人来说,颈椎病则是身体的退行性病变的表现。\n\t 家庭康复治疗法:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "如果不幸得颈椎病也不要紧张,应该及时就医。俗话说“三分治疗七分养”, 养即保养、康复预防之意。对于颈椎病,不要寄托在医院检查一下,吃些药就可以痊愈,该病本身就是一个退变性且极易复发的疾病。不注意疗效的巩固,很快可以再发作,所以应加倍注意。家庭的治疗如下。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "在急性期最好能够少活动。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "家里可以做自我牵引,如购买牵引带,一般情况下取 4~6 千克重 量,20~30 分钟/次,1~2 次/天或再多一点。牵引治疗 2~3 天,颈部肌肉紧张多可得至缓解,疼痛减轻。 或自己双手托住头部做向上拨伸的动作,效果一 样。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "头项部可以外敷中药膏药,必要时可以用中药水热敷,可以疏筋活络, 缓解疼痛, 口服消炎止痛药如扶他林、芬必得等。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "同时可以配合理疗,如微波红外线、针炙等。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "急性期疼痛明显,影响日常工作、生活甚至整夜难眠者,针剌或神经根封闭,不失 为 一种有效的治疗方法,但应选择正规专业医师操作,以免发生意外。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "日常防范方法:“防患于末然”对任何疾病都是适合的,不管有没有出现颈椎病的症状,改变不良工作生活习惯都非常重要,千万别委屈了你的脖子。 别委屈脖子对于经常低头工作的办公室工作人员,正确的姿势是关键,首先在坐姿上尽可能保持 自然的端坐位,头部略微前倾,保持头、颈、胸的正常生理曲 线,切不可头部过度前屈、身体前趴。对于长期伏案工作者,应每隔1小时左右,让颈部向左右转动数次,转动时应轻柔、缓慢,以达到该方向的最大运动范围为准;生活习惯低枕位休息,维持正常颈曲。选择适合自己的卧具,以晨起头颈无不适为度;改正躺在床上或沙发上,用垫子或枕头抬高头部看电视、看书的不良习 惯。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
numberedList = document.AddListItem(numberedList, "避免有害的活动 对长时间下象棋、打麻将者,奉劝还是少一些“娱乐”,多一些运动,因此种“娱乐”逐渐导致颈椎病的非常多见。 颈椎保健操要防止颈椎病的发生,除了要纠正不良姿势,注意防潮、防冷外,还应积极加强锻炼, 经常活动颈部,多做伸颈运动。办公室人员没时间锻炼,最 简单的锻炼可以以颈部为笔,头部为笔尖,反复写“米”字。这种伸颈运动可以改善颈部肌肉韧带的供血,使血液循环加 快,使肌肉韧带更加强壮,预防骨质疏松,从而减少颈 椎病的发生。", 3, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList);
document.InsertParagraph(@"◆ 代谢性疾病健康指导").Font(f).FontSize(16);
document.InsertParagraph(@" 代谢性疾病主要为生活方式病,包括超重、肥胖、血糖偏高、血压偏高、高血脂、脂 肪肝、高尿酸等。").Font(f).FontSize(14);
document.InsertParagraph(@"【高血脂】").Font(f).FontSize(14);
document.InsertParagraph(@" 形成原因:膳食结构不合理,食物中胆固醇和饱和脂肪酸摄入过多,总热量过高, 应酬较多;体力活动过少;就个体而言与遗传基因有关。因此防治高血脂和肥胖对减少 冠心病、脑卒中,糖尿病、脂肪肝、胆结石的患病率和心脑血管意外有重要意义。").Font(f).FontSize(14);
document.InsertParagraph(@" 预防建议:").Font(f).FontSize(14);
var numberedList1 = document.AddList("用低脂、低热、低糖饮食、限制动物性脂肪、肥肉、禽类皮、动物内脏、浓肉汤、鱿鱼、墨斗鱼、鱼籽和蟹黄,少吃蛋黄,甜食,多吃蔬菜、水果和富含纤维素食物,提倡吃八分饱;", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList1, "持之以恒,坚持有氧运动,有氧运动有利于降低血脂,减肥, 降血压,预防糖尿病和减少血栓形成。有氧运动以运动后心率达到最大心率的 50~70% 为宜(最大心率=220-年龄)。运动方式可选择:快走、慢跑、骑车、爬楼梯和游泳等各 种可坚持的运动,每周不少于五天,每天不少于 20-40 分钟。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList1);
document.InsertParagraph(@"【超重或肥胖】").Font(f).FontSize(14);
var numberedList2 = document.AddList("概念:体重超重或肥胖是指体内脂肪积聚过多和(或)分布异常、体重增加,是由于遗 传或环境因素共同作用的结果。1999年,世界卫生组织已正式宣布肥胖为一种疾病。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "危害:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "寿命缩短:男性肥胖者的死亡率是正常人的1.5倍,女性是1.47倍。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "危害心理健康:影响美观、生活不便,会产生自卑、焦虑和抑郁等问题。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "诱发疾病:肥胖是导致2型糖尿病、心血管疾病、高血压、胆结石和癌症、内分泌、 代谢紊乱的重要危险因素。也可以引起关节痛、浮肿、活动耐力降低等。此外,肥胖还易使皮肤脆性增加,易发生皮炎、摩擦伤、并容易合并化脓性或真菌感染。 肥胖严重威胁健康,医学界称肥胖、高血压、高血脂和高血糖为“死亡四重奏”。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "原因(发病危险因素):\r\tA、遗传因素:家族史。 B、不良生活方式:偏爱高脂肪、高热量饮食,睡前或夜间用餐,体力活动少等。 C、年龄因素:男性中年以后,女性绝经期后生理功能减退,代谢减低,体力活动减少,而饮食摄入量未相应减少,造成摄入量超过消耗量而致肥胖。 D、精神因素:精神过度紧张及心理障碍,可引起食欲亢进,导致肥胖。 E、其他因素:药物、疾病等引起。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "症状与表现: A、男性肥胖多表现为“苹果型”肥胖,即内脏型或向心型肥胖脂肪沉积在腹部、臀部和背部;女性肥胖多表现为“梨型”肥胖,脂肪主要沉积在臀部、大腿。 B、中度以上肥胖者可出现活动后心悸、气短、嗜睡等症状。重度肥胖者可出现呼吸困难、浮肿、发绀、阵发性睡眠呼吸暂停综合症等。 C、合并高血压、糖尿病、血脂异常、痛风者可出现相应症状。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "防治: 非药物治疗", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "认识肥胖症的危害;认识到单纯性肥胖是一种生活方式疾病;认识治疗肥胖症是一个自我控制的过程。改变生活方式,矫正饮食、行为习惯。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "控制摄入量,低脂、低热量、低嘌呤、低盐饮食,戒烟限酒。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList2, "运动治疗,增加体力活动,加强锻炼。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList2);
document.InsertParagraph(@"【血糖偏高】").Font(f).FontSize(14);
var numberedList3 = document.AddList("糖尿病诊断标准:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "症状+随机血糖≥11.1mmol/L;", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "空腹血糖(FPG)≥7.0mmol/L(非同日两次空腹血糖);", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "糖耐量试验(OGTT)中2小时血浆葡萄糖(2HPG)≥11.1mmol/L。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "血糖增高预防建议:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "普及糖尿病知识,充分认识糖尿病正在我国已进入多数的严重形势和预防方法。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "合理膳食避免营养过剩,提倡用低脂,少糖,富含纤维的膳食;C 坚持有氧运动。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "避免使用影响糖代谢的药物。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "定期复查血糖。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "年龄大于40岁,有糖尿病家族史,血糖或尿糖曾经异常者,应查餐后两小时血糖。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "糖尿病综合治疗原则:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "糖尿病教育。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "合理的饮食治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "坚持运动治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "正规的 药物治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList3, "定期病情监测。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList3);
document.InsertParagraph(@"【高血压】").Font(f).FontSize(14);
var numberedList4 = document.AddList("诊断标准:1999 年 10 月中国高血压联盟推荐新高血压诊断标准,未服降压药的情况下:收缩压≥140mmHg 和(或)舒张压≥90mmHg,即诊断高血压。以非同日多次(二次或 以上)复测平均值为依据,偶然一次不能诊断高血压。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "危害:患了高血压病,如果不加以控制,可导致脑卒中或冠心病等,将严重影响生 活质量,甚至威胁到生命。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "高血压病存在患病率高、致残率高、死亡率高,知晓率低、治疗率低、控制率低的 现象,也就是人们通常所说的“三高”、“三低”。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "病因或发病危险因素:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "体重超重或肥胖:体重超重和体重增加过快,是高血压病的危险因素。尤其内脏型肥胖,同时也是糖尿病和血脂异常的危险因素。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "饮酒:长期饮白酒达 50ml/每天以上,也是高血压病发病的危险因素;少量饮些红 葡萄酒可有预防冠心病的作用。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "长期高盐、低镁、低钙、低动物蛋白质饮食;膳食钠盐的摄入量与血压水平有显著 的相关性。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "长期精神紧张或超负荷工作,也是高血压病的危险因素。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "高血压的防治:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "增强自我保健意识,学会自我保健知识。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "定期监测:35岁以上人群至少每年要检查一次血压,以利早期发现血压增高,降低 人群高血压的发病率和患病率。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "预防超重和肥胖,保持理想体重,其中饮食(低盐、高钾、高钙、高动物蛋白质饮 食如奶类、动制品、鱼类、菜果类)、运动疗法(保持规律有氧运动非常重要),运动降压效 果最直接。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList4, "讲究精神卫生;E、不吸烟;F、药物治疗原则。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList4);
document.InsertParagraph(@"【脂肪肝】").Font(f).FontSize(14);
var numberedList5 = document.AddList("病因:目前我国脂肪肝发病率有增高趋势,多数与肥胖、高脂血症(以甘油三脂增 高关系更密切)、糖尿病、肝炎病史及嗜酒有关。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList5, "建议:脂肪肝可双向发展,有效控制或消除上述促发因素,脂肪肝可明改善,因此建议: A 用低脂膳食,治疗高血脂症;B 坚持有氧运动,控制体重; C 限酒; D 避免对肝脏有害的药物; E 药物治疗:目前尚无明显有效治疗脂肪肝的药物,若肝 功能明显异常可选用保肝药物。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList5);
document.InsertParagraph(@"【高尿酸】").Font(f).FontSize(14);
var numberedList6 = document.AddList("何谓高尿酸血症:\r\t嘌呤代谢物为尿酸,男性每 100 毫升血液中尿酸值在 8.7 毫克以上,女性 8 毫克以 上时,则称为高尿酸血症。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "建议:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "每天至少 2000mI 液体,多摄取低嘌呤、碱性食物,例如蔬菜。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "避免高嘌呤食物。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "避免喝酒、油炸食物。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "避免摄取肉汤或高汤。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "食欲不佳时,须注意补充含糖液体,以避免身体组织快速分解,诱发痛风。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "避免暴饮暴食。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "避免饥饿,因为肌肉被分解,致尿酸排出。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "避免使用阿司匹林类药物,以免妨碍尿酸排出。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "急性期:应去医院看病,选择药物治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "缓解期:促进身体活动,应酌量选择(表二)食物,平时可多选择表一食物,少用高嘌 呤食物(表三)。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "维持理想体重:理想体重(公斤)=22×身高 2 (平方公尺)。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList6, "痛风石的部位应注意保护皮肤,维持完整性。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList6);
document.InsertParagraph(@"◆ 眼科疾病").Font(f).FontSize(14);
var numberedList7 = document.AddList("眼病体检的目的:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "及早发现眼病隐患:如青光眼、糖尿病视网膜病变。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "眼病咨询:如白内障是否需手术?视力不好是否需配镜?", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "对全身健康状况评估,眼底是全身情况的缩印,高血压、高血糖、高血脂造成器官损害之前,在眼底会有所表现。我们在眼病筛查中对每一个受检者都进行了解释。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "建议:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "结膜炎,请注意用眼卫生,如症状明显,可局部 治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "眼底杯盘比,建议到专科医院,测眼压,查视 野等。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "视网膜动脉硬化,建议低盐、清淡饮食,并请关注 血压、血脂、血糖及动脉硬化的防治。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "青光眼或可疑青光眼,需到医院青光眼专科复查。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "白内障需,考虑手术治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "糖尿病性视网膜病变,Ⅲ期以下者需要控制血糖并每半年或一年观察眼底,Ⅲ 期及以上者应尽快到医院就诊。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "视网膜病变,需要监测血压和血糖情况并做相应治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "黄斑病变,视力小于 0.3 时到医院就诊(陈旧性者不必复诊)。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "视网膜血管病变,监测血压和血糖情况做相应处理,非陈旧性者需医院就诊。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList7, "视神经病变(萎缩/缺血性),需要检测血压血糖,每年随诊观察。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList7);
document.InsertParagraph(@"◆ 耳鼻喉疾病").Font(f).FontSize(14);
var numberedList8 = document.AddList("过敏性鼻炎:建议查找过敏原,并避免与其接触,必要时专科治疗,平时注意加强锻炼, 增强机体免疫力,预防感冒。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList8, "慢性咽炎:若症状明显,请专科治疗,平时少吃辛辣食物,少作长谈,避免有害气体及 粉尘的刺激。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList8, "慢性鼻炎:请专科治疗,平时注意增强体质,提高机体抵抗力,预防感冒,祛除诱因。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList8, "慢性扁桃体炎:请注意锻炼身体,增强体质,防止感冒,如反复发作请专科进一步治疗。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList8);
document.InsertParagraph(@"◆ 肝胆疾病").Font(f).FontSize(14);
document.InsertParagraph(@"【肝功异常】").Font(f).FontSize(14);
document.InsertParagraph(@"转氨酶除在肝脏外,还可分布在心、肾、骨骼肌、胰等组织中,当这些组织有病时, 也会引起血清转氨酶活性升高。如心肌炎、急性心肌梗塞时,血清转氨酶活性均会升高,除此之外,如胆石症、甲状腺机能亢进、伤寒、疟疾、感冒、大量服用阿斯匹林等,都可使血 清转氨酶升高,甚至在某些生理条件下如剧烈运动等,也会使转氨酶升高。").Font(f).FontSize(14);
document.InsertParagraph(@"因此我们绝对不能一看到转氨酶升高就诊断为肝炎,而必须结合病人具体情况如症状 体征及其他检查综合分析,做出诊断,应注意以下几个问题:").Font(f).FontSize(14);
var numberedList9 = document.AddList("血清转氨酶升高,仍以病毒性肝炎最为常见,而且转氨酶升高的幅度大(在正常值4 倍以上),且持续时间很长(大于 1 个月)。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList9, "肝病时,转氨酶升高,只表示肝细胞受损,不能区别肝病的性质。如病毒性肝炎、 药物性肝炎等,都能使转氨酶升高。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList9, "在临床上如发现转氨酶(特别是 ALT)下降,而胆红素反升高,往往说明病人病情严重,预后不良。如急性或亚急性重症肝炎。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList9, "某些慢性肝炎或肝炎恢复期,转氨酶可以正常。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList9, "总之,不能单靠转氨酶来诊断或否定肝炎,必须结合其他化验结果和临床表现进行全方面分析,方能诊断。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList9);
document.InsertParagraph(@"【肝囊肿、肝血管瘤】").Font(f).FontSize(14);
document.InsertParagraph(@"应该定期复查,动态观察变化,必要专科时治疗,平时注意不要受外力撞击,以免破裂").Font(f).FontSize(14);
document.InsertParagraph(@"【胆囊结石】").Font(f).FontSize(14);
var numberedList10 = document.AddList("预防肠道寄生虫和细菌感染;", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "饮食控制,少吃动物内脏鱼籽,蛋黄等高胆固醇膳食,增加膳食中纤维素含量。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "控制体重;", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "纠正久坐少动的生活习惯。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "治疗:无并发症的胆结石,可根据个体情况选择;", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "利胆排石综合治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "药物溶石。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "体外碎石。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "内窥镜取石。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "腹腔镜手术。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList10, "外科胆囊切除术等治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList10);
document.InsertParagraph(@"【胆囊息肉】").Font(f).FontSize(14);
document.InsertParagraph(@"胆囊息肉主要由慢性炎症引起,如息肉进一步增大,和/或合并胆囊多发结石,考虑手术治 疗;一般情况定期复查。").Font(f).FontSize(14);
document.InsertParagraph(@"◆ 心血管疾病").Font(f).FontSize(14);
var numberedList11 = document.AddList("T 波、ST-T 改变引起 T 波、ST-T 段改变的原因很多,需结合有关临床资料,综合分析做出诊断。有冠心病危险因素的人(A、有冠心病家庭史;B、高胆固醇血症;C、高血 压;D、糖尿病;E 吸烟;F 肥胖)近期出现上述心电图改变,与心肌缺血有关,可疑者需 专科医院进一步检查。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "完全性右束支传导阻滞 可见于有器质性心脏病(冠心病、高血压性心脏病)者,偶 见于正常人。应注意复查心电图,有症状及时专科诊治。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "房室传导阻滞:是比较常见的心律失常,在正常人群中的检出率约为 2%-5%,在器质 性心脏病患者中约占 20%-30%。它是心脏传导阻滞中最常见,也是很重要的一种。应注意 复查心电图,有症状及时专科诊治。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "心脏早搏:无心脏病背景者,多为生理性原因,可半年复查;如频发早搏,请及时就 医;有心脏病者伴有早搏,建议专科治疗。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "房颤:是一种十分常见的心律失常。据统计,60 岁以上人群中,房颤发生率 1%,并 随年龄而增加。有症状请专科就诊。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "由于人们饮食习惯、生活习惯的改变,造成高脂血症患者增加, 若血脂质过高不加以 控制,再加上高血压、抽烟等因素的影响,使脂质沉淀物沉积在血管壁上,越积越厚,以致 血管管腔狭小,血流不通,使组织缺氧与营养缺乏, 这种情形发生在心脏冠状动脉时,首 先,引起心绞痛。若不积极治疗最后会造成心肌梗塞。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "所以一旦出了问题应及早治疗並纠正不良饮食习惯,防止病情恶化,即使进行药物治 疗或医疗手术改善病情,仍然要配合饮食控制才能减少再复发的机会。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "心血管疾病饮食原则:", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "维持理想体重。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "控制脂质总摄入量。烹调时应注意用油量,宜多采用清蒸、 水煮、凉拌、燉、滷 等方式,禁用油炸的烹调方式,並少吃肥肉、鸡皮等油脂含量高的食物。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "炒菜用油宜选用单元不饱和脂肪酸高者(如:橄榄油、菜籽 油、花生油);少用 饱和脂肪酸高者(如:猪油)。少吃胆固醇含量高的食物,如内脏类、蝦卵、鱼卵等,蛋可以吃但每周不超过二 到三个蛋黄为原则。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "避免富含精制糖的食物(如蛋糕、甜食)。(见附表:富含 精制糖的食物)。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "攝取富含 W-3 脂肪酸的鱼类(秋刀鱼、鲑鱼、鳗鱼等)。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "减少钠量攝取。罐头、醃制食品及各种加工食品含钠量高, 应忌食。宜选择新鲜 食物自行制作,烹调时减少食盐的用量,其它含钠量高的调味品(味精、酱油、乌醋等)应 减少或避免使用。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "多摄取含纤维质的食物(全穀类、蔬菜类、水果)。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "避免烟、酒、含咖啡因饮料及其他刺激性食品。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList11, "有服用抗凝血剂的病患,要减少含维生素 K 多的食物,如绿色蔬菜(菠菜、甘蓝菜、萵苣、绿花椰菜)、肝脏。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList11);
document.InsertParagraph(@"◆ 肾脏疾病").Font(f).FontSize(14);
var numberedList12 = document.AddList("肾结石\n建议平时多饮水,少吃高草酸食物,可做蹦跳运动,避免感染,请定期复查,必要时排石治疗。", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList12, "肾囊肿", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList12, "请定期复查,观察变化,若有症状专科治疗。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList12, "肾功能异常:建议控制膳食中蛋白质比例,近期复查,必要时专科诊治。如有肾脏病史,请及时肾内科诊治。", 1, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList12, "肾错构瘤\n属良性肿瘤,请定期复查,如有症状专科治疗", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.AddListItem(numberedList12, "肾萎缩、肾盂增大\n建议专科进一步诊治", 0, ListItemType.Numbered, null, false, false, p7Formatting);
document.InsertList(numberedList12);
for (int i = index; i < document.Paragraphs.Count; i++)
{
document.Paragraphs[i].SpacingAfter(10d).SetLineSpacing(LineSpacingType.Line, 13.8f);
///document.Paragraphs[i].Alignment = Alignment.both;
}
//结束语页
document.InsertParagraph().InsertPageBreakAfterSelf();
document.InsertParagraph(@"结束语").Font(f).FontSize(14).Bold(true);
document.InsertParagraph();
document.InsertParagraph(@"影响健康的因素很多,包括遗传基因、日常生活习惯、社会环境、医疗资源等等,其中,与一般民众息息相关的医疗资源,仅占影响健康因素的10%,最大的影响因素还是日常生活习惯及社会环境。根据世界卫生组织(WHO)的估计,75%的癌症是已知的环境因素所引起,而这些因素都是可以预防的,例如抽烟、酗酒。").Font(f).FontSize(10.5).IndentationFirstLine = 32.0f;
document.InsertParagraph();
document.InsertParagraph(@"世界卫生组织(WHO)指出:“二十一世纪的医学不应该继续以疾病为主要研究对象,而应该以人类健康作为医学研究的主要方向。” 这个精神旨在宣告预防医学和健康保健将成为医学的主导。").Font(f).FontSize(10.5).IndentationFirstLine = 32f;
document.InsertParagraph();
document.InsertParagraph(@"我中心愿以卓越的服务、优质的技术继续为贵单位提供医疗保健服务,从体检中发现健康问题,从保健中解决健康问题。").Font(f).FontSize(10.5).IndentationFirstLine = 32f;
document.InsertParagraph();
document.InsertParagraph(@"最后,感谢您对国宾的支持,别忘了定期为员工安排健康检查。您的任何意见,都是我们成长的来源!敬请不吝指教。").Font(f).FontSize(10.5).IndentationFirstLine = 32f;
document.InsertParagraph().InsertPageBreakAfterSelf();
//检后服务
Xceed.Document.NET.Font f1 = new Xceed.Document.NET.Font("黑体");
Xceed.Document.NET.Font f2 = new Xceed.Document.NET.Font("楷体");
Formatting pBottomFirstFormatting = new Formatting();
pBottomFirstFormatting.FontFamily = new Xceed.Document.NET.Font("黑体");
pBottomFirstFormatting.Size = 14;
Formatting pBottomLastFormatting = new Formatting();
pBottomLastFormatting.FontFamily = new Xceed.Document.NET.Font("黑体");
pBottomLastFormatting.Size = 10.5;
document.InsertParagraph(@"检后服务").Font(f1).FontSize(18);
document.InsertParagraph(@"健康体检后,您需要健康维护和管理:").Font(f1).FontSize(10.5);
var svr1 = document.InsertParagraph().Font(f1).FontSize(10.5);
svr1.InsertText("1.", false, pBottomLastFormatting);
svr1.InsertText("检后就诊", false, pBottomFirstFormatting);
svr1.InsertText("--体检中发现的疾病由国内著名、省内著名的专家为您对接就诊,真正起到早发现、早诊断、早治疗。", false, pBottomLastFormatting);
var svr2 = document.InsertParagraph().Font(f1).FontSize(10.5);
svr2.InsertText("2.", false, pBottomLastFormatting);
svr2.InsertText("常见病、疑难病预约就诊服务", false, pBottomFirstFormatting);
svr2.InsertText("--请拨打健康服务热线。我们可以帮您用最短的时间预约上最合适您病情的专家,他们为国内著名、省内著名的专家在您需要时我们还可以通过绿色通道帮您预约外省外院著名专家。", false, pBottomLastFormatting);
document.InsertParagraph("3.体检报告电话咨询服务。").Font(f1).FontSize(10.5);
document.InsertParagraph("4.特殊检查预约服务(CT、MR等大型检查设备)。").Font(f1).FontSize(10.5);
document.InsertParagraph("5.住院预约服务。").Font(f1).FontSize(10.5);
document.InsertParagraph("6.外院就诊指导。").Font(f1).FontSize(10.5);
document.InsertParagraph("您 健 康 的 管 家").Font(f1).FontSize(18).Italic(true).Alignment = Alignment.center;
document.InsertParagraph("人生中偶然的病痛--有我们的关怀").Font(f2).FontSize(18).Bold(true).Italic(true).Alignment = Alignment.center;
document.InsertParagraph("健康体检中心").Font(f).FontSize(16).Alignment = Alignment.center;
document.InsertParagraph("团体体检汇总报告").Font(f).FontSize(16).Alignment = Alignment.center;
document.InsertParagraph("企业员工健康检查统计报告").Font(f1).FontSize(22).Alignment = Alignment.center;
document.InsertParagraph("【版权所有,翻印必究】").Font(f).FontSize(10.5).Alignment = Alignment.center;
document.Save();
}
///
/// 生成参检人员构成情况数据 1
///
public async Task CreateInspectionPersonnelData(UnitPhysicalExaminationReportExportWordData documentData, CreateInspectionPersonnelPara customerOrgs)
{
var query = await _patientRegisterRepository.GetQueryableAsync();
if (customerOrgs.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.CustomerOrgGroupId != null && customerOrgs.CustomerOrgGroupId.Contains(m.CustomerOrgGroupId.Value));
}
if (customerOrgs.CustomerOrgRegisterId != GuidFlag.PersonCustomerOrgRegisterId)
{
query = query.Where(m => m.CustomerOrgRegisterId == customerOrgs.CustomerOrgRegisterId);
}
var customerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(customerOrgs.CustomerOrgId);
query = query.Where(m => customerOrgIds.Contains(m.CustomerOrgId));
if (customerOrgs.DateType == '1')
{
query = query.Where(m => m.CreationTime >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.CreationTime < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '2')
{
query = query.Where(m => m.MedicalStartDate != null && m.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.MedicalStartDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '3')
{
query = query.Where(m => m.SummaryDate != null && m.SummaryDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.SummaryDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
var queryList = query.ToList();
#region 登记
int Register_MaleNumber = queryList.Where(m => m.SexId == SexFlag.Male).Count();
int Register_FemaleNumber = queryList.Where(m => m.SexId == SexFlag.Female).Count();
int Register_OtherNumber = queryList.Where(m => m.SexId == SexFlag.UnKnown).Count();
int Register_TotalNumber = Register_MaleNumber + Register_FemaleNumber + Register_OtherNumber;
string Register_MaleRatio = Register_TotalNumber != 0 ? Math.Round(Register_MaleNumber * 100M / Register_TotalNumber, 2).ToString() + "%" : "0%";
string Register_FemaleRatio = Register_TotalNumber != 0 ? Math.Round(Register_FemaleNumber * 100M / Register_TotalNumber, 2).ToString() + "%" : "0%";
string Register_MaleExamineRatio = "100%";
string Register_FemaleExamineRatio = "100%";
string Register_AverageExamineRatio = "100%";
documentData.RegisterDetail = new InspectionPersonnel_Detail
{
MaleNumber = Register_MaleNumber,
FemaleNumber = Register_FemaleNumber,
OtherNumber = Register_OtherNumber,
TotalNumber = Register_TotalNumber,
MaleRatio = Register_MaleRatio,
FemaleRatio = Register_FemaleRatio,
MaleExamineRatio = Register_MaleExamineRatio,
FemaleExamineRatio = Register_FemaleExamineRatio,
AverageExamineRatio = Register_AverageExamineRatio
};
#endregion
#region 实检
int Checked_MaleNumber = queryList.Where(m => (m.CompleteFlag == PatientRegisterCompleteFlag.PartCheck || m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck)
&& m.SexId == SexFlag.Male).Count();
int Checked_FemaleNumber = queryList.Where(m => (m.CompleteFlag == PatientRegisterCompleteFlag.PartCheck || m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck)
&& m.SexId == SexFlag.Female).Count();
int Checked_OtherNumber = queryList.Where(m => (m.CompleteFlag == PatientRegisterCompleteFlag.PartCheck || m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck)
&& m.SexId == SexFlag.UnKnown).Count();
int Checked_TotalNumber = Checked_MaleNumber + Checked_FemaleNumber + Checked_OtherNumber;
string Checked_MaleRatio = Checked_TotalNumber != 0 ? Math.Round(Checked_MaleNumber * 100M / Checked_TotalNumber, 2).ToString() + "%" : "0%";
string Checked_FemaleRatio = Checked_TotalNumber != 0 ? Math.Round(Checked_FemaleNumber * 100M / Checked_TotalNumber, 2).ToString() + "%" : "0%";
string Checked_MaleExamineRatio = Register_MaleNumber != 0 ? Math.Round(Checked_MaleNumber * 100M / Register_MaleNumber, 2).ToString() + "%" : "0%";
string Checked_FemaleExamineRatio = Register_FemaleNumber != 0 ? Math.Round(Checked_FemaleNumber * 100M / Register_FemaleNumber, 2).ToString() + "%" : "0%";
string Checked_AverageExamineRatio = Math.Round(
(
(Register_MaleNumber != 0 ? Math.Round(Checked_MaleNumber * 100M / Register_MaleNumber, 2) : 0)
+ (Register_FemaleNumber != 0 ? Math.Round(Checked_FemaleNumber * 100M / Register_FemaleNumber, 2) : 0)
) / 2
, 2).ToString() + "%";
documentData.CheckedDetail = new InspectionPersonnel_Detail
{
MaleNumber = Checked_MaleNumber,
FemaleNumber = Checked_FemaleNumber,
OtherNumber = Checked_OtherNumber,
TotalNumber = Checked_TotalNumber,
MaleRatio = Checked_MaleRatio,
FemaleRatio = Checked_FemaleRatio,
MaleExamineRatio = Checked_MaleExamineRatio,
FemaleExamineRatio = Checked_FemaleExamineRatio,
AverageExamineRatio = Checked_AverageExamineRatio
};
#endregion
#region 未检
int UnChecked_MaleNumber = queryList.Where(m => (m.CompleteFlag == PatientRegisterCompleteFlag.Registration || m.CompleteFlag == PatientRegisterCompleteFlag.PreRegistration)
&& m.SexId == SexFlag.Male).Count();
int UnChecked_FemaleNumber = queryList.Where(m => (m.CompleteFlag == PatientRegisterCompleteFlag.Registration || m.CompleteFlag == PatientRegisterCompleteFlag.PreRegistration)
&& m.SexId == SexFlag.Female).Count();
int UnChecked_OtherNumber = queryList.Where(m => (m.CompleteFlag == PatientRegisterCompleteFlag.Registration || m.CompleteFlag == PatientRegisterCompleteFlag.PreRegistration)
&& m.SexId == SexFlag.UnKnown).Count();
int UnChecked_TotalNumber = UnChecked_MaleNumber + UnChecked_FemaleNumber + UnChecked_OtherNumber;
string UnChecked_MaleRatio = UnChecked_TotalNumber != 0 ? Math.Round(UnChecked_MaleNumber * 100M / UnChecked_TotalNumber, 2).ToString() + "%" : "0%";
string UnChecked_FemaleRatio = UnChecked_TotalNumber != 0 ? Math.Round(UnChecked_FemaleNumber * 100M / UnChecked_TotalNumber, 2).ToString() + "%" : "0%";
string UnChecked_MaleExamineRatio = Register_MaleNumber != 0 ? Math.Round(UnChecked_MaleNumber * 100M / Register_MaleNumber, 2).ToString() + "%" : "0%";
string UnChecked_FemaleExamineRatio = Register_FemaleNumber != 0 ? Math.Round(UnChecked_FemaleNumber * 100M / Register_FemaleNumber, 2).ToString() + "%" : "0%";
string UnChecked_AverageExamineRatio = Math.Round(
(
(Register_MaleNumber != 0 ? Math.Round(UnChecked_MaleNumber * 100M / Register_MaleNumber, 2) : 0)
+ (Register_FemaleNumber != 0 ? Math.Round(UnChecked_FemaleNumber * 100M / Register_FemaleNumber, 2) : 0)
) / 2, 2
).ToString() + "%";
documentData.UnCheckedDetail = new InspectionPersonnel_Detail
{
MaleNumber = UnChecked_MaleNumber,
FemaleNumber = UnChecked_FemaleNumber,
OtherNumber = UnChecked_OtherNumber,
TotalNumber = UnChecked_TotalNumber,
MaleRatio = UnChecked_MaleRatio,
FemaleRatio = UnChecked_FemaleRatio,
MaleExamineRatio = UnChecked_MaleExamineRatio,
FemaleExamineRatio = UnChecked_FemaleExamineRatio,
AverageExamineRatio = UnChecked_AverageExamineRatio
};
#endregion
}
///
/// 生成体检项目的参检情况数据 2
///
///
///
///
public async Task CreateMedicalItemExamineSituationData(UnitPhysicalExaminationReportExportWordData documentData, CreateInspectionPersonnelPara customerOrgs)
{
var query = from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
join registerAsbitem in await _registerAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync() on registerAsbitem.AsbitemId equals asbitem.Id
join itemType in await _itemTypeRepository.GetQueryableAsync() on asbitem.ItemTypeId equals itemType.Id into itemTypeTemp
from itemTypeHaveEmpty in itemTypeTemp.DefaultIfEmpty()
where registerCheck.CompleteFlag != RegisterCheckCompleteFlag.UnChecked
select new
{
CustomerOrgGroupId = patientRegister.CustomerOrgGroupId,
CustomerOrgRegisterId = patientRegister.CustomerOrgRegisterId,
CustomerOrgId = patientRegister.CustomerOrgId,
PatientRegisterId = patientRegister.Id,
CreationTime = patientRegister.CreationTime,
MedicalStartDate = patientRegister.MedicalStartDate,
SummaryDate = patientRegister.SummaryDate,
SexId = patientRegister.SexId,
ItemTypeName = itemTypeHaveEmpty != null ? itemTypeHaveEmpty.DisplayName : "",
AsbitemName = asbitem.DisplayName,
registerAsbitem
};
if (customerOrgs.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.CustomerOrgGroupId != null && customerOrgs.CustomerOrgGroupId.Contains(m.CustomerOrgGroupId.Value));
}
if (customerOrgs.CustomerOrgRegisterId != GuidFlag.PersonCustomerOrgRegisterId)
{
query = query.Where(m => m.CustomerOrgRegisterId == customerOrgs.CustomerOrgRegisterId);
}
var customerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(customerOrgs.CustomerOrgId);
query = query.Where(m => customerOrgIds.Contains(m.CustomerOrgId));
if (customerOrgs.DateType == '1')
{
query = query.Where(m => m.CreationTime >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.CreationTime < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '2')
{
query = query.Where(m => m.MedicalStartDate != null && m.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.MedicalStartDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '3')
{
query = query.Where(m => m.SummaryDate != null && m.SummaryDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.SummaryDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
List medicalItemExamineSituations = new List();
foreach (var item in query.ToList().GroupBy(g => g.registerAsbitem.AsbitemId))
{
string AsbitemName = item.FirstOrDefault().AsbitemName;
string ItemTypeName = item.FirstOrDefault().ItemTypeName;
int MaleAsbitemCheckNumber = item.Where(m => m.SexId == SexFlag.Male).Count();
int FemaleAsbitemCheckNumber = item.Where(m => m.SexId == SexFlag.Female).Count();
int TotalAsbitemCheckNumber = item.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count();
int MaleSumCheckNumber = documentData.CheckedDetail.MaleNumber;
int FemaleSumCheckNumber = documentData.CheckedDetail.FemaleNumber;
int TotalSumCheckNumber = MaleSumCheckNumber + FemaleSumCheckNumber;
decimal MaleAsbitemCheckRatioValue = 0M;
if (MaleSumCheckNumber != 0)
{
MaleAsbitemCheckRatioValue = Math.Round(MaleAsbitemCheckNumber * 100M / MaleSumCheckNumber, 2);
}
decimal FemaleAsbitemCheckRatioValue = 0M;
if (FemaleSumCheckNumber != 0)
{
FemaleAsbitemCheckRatioValue = Math.Round(FemaleAsbitemCheckNumber * 100M / FemaleSumCheckNumber, 2);
}
string MaleAsbitemCheckRatio = MaleAsbitemCheckRatioValue + "%";
string FemaleAsbitemCheckRatio = FemaleAsbitemCheckRatioValue + "%";
string TotalAsbitemCheckRatio = Math.Round((MaleAsbitemCheckRatioValue + FemaleAsbitemCheckRatioValue) / 2) + "%";
medicalItemExamineSituations.Add(new UnitPhysicalExaminationReportExportWordData_MedicalItemExamineSituation
{
AsbitemName = AsbitemName,
FemaleAsbitemCheckNumber = FemaleAsbitemCheckNumber,
FemaleAsbitemCheckRatio = FemaleAsbitemCheckRatio,
FemaleSumCheckNumber = FemaleSumCheckNumber,
ItemTypeName = ItemTypeName,
MaleAsbitemCheckNumber = MaleAsbitemCheckNumber,
MaleAsbitemCheckRatio = MaleAsbitemCheckRatio,
MaleSumCheckNumber = MaleSumCheckNumber,
TotalAsbitemCheckNumber = TotalAsbitemCheckNumber,
TotalAsbitemCheckRatio = TotalAsbitemCheckRatio,
TotalSumCheckNumber = TotalSumCheckNumber
});
}
//var medicalItemExamineSituations = query.ToList().GroupBy(g => g.registerAsbitem.AsbitemId)
// .Select(s => new UnitPhysicalExaminationReportExportWordData_MedicalItemExamineSituation
// {
// AsbitemName = s.FirstOrDefault().AsbitemName,
// ItemTypeName = s.FirstOrDefault().ItemTypeName,
// MaleAsbitemCheckNumber = s.Where(m => m.SexId == SexFlag.Male).Count(),
// FemaleAsbitemCheckNumber = s.Where(m => m.SexId == SexFlag.Female).Count(),
// TotalAsbitemCheckNumber = s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count(),
// MaleSumCheckNumber = documentData.CheckedDetail.MaleNumber,
// FemaleSumCheckNumber = documentData.CheckedDetail.FemaleNumber,
// TotalSumCheckNumber = documentData.CheckedDetail.MaleNumber + documentData.CheckedDetail.FemaleNumber,
// MaleAsbitemCheckRatio = documentData.CheckedDetail.MaleNumber != 0 ?
// Math.Round(s.Where(m => m.SexId == SexFlag.Male).Count() * 100M / documentData.CheckedDetail.MaleNumber, 2) + "%" : "0%",
// FemaleAsbitemCheckRatio = documentData.CheckedDetail.FemaleNumber != 0 ?
// Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / documentData.CheckedDetail.FemaleNumber, 2) + "%" : "0%",
// TotalAsbitemCheckRatio = Math.Round(
// ((documentData.CheckedDetail.MaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Male).Count() * 100M / documentData.CheckedDetail.MaleNumber, 2) : 0)
// + (documentData.CheckedDetail.FemaleNumber != 0 ? Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / documentData.CheckedDetail.FemaleNumber, 2) : 0)) / 2, 2
// ) + "%"
// });
documentData.MedicalItemExamineSituations = medicalItemExamineSituations.ToList();
}
///
/// 生成全体员工体检结果汇总数据 3
///
/// 数据
/// 参数
///
public async Task CreateMedicalResultSummarysData(UnitPhysicalExaminationReportExportWordData documentData, CreateInspectionPersonnelPara customerOrgs)
{
#region 查询
var query = from a in (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient)
join b in (await _sumSummaryHeaderRepository.GetQueryableAsync()).Include(x => x.SumSummaryContents) on a.Id equals b.PatientRegisterId
join c in await _sexRepository.GetQueryableAsync() on a.SexId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
where a.CompleteFlag == PatientRegisterCompleteFlag.SumCheck
select new
{
CustomerOrgGroupId = a.CustomerOrgGroupId,
CustomerOrgRegisterId = a.CustomerOrgRegisterId,
CustomerOrgId = a.CustomerOrgId,
PatientRegisterId = a.Id,
CreationTime = a.CreationTime,
MedicalStartDate = a.MedicalStartDate,
SummaryDate = a.SummaryDate,
SexName = ac != null ? ac.DisplayName : "",
Age = a.Age,
PatientName = a.PatientName,
PatientNo = a.Patient != null ? a.Patient.PatientNo : "",
b
};
if (customerOrgs.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.CustomerOrgGroupId != null && customerOrgs.CustomerOrgGroupId.Contains(m.CustomerOrgGroupId.Value));
}
if (customerOrgs.CustomerOrgRegisterId != GuidFlag.PersonCustomerOrgRegisterId)
{
query = query.Where(m => m.CustomerOrgRegisterId == customerOrgs.CustomerOrgRegisterId);
}
var customerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(customerOrgs.CustomerOrgId);
query = query.Where(m => customerOrgIds.Contains(m.CustomerOrgId));
if (customerOrgs.DateType == '1')
{
query = query.Where(m => m.CreationTime >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.CreationTime < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '2')
{
query = query.Where(m => m.MedicalStartDate != null && m.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.MedicalStartDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '3')
{
query = query.Where(m => m.SummaryDate != null && m.SummaryDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.SummaryDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
#endregion
var medicalResultSummarys = query.ToList().GroupBy(g => g.PatientRegisterId).Select(s => new UnitPhysicalExaminationReportExportWordData_MedicalResultSummary
{
Age = s.FirstOrDefault().Age != null ? s.FirstOrDefault().Age.ToString() : "",
PatientName = s.FirstOrDefault().PatientName,
PatientNo = s.FirstOrDefault().PatientNo,
SexName = s.FirstOrDefault().SexName,
MedicalResult = DataHelper.SetSumSummarysInReport(s.Select(ss => ss.b).ToList())
});
documentData.MedicalResultSummarys = medicalResultSummarys.ToList();
}
///
/// 生成本次体检异常结果检出统计数据 4
///
/// 数据
/// 参数
///
public async Task CreateMedicalAbnormalResultStatisticsData(UnitPhysicalExaminationReportExportWordData documentData, CreateInspectionPersonnelPara customerOrgs)
{
#region 查询
var query = from a in (await _sumDiagnosisRepository.GetQueryableAsync()).Include(x => x.Diagnosis)
join b in await _patientRegisterRepository.GetQueryableAsync() on a.PatientRegisterId equals b.Id
where b.CompleteFlag == PatientRegisterCompleteFlag.SumCheck
select new
{
CustomerOrgGroupId = b.CustomerOrgGroupId,
CustomerOrgRegisterId = b.CustomerOrgRegisterId,
CustomerOrgId = b.CustomerOrgId,
CreationTime = b.CreationTime,
MedicalStartDate = b.MedicalStartDate,
SummaryDate = b.SummaryDate,
PatientName = b.PatientName,
DiagnosisId = a.DiagnosisId,
SexId = b.SexId,
DiagnosisName = a.Diagnosis != null ? a.Diagnosis.DisplayName : ""
};
if (customerOrgs.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.CustomerOrgGroupId != null && customerOrgs.CustomerOrgGroupId.Contains(m.CustomerOrgGroupId.Value));
}
if (customerOrgs.CustomerOrgRegisterId != GuidFlag.PersonCustomerOrgRegisterId)
{
query = query.Where(m => m.CustomerOrgRegisterId == customerOrgs.CustomerOrgRegisterId);
}
var customerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(customerOrgs.CustomerOrgId);
query = query.Where(m => customerOrgIds.Contains(m.CustomerOrgId));
if (customerOrgs.DateType == '1')
{
query = query.Where(m => m.CreationTime >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.CreationTime < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '2')
{
query = query.Where(m => m.MedicalStartDate != null && m.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.MedicalStartDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '3')
{
query = query.Where(m => m.SummaryDate != null && m.SummaryDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.SummaryDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
#endregion
var medicalAbnormalResultStatistics = query.ToList().GroupBy(g => g.DiagnosisId).Select(s => new UnitPhysicalExaminationReportExportWordData_MedicalAbnormalResultStatistics
{
DiagnosisName = s.FirstOrDefault().DiagnosisName,
PatientDetail = string.Join("、", s.Select(ss => ss.PatientName)),
MaleNumber = s.Where(m => m.SexId == SexFlag.Male).Count(),
FemaleNumber = s.Where(m => m.SexId == SexFlag.Female).Count(),
TotalNumber = s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count(),
MaleRatio = s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count() != 0 ?
Math.Round(s.Where(m => m.SexId == SexFlag.Male).Count() * 100M / s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count(), 2).ToString() + "%" : "0%",
FemaleRatio = s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count() != 0 ?
Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count(), 2).ToString() + "%" : "0%",
AverageRatio = s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count() != 0 ?
Math.Round((Math.Round(s.Where(m => m.SexId == SexFlag.Male).Count() * 100M / s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count(), 2)
+ Math.Round(s.Where(m => m.SexId == SexFlag.Female).Count() * 100M / s.Where(m => m.SexId == SexFlag.Male || m.SexId == SexFlag.Female).Count(), 2)) / 2, 2).ToString() : "0%"
}).OrderByDescending(o => o.TotalNumber);
documentData.MedicalAbnormalResultStatistics = medicalAbnormalResultStatistics.ToList();
}
///
/// 生成本次体检异常结果检出统计数据 5
///
/// 数据
/// 参数
///
public async Task CreateMedicalTenAbnormalResultsData(UnitPhysicalExaminationReportExportWordData documentData, CreateInspectionPersonnelPara customerOrgs)
{
#region 查询
var query = from a in (await _sumDiagnosisRepository.GetQueryableAsync()).Include(x => x.Diagnosis)
join b in await _patientRegisterRepository.GetQueryableAsync() on a.PatientRegisterId equals b.Id
join c in (await _sumSuggestionHeaderRepository.GetQueryableAsync()).Include(x => x.SumSuggestionContents) on a.SumSuggestionHeaderId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
where b.CompleteFlag == PatientRegisterCompleteFlag.SumCheck
select new
{
CustomerOrgGroupId = b.CustomerOrgGroupId,
CustomerOrgRegisterId = b.CustomerOrgRegisterId,
CustomerOrgId = b.CustomerOrgId,
CreationTime = b.CreationTime,
MedicalStartDate = b.MedicalStartDate,
SummaryDate = b.SummaryDate,
DiagnosisId = a.DiagnosisId,
DiagnosisName = a.Diagnosis != null ? a.Diagnosis.DisplayName : "",
ac
};
if (customerOrgs.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.CustomerOrgGroupId != null && customerOrgs.CustomerOrgGroupId.Contains(m.CustomerOrgGroupId.Value));
}
if (customerOrgs.CustomerOrgRegisterId != GuidFlag.PersonCustomerOrgRegisterId)
{
query = query.Where(m => m.CustomerOrgRegisterId == customerOrgs.CustomerOrgRegisterId);
}
var customerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(customerOrgs.CustomerOrgId);
query = query.Where(m => customerOrgIds.Contains(m.CustomerOrgId));
if (customerOrgs.DateType == '1')
{
query = query.Where(m => m.CreationTime >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.CreationTime < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '2')
{
query = query.Where(m => m.MedicalStartDate != null && m.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.MedicalStartDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '3')
{
query = query.Where(m => m.SummaryDate != null && m.SummaryDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.SummaryDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
#endregion
var medicalTenAbnormalResults = query.ToList().GroupBy(g => g.DiagnosisId).Select(s => new UnitPhysicalExaminationReportExportWordData_MedicalTenAbnormalResult
{
DiagnosisName = s.FirstOrDefault().DiagnosisName,
DiagnosisSuggestion = DataHelper.SetSumSuggestionInReport(s.Where(m => m.ac != null).Select(ss => ss.ac).ToList())
});
documentData.MedicalTenAbnormalResults = medicalTenAbnormalResults.ToList();
}
///
/// 生成体检者未完成情况数据 6
///
/// 数据
/// 参数
///
public async Task CreateMedicalUnCheckedStatisticsData(UnitPhysicalExaminationReportExportWordData documentData, CreateInspectionPersonnelPara customerOrgs)
{
#region 查询
var query = from a in (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient)
join b in await _customerOrgRepository.GetQueryableAsync() on a.CustomerOrgId equals b.Id
join c in await _sexRepository.GetQueryableAsync() on a.SexId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
where a.CompleteFlag != PatientRegisterCompleteFlag.SumCheck
select new
{
CustomerOrgGroupId = a.CustomerOrgGroupId,
CustomerOrgRegisterId = a.CustomerOrgRegisterId,
CustomerOrgId = a.CustomerOrgId,
CreationTime = a.CreationTime,
MedicalStartDate = a.MedicalStartDate,
SummaryDate = a.SummaryDate,
PatientNo = a.Patient != null ? a.Patient.PatientNo : "",
PatientName = a.PatientName,
SexName = ac != null ? ac.DisplayName : "",
Age = a.Age,
DepartmentName = b.DisplayName
};
if (customerOrgs.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.CustomerOrgGroupId != null && customerOrgs.CustomerOrgGroupId.Contains(m.CustomerOrgGroupId.Value));
}
if (customerOrgs.CustomerOrgRegisterId != GuidFlag.PersonCustomerOrgRegisterId)
{
query = query.Where(m => m.CustomerOrgRegisterId == customerOrgs.CustomerOrgRegisterId);
}
var customerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(customerOrgs.CustomerOrgId);
query = query.Where(m => customerOrgIds.Contains(m.CustomerOrgId));
if (customerOrgs.DateType == '1')
{
query = query.Where(m => m.CreationTime >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.CreationTime < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '2')
{
query = query.Where(m => m.MedicalStartDate != null && m.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.MedicalStartDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
else if (customerOrgs.DateType == '3')
{
query = query.Where(m => m.SummaryDate != null && m.SummaryDate.Value >= Convert.ToDateTime(customerOrgs.StartDate) &&
m.SummaryDate.Value < Convert.ToDateTime(customerOrgs.EndDate).AddDays(1));
}
#endregion
var medicalUnCheckedStatistics = query.Select(s => new UnitPhysicalExaminationReportExportWordData_MedicalUnCheckedStatistics
{
Age = s.Age != null ? s.Age.ToString() : "",
DepartmentName = s.DepartmentName,
PatientName = s.PatientName,
PatientNo = s.PatientNo,
SexName = s.SexName
});
documentData.MedicalUnCheckedStatistics = medicalUnCheckedStatistics.ToList();
}
}
}