3013 lines
155 KiB
C#
3013 lines
155 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Windows.Forms;
|
||
using SOH.Kernel;
|
||
using EAS.Services;
|
||
using SOH.BLL;
|
||
using SOH.Entities;
|
||
using System.Diagnostics;
|
||
using EAS.Data.Linq;
|
||
using System.Reflection;
|
||
using Org.BouncyCastle.Utilities.Collections;
|
||
using System.Runtime.CompilerServices;
|
||
using System.IO;
|
||
using DataTable = System.Data.DataTable;
|
||
using NPOI.XWPF.UserModel;
|
||
using NPOI.OpenXmlFormats.Wordprocessing;
|
||
using System.Runtime.Remoting.Contexts;
|
||
using iTextSharp.text;
|
||
using NPOI.SS.Formula;
|
||
using WinForm_Test;
|
||
using EAS.Data.Access;
|
||
using NPOI.SS.Formula.Functions;
|
||
|
||
namespace SOH.KeFu
|
||
{
|
||
[ModuleAttribute(ModuleID = "C01CF38C-EE88-4394-ACB9-B44A9419CBDC", ModuleName = "团体疾病统计")]
|
||
public partial class frmTuanTiJiBingTongJi : SOH.Window.baseChildForm
|
||
{
|
||
public frmTuanTiJiBingTongJi()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
public FastReport.Report re = new FastReport.Report();
|
||
public string khmc = ""; //客户名称
|
||
public int zjrs = 0; //总计全部人数
|
||
public int nanRS = 0;//男性人数总计
|
||
public int nvRS = 0;//女性人数总计
|
||
public string jcxmList = ""; //所有检查项目列表
|
||
public string ksrq = ""; //开始时间
|
||
public string jsrq = ""; //结束时间
|
||
public string gjts = ""; //共计天数
|
||
|
||
public int zczbrs = 0; //正常指标人数
|
||
public string zczbrsBfb = ""; //正常指标人数百分比
|
||
public int yczbrs = 0; //异常指标人数
|
||
public string yczbrsBfb = ""; //异常指标人数百分比
|
||
public int yczbNanRs = 0; //异常指标男性人数
|
||
public string yczbNanRsBfb = "";//异常指标男性人数百分比
|
||
public int yczbNvRs = 0; //异常指标女性人数
|
||
public string yczbNvRsBfb = "";//异常指标女性人数百分比
|
||
public int ycjgCount = 0;//异常结果数量
|
||
public string jclHightList = "";//异常结果检出率高的列表
|
||
public string nxjclHightList = "";//女性异常结果检出率高的列表
|
||
public int ygbdxdzRs = 0; // 乙肝病毒携带者人数
|
||
public string ygrsBfb = ""; //乙肝所占人数百分比
|
||
|
||
public bool bShowResult = false;//报告中是否展示结论
|
||
|
||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||
{
|
||
var service = ServiceContainer.GetService<It_ht>();
|
||
thtBindingSource.DataSource = service.GetListByparam(this.textBox1.Text);
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
if (dataGridView1.CurrentRow.Index < 0)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//=======2023-09-13 xulu 修改团检报告展示内容=========
|
||
var service = ServiceContainer.GetService<It_htfzb>();
|
||
t_ht o = dataGridView1.Rows[dataGridView1.CurrentRow.Index].DataBoundItem as t_ht;
|
||
//客户名称
|
||
khmc = o.htbj.ToString();
|
||
if(o.khbianma.ToString().IndexOf("济南二机床")!=-1)
|
||
{
|
||
khmc = "济南二机床" + khmc;
|
||
}
|
||
var IZongJian = ServiceContainer.GetService<IZongJian>();
|
||
//MessageBox.Show("1");
|
||
|
||
//团检人员信息,只包含已体检
|
||
string ttgzbString = ServiceContainer.GetService<IZongJian>().GetAllTtgzbByHtbm(o.htbm);
|
||
DataTable ttgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ttgzbString, typeof(DataTable)) as DataTable;
|
||
|
||
//合同中所有人员信息,包含未检
|
||
string ttgzbString2 = ServiceContainer.GetService<IZongJian>().GetAllTtgzbByHtbm2(o.htbm);
|
||
DataTable ttgzbDt2 = Newtonsoft.Json.JsonConvert.DeserializeObject(ttgzbString2, typeof(DataTable)) as DataTable;
|
||
|
||
//年龄分布表
|
||
DataTable nlfbtDt = new DataTable();
|
||
//年龄分布图
|
||
DataTable nlfbtDtChart = new DataTable();
|
||
|
||
//MessageBox.Show("2");
|
||
if (ttgzbDt.Rows.Count != 0)
|
||
{
|
||
//开始统计年龄分布图
|
||
DataRow[] drNv1 = ttgzbDt.Select("xb=1 and nl > 0 and nl<35");
|
||
DataRow[] drNv2 = ttgzbDt.Select("xb=1 and nl >=35");
|
||
|
||
DataRow[] drNan1 = ttgzbDt.Select("xb=0 and nl > 0 and nl<35");
|
||
DataRow[] drNan2 = ttgzbDt.Select("xb=0 and nl >= 35");
|
||
|
||
//35岁以下所有人员
|
||
DataRow[] drAll1 = ttgzbDt2.Select("nl > 0 and nl<35");
|
||
//35岁及以上所有人员
|
||
DataRow[] drAll2 = ttgzbDt2.Select("nl >= 35");
|
||
|
||
//35岁以下男比例
|
||
double dMale1 = Convert.ToDouble(drNan1.Length) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
string strMale1 = dMale1.ToString("p");
|
||
//35岁及以上男比例
|
||
double dMale2 = Convert.ToDouble(drNan2.Length) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
string strMale2 = dMale2.ToString("p");
|
||
|
||
//35岁以下女比例
|
||
double dFemale1 = Convert.ToDouble(drNv1.Length) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
string strFemale1 = dFemale1.ToString("p");
|
||
//35岁及以上女比例
|
||
double dFemale2 = Convert.ToDouble(drNv2.Length) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
string strFemale2 = dFemale2.ToString("p");
|
||
|
||
//35岁以下总比例
|
||
//string strAllPercent1 = (dMale1+ dFemale1).ToString("p");
|
||
//35岁及以上总比例
|
||
//string strAllPercent2 = (dMale2 + dFemale2).ToString("p");
|
||
double dAllPercent1 = Convert.ToDouble(drNan1.Length + drNv1.Length) / Convert.ToDouble(drAll1.Length);
|
||
double dAllPercent2 = Convert.ToDouble(drNan2.Length + drNv2.Length) / Convert.ToDouble(drAll2.Length);
|
||
|
||
string strAllPercent1 = dAllPercent1.ToString("p");
|
||
string strAllPercent2 = dAllPercent2.ToString("p");
|
||
|
||
//未查体占比
|
||
double dNullInspectionP1 = Convert.ToDouble(drAll1.Length - drNan1.Length - drNv1.Length) / Convert.ToDouble(drAll1.Length);
|
||
double dNullInspectionP2 = Convert.ToDouble(drAll2.Length - drNan2.Length - drNv2.Length) / Convert.ToDouble(drAll2.Length);
|
||
|
||
string strNullInspectionP1 = dNullInspectionP1.ToString("p");
|
||
string strNullInspectionP2 = dNullInspectionP2.ToString("p");
|
||
|
||
nlfbtDt.Columns.Add("title", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("maleCount", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("malePercent", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("femaleCount", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("femalePercent", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("allCount", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("allPercent", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("nullInspection", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("nullInspectionP", Type.GetType("System.String"));
|
||
|
||
nlfbtDt.Rows.Add(new object[] { "35岁以下",drNan1.Length, strMale1, drNv1.Length, strFemale1, drNan1.Length+ drNv1.Length, strAllPercent1, drAll1.Length - drNan1.Length - drNv1.Length, strNullInspectionP1 });
|
||
nlfbtDt.Rows.Add(new object[] { "35岁及以上",drNan2.Length, strMale2, drNv2.Length, strFemale2, drNan2.Length+ drNv2.Length, strAllPercent2, drAll2.Length - drNan2.Length - drNv2.Length, strNullInspectionP2 });
|
||
|
||
nlfbtDtChart.Columns.Add("name", Type.GetType("System.String"));
|
||
nlfbtDtChart.Columns.Add("sex", Type.GetType("System.String"));
|
||
nlfbtDtChart.Columns.Add("count", Type.GetType("System.Int32"));
|
||
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁以下", "人数(女)", drNv1.Length });
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁及以上", "人数(女)", drNv2.Length });
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁以下", "人数(男)", drNan1.Length });
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁及以上", "人数(男)", drNan2.Length });
|
||
|
||
//2023-10-13 xulu 区分报告是否展示结论
|
||
if(bShowResult)
|
||
{
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\ttjbtj.frx");
|
||
}
|
||
else
|
||
{
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\ttjbtj1.frx");
|
||
}
|
||
|
||
//re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\ttjbtj - 副本.frx");
|
||
//MessageBox.Show("3");
|
||
zjrs = 0;
|
||
|
||
//体检总人数
|
||
zjrs = ttgzbDt.Rows.Count;
|
||
//男性人数
|
||
DataRow[] drNan = ttgzbDt.Select("xb=0");
|
||
nanRS = drNan.Length;
|
||
//女性人数
|
||
DataRow[] drNv = ttgzbDt.Select("xb=1");
|
||
nvRS = drNv.Length;
|
||
|
||
//单位体检分组项目
|
||
List<Entities.t_htfzb> listGroup = ServiceContainer.GetService<It_htfzb>().GetListByhtbm(o.htbm);
|
||
DataTable dtProjectGroup = new DataTable();
|
||
dtProjectGroup.Columns.Add("groupCode", Type.GetType("System.String"));
|
||
dtProjectGroup.Columns.Add("groupName", Type.GetType("System.String"));
|
||
dtProjectGroup.Columns.Add("groupGendar", Type.GetType("System.String"));
|
||
dtProjectGroup.Columns.Add("groupPersonCount", Type.GetType("System.Int32"));
|
||
dtProjectGroup.Columns.Add("groupExams", Type.GetType("System.String"));
|
||
|
||
if (listGroup.Count > 0)
|
||
{
|
||
for(int i=0;i<listGroup.Count;i++)
|
||
{
|
||
//根据分组合同编码获取团检人员
|
||
String data = ServiceContainer.GetService<It_ttgzb>().GetList2(listGroup[i].htfzbm);
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
|
||
int iPersonCount = dt.Rows.Count;
|
||
//根据分组合同编码获取体检项目
|
||
List<Entities.t_zhxm> listExams = ServiceContainer.GetService<It_zhxm>().GetzhxmByhtfzbm(listGroup[i].htfzbm);
|
||
string strExam = "";
|
||
for(int j = 0;j<listExams.Count;j++)
|
||
{
|
||
strExam += listExams[j].zhmc + ",";
|
||
}
|
||
strExam = strExam.Substring(0, strExam.Length - 1);
|
||
|
||
dtProjectGroup.Rows.Add(new object[] { listGroup[i].htfzbm, listGroup[i].htfzmc, listGroup[i].xb==0?"男":"女", iPersonCount, strExam });
|
||
}
|
||
|
||
}
|
||
|
||
//健康问题人员分布
|
||
DataTable dtUnhealthy = new DataTable();
|
||
dtUnhealthy.Columns.Add("healthProblem", Type.GetType("System.String"));
|
||
//35岁及以上男性
|
||
dtUnhealthy.Columns.Add("maleC1", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("maleP1", Type.GetType("System.String"));
|
||
//35岁及以上女性
|
||
dtUnhealthy.Columns.Add("femaleC1", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("femaleP1", Type.GetType("System.String"));
|
||
//35岁以下男性
|
||
dtUnhealthy.Columns.Add("maleC2", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("maleP2", Type.GetType("System.String"));
|
||
//35岁以下女性
|
||
dtUnhealthy.Columns.Add("femaleC2", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("femaleP2", Type.GetType("System.String"));
|
||
dtUnhealthy.Columns.Add("allCount", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("allPercent", Type.GetType("System.String"));
|
||
|
||
//生活方式人员情况分布
|
||
DataTable dtLifestyle = new DataTable();
|
||
/* dtLifestyle.Columns.Add("type", Type.GetType("System.String"));
|
||
dtLifestyle.Columns.Add("smoke", Type.GetType("System.Int32"));
|
||
dtLifestyle.Columns.Add("drink", Type.GetType("System.Int32"));
|
||
dtLifestyle.Columns.Add("familyHistory", Type.GetType("System.Int32"));
|
||
dtLifestyle.Columns.Add("regularExercise", Type.GetType("System.Int32"));
|
||
dtLifestyle.Columns.Add("noExercise", Type.GetType("System.Int32"));
|
||
dtLifestyle.Columns.Add("greasyDiet", Type.GetType("System.Int32"));
|
||
dtLifestyle.Columns.Add("balanceDiet", Type.GetType("System.Int32"));
|
||
|
||
dtLifestyle.Rows.Add(new object[] { "35岁及以上男性",0,0,0,0,0,0,0 });
|
||
dtLifestyle.Rows.Add(new object[] { "35岁及以上女性", 0,0,0,0,0,0,0 });
|
||
dtLifestyle.Rows.Add(new object[] { "35岁以下男性", 0,0,0,0,0,0,0 });
|
||
dtLifestyle.Rows.Add(new object[] { "35岁以下女性", 0,0,0,0,0,0,0 });*/
|
||
dtLifestyle = dtUnhealthy.Clone();
|
||
|
||
//健康问题列表
|
||
List<unhealthyStatistics> listUnhealthy = new List<unhealthyStatistics>();
|
||
//生活方式分布
|
||
List<unhealthyStatistics> listLifestyle = new List<unhealthyStatistics>();
|
||
|
||
//获取体检人员体检诊断
|
||
DataTable dtInfo = ServiceContainer.GetService<IZongJian>().GetTTHZJG(o.htbm.ToString());
|
||
getResult(o.htbm, ref listUnhealthy,ref listLifestyle, dtInfo);
|
||
|
||
//填充健康问题表
|
||
for(int i = 0;i< listUnhealthy.Count;i++)
|
||
{
|
||
DataRow drUnhealthy = dtUnhealthy.NewRow();
|
||
drUnhealthy["healthProblem"] = listUnhealthy[i].healthProblem;
|
||
drUnhealthy["maleC1"] = listUnhealthy[i].maleC1;
|
||
drUnhealthy["maleP1"] = listUnhealthy[i].maleP1.ToString("p");
|
||
drUnhealthy["femaleC1"] = listUnhealthy[i].femaleC1;
|
||
drUnhealthy["femaleP1"] = listUnhealthy[i].femaleP1.ToString("p");
|
||
drUnhealthy["maleC2"] = listUnhealthy[i].maleC2;
|
||
drUnhealthy["maleP2"] = listUnhealthy[i].maleP2.ToString("p");
|
||
drUnhealthy["femaleC2"] = listUnhealthy[i].femaleC2;
|
||
drUnhealthy["femaleP2"] = listUnhealthy[i].femaleP2.ToString("p");
|
||
drUnhealthy["allCount"] = listUnhealthy[i].allCount;
|
||
drUnhealthy["allPercent"] = listUnhealthy[i].allPercent.ToString("p");
|
||
dtUnhealthy.Rows.Add(drUnhealthy.ItemArray);
|
||
}
|
||
//创建 健康问题柱状图表,一张表放9个问题
|
||
DataTable dtUnhealthyChart1 = new DataTable();
|
||
DataTable dtUnhealthyChart2 = new DataTable();
|
||
DataTable dtUnhealthyChart3 = new DataTable();
|
||
|
||
dtUnhealthyChart1.Columns.Add("Name", Type.GetType("System.String"));
|
||
dtUnhealthyChart1.Columns.Add("Count", Type.GetType("System.String"));
|
||
dtUnhealthyChart1.Columns.Add("Age", Type.GetType("System.String"));
|
||
dtUnhealthyChart2 = dtUnhealthyChart1.Clone();
|
||
dtUnhealthyChart3 = dtUnhealthyChart1.Clone();
|
||
|
||
for(int i=0;i< listUnhealthy.Count;i++)
|
||
{
|
||
if(i<9)
|
||
{
|
||
dtUnhealthyChart1.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC1 + listUnhealthy[i].femaleC1, "35岁及以上" });
|
||
dtUnhealthyChart1.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC2 + listUnhealthy[i].femaleC2, "35岁以下" });
|
||
}
|
||
else if(i>=9 && i<18)
|
||
{
|
||
dtUnhealthyChart2.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC1 + listUnhealthy[i].femaleC1, "35岁及以上" });
|
||
dtUnhealthyChart2.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC2 + listUnhealthy[i].femaleC2, "35岁以下" });
|
||
}
|
||
else if(i>=18 && i<27)
|
||
{
|
||
dtUnhealthyChart3.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC1 + listUnhealthy[i].femaleC1, "35岁及以上" });
|
||
dtUnhealthyChart3.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC2 + listUnhealthy[i].femaleC2, "35岁以下" });
|
||
}
|
||
}
|
||
|
||
//填充生活方式表
|
||
for(int i =0;i< listLifestyle.Count;i++)
|
||
{
|
||
DataRow drLifestyle = dtLifestyle.NewRow();
|
||
drLifestyle["healthProblem"] = listLifestyle[i].healthProblem;
|
||
drLifestyle["maleC1"] = listLifestyle[i].maleC1;
|
||
drLifestyle["maleP1"] = listLifestyle[i].maleP1.ToString("p");
|
||
drLifestyle["femaleC1"] = listLifestyle[i].femaleC1;
|
||
drLifestyle["femaleP1"] = listLifestyle[i].femaleP1.ToString("p");
|
||
drLifestyle["maleC2"] = listLifestyle[i].maleC2;
|
||
drLifestyle["maleP2"] = listLifestyle[i].maleP2.ToString("p");
|
||
drLifestyle["femaleC2"] = listLifestyle[i].femaleC2;
|
||
drLifestyle["femaleP2"] = listLifestyle[i].femaleP2.ToString("p");
|
||
drLifestyle["allCount"] = listLifestyle[i].allCount;
|
||
drLifestyle["allPercent"] = listLifestyle[i].allPercent.ToString("p");
|
||
dtLifestyle.Rows.Add(drLifestyle.ItemArray);
|
||
}
|
||
//创建 生活方式柱状图表
|
||
DataTable dtLifestyleChart = new DataTable();
|
||
dtLifestyleChart = dtUnhealthyChart1.Clone();
|
||
for(int i=0;i<listLifestyle.Count;i++)
|
||
{
|
||
dtLifestyleChart.Rows.Add(new object[] { listLifestyle[i].healthProblem, listLifestyle[i].maleC1 + listLifestyle[i].femaleC1, "35岁及以上" });
|
||
dtLifestyleChart.Rows.Add(new object[] { listLifestyle[i].healthProblem, listLifestyle[i].maleC2 + listLifestyle[i].femaleC2, "35岁以下" });
|
||
}
|
||
//健康问题描述与建议
|
||
DataTable dtDescribe = new DataTable();
|
||
dtDescribe.Columns.Add("problem", Type.GetType("System.String"));
|
||
dtDescribe.Columns.Add("describe", Type.GetType("System.String"));
|
||
//strDescribe与strProblems一一对应
|
||
string strDescribe = "体重指数>24,腰围(男>90 女>85),空腹血葡萄糖(GLU)偏高,体检血压高," +
|
||
"心律不齐,肾囊肿,肝囊肿,胆囊息肉,肝功能多项指标异常,甘油三酯(TG)偏高,总胆固醇(TC)偏高,尿酸(UA)偏高," +
|
||
"尿素增高,肌酐(CRE)偏高,肿瘤八项轻度增高,血常规部分项目轻度异常,幽门螺旋杆菌阳性(+),中度脂肪肝,肺炎,肺结节," +
|
||
"肺纹理增粗,肺占位病变(中央型),颈椎退行性改变,颈椎骨质增生,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arrDescribe = strDescribe.Split(',');
|
||
for(int i = 0;i< arrDescribe.Length;i++)
|
||
{
|
||
t_jyms jyms = ServiceContainer.GetService<It_jyms>().GetjymsList(arrDescribe[i], "").FirstOrDefault();
|
||
if(jyms != null)
|
||
{
|
||
dtDescribe.Rows.Add(new object[] { listUnhealthy[i].healthProblem, jyms.jcjy });
|
||
}
|
||
|
||
}
|
||
//女性健康问题人员分布
|
||
DataTable dtFemaleProblem = new DataTable();
|
||
dtFemaleProblem.Columns.Add("problem", Type.GetType("System.String"));
|
||
dtFemaleProblem.Columns.Add("age1", Type.GetType("System.Int32"));
|
||
dtFemaleProblem.Columns.Add("age2", Type.GetType("System.Int32"));
|
||
dtFemaleProblem.Columns.Add("all", Type.GetType("System.Int32"));
|
||
dtFemaleProblem.Columns.Add("percent", Type.GetType("System.String"));
|
||
dtFemaleProblem.Columns.Add("name", Type.GetType("System.String"));
|
||
dtFemaleProblem.Columns.Add("examAll", Type.GetType("System.Int32"));
|
||
|
||
DataTable dtFemaleProblemChart = new DataTable();
|
||
dtFemaleProblemChart.Columns.Add("problem", Type.GetType("System.String"));
|
||
dtFemaleProblemChart.Columns.Add("age", Type.GetType("System.String"));
|
||
dtFemaleProblemChart.Columns.Add("count", Type.GetType("System.String"));
|
||
|
||
string strFemaleProblem = "胆固醇异常,血压偏高,颈椎退行性改变,颈椎骨质增生,肝囊肿,肝功异常,尿酸,血常规异常,幽门螺旋杆菌抗体异常";
|
||
string[] arrFemaleProblem = strFemaleProblem.Split(',');
|
||
for(int i=0;i<arrFemaleProblem.Length;i++)
|
||
{
|
||
unhealthyStatistics un = listUnhealthy.Where(item=>item.healthProblem == arrFemaleProblem[i]).FirstOrDefault();
|
||
if(un != null)
|
||
{
|
||
int iAllProblemPerson = un.femaleC1 + un.femaleC2;
|
||
double dPercent = Convert.ToDouble(iAllProblemPerson) / Convert.ToDouble(un.iFemaleExamPersonCount);
|
||
string strPercent = dPercent.ToString("p");
|
||
if (un.strFemaleName != null)
|
||
{
|
||
un.strFemaleName = un.strFemaleName.Substring(0, un.strFemaleName.Length - 1);
|
||
}
|
||
dtFemaleProblem.Rows.Add(new object[] { arrFemaleProblem[i], un.femaleC1, un.femaleC2, iAllProblemPerson, strPercent, un.strFemaleName, un.iFemaleExamPersonCount });
|
||
dtFemaleProblemChart.Rows.Add(new object[] { arrFemaleProblem[i], "35岁及以上", un.femaleC1 });
|
||
dtFemaleProblemChart.Rows.Add(new object[] { arrFemaleProblem[i], "35岁以下", un.femaleC2 });
|
||
}
|
||
|
||
}
|
||
//男性健康问题人员分布
|
||
DataTable dtMaleProblem = new DataTable();
|
||
dtMaleProblem = dtFemaleProblem.Clone();
|
||
DataTable dtMaleProblemChart = new DataTable();
|
||
dtMaleProblemChart = dtFemaleProblemChart.Clone();
|
||
|
||
string strMaleProblem = "超重BMI≥24,腰围(男>90 女>85),幽门螺旋杆菌抗体异常,颈椎退行性改变,颈椎骨质增生," +
|
||
"脂肪肝,肝功异常,肝囊肿,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arrMaleProblem = strMaleProblem.Split(',');
|
||
for(int i=0;i<arrMaleProblem.Length;i++)
|
||
{
|
||
unhealthyStatistics un = listUnhealthy.Where(item => item.healthProblem == arrMaleProblem[i]).FirstOrDefault();
|
||
if(un != null)
|
||
{
|
||
int iAllProblemPerson = un.maleC1 + un.maleC2;
|
||
double dPercent = Convert.ToDouble(iAllProblemPerson) / Convert.ToDouble(un.iMaleExamPersonCount);
|
||
string strPercent = dPercent.ToString("p");
|
||
if (un.strMaleName != null)
|
||
{
|
||
un.strMaleName = un.strMaleName.Substring(0, un.strMaleName.Length - 1);
|
||
}
|
||
dtMaleProblem.Rows.Add(new object[] { arrMaleProblem[i], un.maleC1, un.maleC2, iAllProblemPerson, strPercent, un.strMaleName, un.iMaleExamPersonCount });
|
||
dtMaleProblemChart.Rows.Add(new object[] { arrMaleProblem[i], "35岁及以上", un.maleC1 });
|
||
dtMaleProblemChart.Rows.Add(new object[] { arrMaleProblem[i], "35岁以下", un.maleC2 });
|
||
}
|
||
|
||
}
|
||
//===========================================================
|
||
|
||
//获取检查项目列表
|
||
string jcxmListString = ServiceContainer.GetService<IZongJian>().GetJcxmListByHtbm(o.htbm);
|
||
DataTable jcxmListDt = Newtonsoft.Json.JsonConvert.DeserializeObject(jcxmListString, typeof(DataTable)) as DataTable;
|
||
if (jcxmListDt.Rows.Count != 0)
|
||
{
|
||
jcxmList = "";
|
||
foreach (DataRow dr in jcxmListDt.Rows)
|
||
{
|
||
jcxmList += dr["zhmc"].ToString() + "、";
|
||
}
|
||
jcxmList = jcxmList.Substring(0, jcxmList.Length - 1);
|
||
}
|
||
else
|
||
{
|
||
jcxmList = "无";
|
||
}
|
||
//获取体检时间间隔
|
||
DataView dv = ttgzbDt.DefaultView;
|
||
dv.Sort = "tjrq Asc";
|
||
DataTable dt2 = dv.ToTable();
|
||
|
||
DateTime dtKsrq = Convert.ToDateTime(dt2.Rows[0]["tjrq"]);
|
||
DateTime dtJsrq = Convert.ToDateTime(dt2.Rows[ttgzbDt.Rows.Count - 1]["tjrq"]);
|
||
|
||
ksrq = dtKsrq.GetDateTimeFormats('D')[0].ToString();
|
||
jsrq = dtJsrq.GetDateTimeFormats('D')[0].ToString();
|
||
TimeSpan d = dtJsrq - dtKsrq;
|
||
gjts = d.Days.ToString();
|
||
|
||
zczbrs = 0;
|
||
zczbrsBfb = "";
|
||
yczbrs = 0;
|
||
yczbrsBfb = "";
|
||
yczbNanRs = 0;
|
||
yczbNanRsBfb = "";
|
||
yczbNvRs = 0;
|
||
yczbNvRsBfb = "";
|
||
|
||
DataTable fbx = new DataTable();
|
||
fbx.Columns.Add("体检指标异常及疾病名称", Type.GetType("System.String"));
|
||
fbx.Columns.Add("检出人数", Type.GetType("System.Int32"));
|
||
fbx.Columns.Add("体检人数", Type.GetType("System.Int32"));
|
||
fbx.Columns.Add("所属科室", Type.GetType("System.String"));
|
||
fbx.Columns.Add("科室性别", Type.GetType("System.Int32"));
|
||
|
||
DataTable ygDt = new DataTable();
|
||
ygDt.Columns.Add("体检指标异常及疾病名称", Type.GetType("System.String"));
|
||
ygDt.Columns.Add("检出人数", Type.GetType("System.Int32"));
|
||
ygDt.Columns.Add("体检人数", Type.GetType("System.Int32"));
|
||
ygDt.Columns.Add("所属科室", Type.GetType("System.Int32"));
|
||
ygDt.Columns.Add("科室性别", Type.GetType("System.Int32"));
|
||
|
||
//提醒内容
|
||
DataTable txnrDt = new DataTable();
|
||
txnrDt.Columns.Add("体检指标异常及疾病名称", Type.GetType("System.String"));
|
||
txnrDt.Columns.Add("提醒内容", Type.GetType("System.String"));
|
||
|
||
string tempdjxmListStr = ServiceContainer.GetService<IZongJian>().GetTempdjxmByTms(o.htbm);
|
||
DataTable tempdjxmListDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tempdjxmListStr, typeof(DataTable)) as DataTable;
|
||
|
||
if (tempdjxmListDt.Rows.Count == 0)
|
||
{
|
||
MessageBox.Show("团检用户录入信息不完整,请检查数据库!");
|
||
return;
|
||
}
|
||
|
||
//汇总分析结果
|
||
DataTable hzfxDt = new DataTable();
|
||
hzfxDt.Columns.Add("序号", Type.GetType("System.Int32"));
|
||
hzfxDt.Columns.Add("条码号", Type.GetType("System.String"));
|
||
hzfxDt.Columns.Add("姓名", Type.GetType("System.String"));
|
||
hzfxDt.Columns.Add("性别", Type.GetType("System.String"));
|
||
hzfxDt.Columns.Add("年龄", Type.GetType("System.String"));
|
||
hzfxDt.Columns.Add("汇总分析结果", Type.GetType("System.String"));
|
||
//MessageBox.Show("4");
|
||
foreach (DataRow dr1 in ttgzbDt.Rows)
|
||
{
|
||
//string jbkListString = ServiceContainer.GetService<IZongJian>().GetJbtjByTm(Convert.ToInt32(dr1["tm"]));
|
||
//DataTable jbkListDt = Newtonsoft.Json.JsonConvert.DeserializeObject(jbkListString, typeof(DataTable)) as DataTable;
|
||
//根据人员获取体检项目结果
|
||
DataTable jbkListDt = ServiceContainer.GetService<IZongJian>().GetJbtjByTmNew(Convert.ToInt32(dr1["tm"]));
|
||
if (jbkListDt.Rows.Count != 0)
|
||
{
|
||
yczbrs++;
|
||
|
||
DataRow hzfxDr = hzfxDt.NewRow();
|
||
hzfxDr["序号"] = yczbrs;
|
||
hzfxDr["条码号"] = dr1["tm"];
|
||
hzfxDr["姓名"] = dr1["xm"];
|
||
hzfxDr["年龄"] = dr1["nl"];
|
||
|
||
string hzfxStr = "";
|
||
|
||
if (dr1["xb"].ToString().Equals("0"))
|
||
{
|
||
yczbNanRs++;
|
||
hzfxDr["性别"] = "男";
|
||
}
|
||
else
|
||
{
|
||
yczbNvRs++;
|
||
hzfxDr["性别"] = "女";
|
||
}
|
||
foreach (DataRow jbkDr in jbkListDt.Rows)
|
||
{
|
||
//hzfxStr += jbkDr["jbmc"].ToString() + "、";
|
||
hzfxStr += jbkDr["Name"].ToString() + "、";
|
||
|
||
//DataRow[] drtempdjxmListDt = tempdjxmListDt.Select("ksbm=" + jbkDr["ksbm"] + "");
|
||
DataRow[] drtempdjxmListDt = tempdjxmListDt.Select("ksbm=" + jbkDr["fddm"] + "");
|
||
|
||
if (drtempdjxmListDt == null || drtempdjxmListDt.Length == 0)
|
||
{
|
||
//string tjjdString = ServiceContainer.GetService<IZongJian>().GetTjjdByTmAndZdjg(Convert.ToInt32(dr1["tm"]), jbkDr["jbmc"].ToString());
|
||
//string tjjdString = ServiceContainer.GetService<IZongJian>().GetTjjdByTmAndZdjg(Convert.ToInt32(dr1["tm"]), jbkDr["Name"].ToString());
|
||
|
||
//DataTable tjjdDt = Newtonsoft.Json.JsonConvert.DeserializeObject(tjjdString, typeof(DataTable)) as DataTable;
|
||
//if (tjjdDt.Rows.Count == 0)
|
||
//{
|
||
// //string jbbm = jbkDr["jbmc"].ToString();
|
||
// //MessageBox.Show(jbkDr["jbbm"].ToString() + jbbm+":没有维护所属科室,请联系管理员!条码号:"+ dr1["tm"].ToString());
|
||
// string jbbm = jbkDr["Name"].ToString();
|
||
// MessageBox.Show(jbkDr["Name"].ToString() + jbbm + ":没有维护所属科室,请联系管理员!条码号:" + dr1["tm"].ToString());
|
||
// return;
|
||
// //continue;
|
||
//}
|
||
//DataRow[] drzhxm2 = tempdjxmListDt.Select("tm=" + dr1["tm"] + " and ksbm=" + tjjdDt.Rows[0]["ksbm"] + "");
|
||
DataRow[] drzhxm2 = tempdjxmListDt.Select("tm=" + dr1["tm"] + " and ksbm=" + jbkDr["fddm"] + "");
|
||
|
||
DataTable tmp = drzhxm2[0].Table.Clone(); // 复制DataRow的表结构
|
||
foreach (DataRow row in drzhxm2)
|
||
{
|
||
tmp.Rows.Add(row.ItemArray); // 将DataRow添加到DataTable中
|
||
}
|
||
|
||
var query1 = from t in tmp.AsEnumerable()
|
||
group t by t.Field<Int64>("tm") into m
|
||
select new
|
||
{
|
||
tm = m.Key
|
||
};
|
||
|
||
DataTable queryDt = new DataTable();
|
||
queryDt.Columns.Add("tm", Type.GetType("System.String"));
|
||
|
||
if (query1.ToList().Count > 0)
|
||
{
|
||
|
||
|
||
query1.ToList().ForEach(q =>
|
||
{
|
||
DataRow newRow1 = queryDt.NewRow();
|
||
newRow1["tm"] = q.tm;
|
||
queryDt.Rows.Add(newRow1.ItemArray);
|
||
});
|
||
}
|
||
|
||
string zhxmString = ServiceContainer.GetService<IZongJian>().GetZhxmByZhbm(Convert.ToInt32(drzhxm2[0]["zhbm"]));
|
||
DataTable zhxmDt = Newtonsoft.Json.JsonConvert.DeserializeObject(zhxmString, typeof(DataTable)) as DataTable;
|
||
|
||
DataRow newRow = fbx.NewRow();
|
||
//newRow["体检指标异常及疾病名称"] = jbkDr["jbmc"].ToString();
|
||
newRow["体检指标异常及疾病名称"] = jbkDr["Name"].ToString();
|
||
newRow["检出人数"] = 1;
|
||
newRow["体检人数"] = queryDt.Rows.Count;
|
||
//newRow["所属科室"] = jbkDr["ksbm"];
|
||
newRow["所属科室"] = jbkDr["fddm"];
|
||
newRow["科室性别"] = jbkDr["xb"];
|
||
fbx.Rows.Add(newRow.ItemArray);
|
||
|
||
DataRow txnrRow = txnrDt.NewRow();
|
||
//txnrRow["体检指标异常及疾病名称"] = jbkDr["jbmc"];
|
||
//txnrRow["提醒内容"] = jbkDr["txnr"];
|
||
txnrRow["体检指标异常及疾病名称"] = jbkDr["Name"];
|
||
txnrRow["提醒内容"] = jbkDr["Description"];
|
||
txnrDt.Rows.Add(txnrRow.ItemArray);
|
||
}
|
||
else
|
||
{
|
||
DataTable tmp = drtempdjxmListDt[0].Table.Clone(); // 复制DataRow的表结构
|
||
foreach (DataRow row in drtempdjxmListDt)
|
||
{
|
||
tmp.Rows.Add(row.ItemArray); // 将DataRow添加到DataTable中
|
||
}
|
||
|
||
var query2 = from t in tmp.AsEnumerable()
|
||
group t by t.Field<Int64>("tm") into m
|
||
select new
|
||
{
|
||
tm = m.Key
|
||
};
|
||
|
||
DataTable queryDt = new DataTable();
|
||
queryDt.Columns.Add("tm", Type.GetType("System.String"));
|
||
|
||
if (query2.ToList().Count > 0)
|
||
{
|
||
|
||
|
||
query2.ToList().ForEach(q =>
|
||
{
|
||
DataRow newRow1 = queryDt.NewRow();
|
||
newRow1["tm"] = q.tm;
|
||
queryDt.Rows.Add(newRow1.ItemArray);
|
||
});
|
||
}
|
||
|
||
DataRow newRow = fbx.NewRow();
|
||
//newRow["体检指标异常及疾病名称"] = jbkDr["jbmc"].ToString();
|
||
//newRow["检出人数"] = 1;
|
||
//newRow["体检人数"] = queryDt.Rows.Count;
|
||
//newRow["所属科室"] = jbkDr["ksbm"];
|
||
//newRow["科室性别"] = jbkDr["xb"];
|
||
//fbx.Rows.Add(newRow.ItemArray);
|
||
|
||
//DataRow txnrRow = txnrDt.NewRow();
|
||
//txnrRow["体检指标异常及疾病名称"] = jbkDr["jbmc"];
|
||
//txnrRow["提醒内容"] = jbkDr["txnr"];
|
||
newRow["体检指标异常及疾病名称"] = jbkDr["Name"].ToString();
|
||
newRow["检出人数"] = 1;
|
||
//newRow["体检人数"] = queryDt.Rows.Count;
|
||
newRow["体检人数"] = zjrs;
|
||
newRow["所属科室"] = jbkDr["fddm"];
|
||
newRow["科室性别"] = jbkDr["xb"];
|
||
fbx.Rows.Add(newRow.ItemArray);
|
||
|
||
DataRow txnrRow = txnrDt.NewRow();
|
||
txnrRow["体检指标异常及疾病名称"] = jbkDr["Name"];
|
||
txnrRow["提醒内容"] = jbkDr["Description"];
|
||
txnrDt.Rows.Add(txnrRow.ItemArray);
|
||
}
|
||
}
|
||
|
||
hzfxDr["汇总分析结果"] = hzfxStr.Substring(0, hzfxStr.Length - 1);
|
||
|
||
hzfxDt.Rows.Add(hzfxDr.ItemArray);
|
||
}
|
||
else
|
||
{
|
||
zczbrs++;
|
||
string tmh = dr1["tm"].ToString();
|
||
}
|
||
}
|
||
//MessageBox.Show("5");
|
||
DataTable fb3 = fbx.Clone();
|
||
var query = from t in fbx.AsEnumerable()
|
||
group t by new { t1 = t.Field<string>("体检指标异常及疾病名称"), t2 = t.Field<int>("体检人数"), t3 = t.Field<string>("所属科室"), t4 = t.Field<int>("科室性别") } into m
|
||
select new
|
||
{
|
||
jbmc = m.Key.t1,
|
||
jcrs = m.Sum(n => n.Field<int>("检出人数")),
|
||
tjrs = m.Key.t2,
|
||
ssks = m.Key.t3,
|
||
ksxb = m.Key.t4,
|
||
jcl = string.Format("{0:0.00%}", ((double)m.Sum(n => n.Field<int>("检出人数")) / (double)m.Key.t2))
|
||
};
|
||
if (query.ToList().Count > 0)
|
||
{
|
||
query.ToList().ForEach(q =>
|
||
{
|
||
DataRow newRow = fb3.NewRow();
|
||
newRow["体检指标异常及疾病名称"] = q.jbmc;
|
||
newRow["检出人数"] = q.jcrs;
|
||
newRow["体检人数"] = q.tjrs;
|
||
newRow["所属科室"] = q.jcl;
|
||
newRow["科室性别"] = q.ksxb;
|
||
fb3.Rows.Add(newRow.ItemArray);
|
||
});
|
||
}
|
||
|
||
DataTable txnrNewDt = txnrDt.Clone();
|
||
var txnrQuery = from t in txnrDt.AsEnumerable()
|
||
group t by new { t1 = t.Field<string>("体检指标异常及疾病名称"), t2 = t.Field<string>("提醒内容") } into m
|
||
select new
|
||
{
|
||
jbmc = m.Key.t1,
|
||
txnr = m.Key.t2
|
||
};
|
||
|
||
if (txnrQuery.ToList().Count > 0)
|
||
{
|
||
txnrQuery.ToList().ForEach(q =>
|
||
{
|
||
DataRow newRow = txnrNewDt.NewRow();
|
||
newRow["体检指标异常及疾病名称"] = q.jbmc;
|
||
newRow["提醒内容"] = q.txnr;
|
||
|
||
txnrNewDt.Rows.Add(newRow.ItemArray);
|
||
});
|
||
}
|
||
|
||
ycjgCount = 0;
|
||
jclHightList = "";
|
||
nxjclHightList = "";
|
||
|
||
|
||
DataTable fb3TbNvDt = new DataTable();
|
||
fb3TbNvDt.Columns.Add("name", Type.GetType("System.String"));
|
||
fb3TbNvDt.Columns.Add("sex", Type.GetType("System.String"));
|
||
fb3TbNvDt.Columns.Add("count", Type.GetType("System.Int32"));
|
||
|
||
DataTable fb3TbNanDt = new DataTable();
|
||
fb3TbNanDt.Columns.Add("name", Type.GetType("System.String"));
|
||
fb3TbNanDt.Columns.Add("sex", Type.GetType("System.String"));
|
||
fb3TbNanDt.Columns.Add("count", Type.GetType("System.Int32"));
|
||
|
||
//MessageBox.Show("6");
|
||
|
||
if (fb3.Rows.Count != 0)
|
||
{
|
||
fb3.DefaultView.Sort = "检出人数 DESC";
|
||
ycjgCount = fb3.Rows.Count;
|
||
|
||
if (ycjgCount > 10)
|
||
{
|
||
int i = 0;
|
||
foreach (DataRow dr in fb3.Rows)
|
||
{
|
||
i++;
|
||
if (dr["科室性别"].ToString() == "1")
|
||
{
|
||
string jclstr = dr["所属科室"].ToString().Substring(0, dr["所属科室"].ToString().Length - 1);
|
||
fb3TbNvDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "人次", dr["检出人数"] });
|
||
fb3TbNvDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "检出率", Convert.ToDouble(jclstr) });
|
||
}
|
||
else
|
||
{
|
||
string jclstr = dr["所属科室"].ToString().Substring(0, dr["所属科室"].ToString().Length - 1);
|
||
fb3TbNanDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "人次", dr["检出人数"] });
|
||
fb3TbNanDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "检出率", Convert.ToDouble(jclstr) });
|
||
}
|
||
|
||
jclHightList += dr["体检指标异常及疾病名称"].ToString() + "、";
|
||
if (i == 10)
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
jclHightList = jclHightList.Substring(0, jclHightList.Length - 1);
|
||
}
|
||
else
|
||
{
|
||
foreach (DataRow dr in fb3.Rows)
|
||
{
|
||
if (dr["科室性别"].ToString() == "1")
|
||
{
|
||
string jclstr = dr["所属科室"].ToString().Substring(0, dr["所属科室"].ToString().Length - 1);
|
||
fb3TbNvDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "人次", dr["检出人数"] });
|
||
fb3TbNvDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "检出率", Convert.ToDouble(jclstr) });
|
||
}
|
||
else
|
||
{
|
||
string jclstr = dr["所属科室"].ToString().Substring(0, dr["所属科室"].ToString().Length - 1);
|
||
fb3TbNanDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "人次", dr["检出人数"] });
|
||
fb3TbNanDt.Rows.Add(new object[] { dr["体检指标异常及疾病名称"], "检出率", Convert.ToDouble(jclstr) });
|
||
}
|
||
|
||
|
||
jclHightList += dr["体检指标异常及疾病名称"].ToString() + "、";
|
||
}
|
||
jclHightList = jclHightList.Substring(0, jclHightList.Length - 1);
|
||
}
|
||
|
||
DataRow[] nxjclHightRows = fb3.Select("科室性别=1");
|
||
if (nxjclHightRows.Length != 0)
|
||
{
|
||
if (nxjclHightRows.Length > 2)
|
||
{
|
||
int x = 0;
|
||
foreach (DataRow dr in nxjclHightRows)
|
||
{
|
||
x++;
|
||
nxjclHightList += dr["体检指标异常及疾病名称"].ToString() + "、";
|
||
if (x == 3)
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
nxjclHightList = "女性中检出率较高的异常结果为" + nxjclHightList.Substring(0, nxjclHightList.Length - 1) + "等详见附表4。";
|
||
}
|
||
else
|
||
{
|
||
foreach (DataRow dr in nxjclHightRows)
|
||
{
|
||
nxjclHightList += dr["体检指标异常及疾病名称"].ToString() + "、";
|
||
}
|
||
nxjclHightList = "女性中检出率较高的异常结果为" + nxjclHightList.Substring(0, nxjclHightList.Length - 1) + "等详见附表4。";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
nxjclHightList = "";
|
||
}
|
||
|
||
|
||
re.SetParameterValue("ycjgCount", ycjgCount);
|
||
re.SetParameterValue("jclHightList", jclHightList);
|
||
re.SetParameterValue("nxjclHightList", nxjclHightList);
|
||
}
|
||
|
||
if (zczbrs == 0)
|
||
{
|
||
zczbrsBfb = "0.00%";
|
||
yczbrsBfb = "100.00%";
|
||
}
|
||
else
|
||
{
|
||
double DzczbrsBfb = Convert.ToDouble(zczbrs) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
zczbrsBfb = string.Format("{0:0.00%}", DzczbrsBfb);
|
||
double DyczbrsBfb = Convert.ToDouble(yczbrs) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
yczbrsBfb = string.Format("{0:0.00%}", DyczbrsBfb);
|
||
double DyczbNanRsBfb = Convert.ToDouble(yczbNanRs) / Convert.ToDouble(yczbrs);
|
||
yczbNanRsBfb = string.Format("{0:0.00%}", DyczbNanRsBfb);
|
||
double DyczbNvRsBfb = Convert.ToDouble(yczbNvRs) / Convert.ToDouble(yczbrs);
|
||
yczbNvRsBfb = string.Format("{0:0.00%}", DyczbNvRsBfb);
|
||
}
|
||
|
||
//开始统计 健康总体状况:异常与非异常比例图及各种疾病分布图
|
||
DataTable jkztzkDt = new DataTable();
|
||
|
||
jkztzkDt.Columns.Add("name", Type.GetType("System.String"));
|
||
jkztzkDt.Columns.Add("count", Type.GetType("System.Int32"));
|
||
|
||
jkztzkDt.Rows.Add(new object[] { "异常人数" + yczbrsBfb, yczbrs });
|
||
jkztzkDt.Rows.Add(new object[] { "未见异常人数" + zczbrsBfb, zczbrs });
|
||
|
||
|
||
//开始统计乙肝五项人数
|
||
ygbdxdzRs = 0;
|
||
ygrsBfb = "0.00%";
|
||
DataRow[] ygwxDrs = tempdjxmListDt.Select("zhbm=14");
|
||
if (ygwxDrs.Length != 0)
|
||
{
|
||
int[] array = new int[ygwxDrs.Length + 1];
|
||
for (int i = 0; i < ygwxDrs.Length; i++)
|
||
{
|
||
array[i] = Convert.ToInt32(ygwxDrs[i]["tm"]);
|
||
}
|
||
|
||
string ygTjjgString = ServiceContainer.GetService<IZongJian>().GetYgwxTjjgBytm(array, 2901);
|
||
DataTable ygTjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ygTjjgString, typeof(DataTable)) as DataTable;
|
||
if (ygTjjgDt.Rows.Count != 0)
|
||
{
|
||
foreach (DataRow ygDr in ygTjjgDt.Rows)
|
||
{
|
||
if (ygDr["jg"].ToString() == "+" || ygDr["jg"].ToString() == "阳性")
|
||
{
|
||
ygbdxdzRs++;
|
||
}
|
||
}
|
||
}
|
||
double DygrsBfb = Convert.ToDouble(ygbdxdzRs) / Convert.ToDouble(ttgzbDt.Rows.Count);
|
||
ygrsBfb = string.Format("{0:0.00%}", DygrsBfb);
|
||
}
|
||
else
|
||
{
|
||
ygbdxdzRs = 0;
|
||
ygrsBfb = "0.00%";
|
||
}
|
||
|
||
//MessageBox.Show("7");
|
||
//客户名称(单位名称)
|
||
re.SetParameterValue("khmc", khmc);
|
||
//单位编号
|
||
re.SetParameterValue("dwbh", o.khbm);
|
||
//联系人
|
||
re.SetParameterValue("lxr", o.ywdbdm);
|
||
//联系电话
|
||
re.SetParameterValue("lxdh", o.khlxrdh);
|
||
//体检分组数量
|
||
re.SetParameterValue("groupCount", listGroup.Count);
|
||
//体检总人数
|
||
re.SetParameterValue("zjrs", zjrs);
|
||
//男性人数
|
||
re.SetParameterValue("nanRS", nanRS);
|
||
//女性人数
|
||
re.SetParameterValue("nvRS", nvRS);
|
||
re.SetParameterValue("jcxms", jcxmList);
|
||
re.SetParameterValue("ksrq", ksrq);
|
||
re.SetParameterValue("jsrq", jsrq);
|
||
re.SetParameterValue("gjts", gjts);
|
||
|
||
re.SetParameterValue("zczbrs", zczbrs);
|
||
re.SetParameterValue("zczbrsBfb", zczbrsBfb);
|
||
re.SetParameterValue("yczbrs", yczbrs);
|
||
re.SetParameterValue("yczbrsBfb", yczbrsBfb);
|
||
re.SetParameterValue("yczbNanRs", yczbNanRs);
|
||
re.SetParameterValue("yczbNanRsBfb", yczbNanRsBfb);
|
||
re.SetParameterValue("yczbNvRs", yczbNvRs);
|
||
re.SetParameterValue("yczbNvRsBfb", yczbNvRsBfb);
|
||
re.SetParameterValue("ygbdxdzRs", ygbdxdzRs);
|
||
re.SetParameterValue("ygrsBfb", ygrsBfb);
|
||
|
||
//2023-10-20 xulu 添加合计
|
||
re.SetParameterValue("male", drNan2.Length + drNan1.Length);
|
||
re.SetParameterValue("female", drNv2.Length + drNv1.Length);
|
||
re.SetParameterValue("all", drNan2.Length + drNv2.Length + drNan1.Length + drNv1.Length);
|
||
re.SetParameterValue("allnull", (drAll2.Length - drNan2.Length - drNv2.Length) + (drAll1.Length - drNan1.Length - drNv1.Length));
|
||
int iAll = drNan2.Length + drNv2.Length + drNan1.Length + drNv1.Length;
|
||
int iAllNull = (drAll2.Length - drNan2.Length - drNv2.Length) + (drAll1.Length - drNan1.Length - drNv1.Length);
|
||
double dAllnullP = Convert.ToDouble(iAllNull) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("allnullp", dAllnullP.ToString("p"));
|
||
double dmp = Convert.ToDouble(drNan2.Length + drNan1.Length) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("maleP", dmp.ToString("p"));
|
||
double dfp = Convert.ToDouble(drNv2.Length + drNv1.Length) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("femaleP", dfp.ToString("p"));
|
||
double dallp = Convert.ToDouble(iAll) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("allP", dallp.ToString("p"));
|
||
//------------------------------------
|
||
|
||
//团检年龄分布表
|
||
re.RegisterData(nlfbtDt, "nlFbt");
|
||
//团检年龄分布图
|
||
re.RegisterData(nlfbtDtChart, "nlFbtChart");
|
||
//体检分组项目表
|
||
re.RegisterData(dtProjectGroup, "dtProjectGroup");
|
||
//健康问题表
|
||
re.RegisterData(dtUnhealthy, "dtUnhealthy");
|
||
//健康问题图表1
|
||
re.RegisterData(dtUnhealthyChart1, "dtUnhealthyChart1");
|
||
//健康问题图表2
|
||
re.RegisterData(dtUnhealthyChart2, "dtUnhealthyChart2");
|
||
//健康问题图表3
|
||
re.RegisterData(dtUnhealthyChart3, "dtUnhealthyChart3");
|
||
//生活方式情况人员分布表
|
||
re.RegisterData(dtLifestyle, "dtLifestyle");
|
||
//生活方式情况人员分布图表
|
||
re.RegisterData(dtLifestyleChart, "dtLifestyleChart");
|
||
//健康问题描述及建议表
|
||
re.RegisterData(dtDescribe, "dtDescribe");
|
||
//女性健康问题人员分布表
|
||
re.RegisterData(dtFemaleProblem, "dtFemaleProblem");
|
||
//女性健康问题人员分布图表
|
||
re.RegisterData(dtFemaleProblemChart, "dtFemaleProblemChart");
|
||
//男性健康问题人员分布表
|
||
re.RegisterData(dtMaleProblem, "dtMaleProblem");
|
||
//男性健康问题人员分布图表
|
||
re.RegisterData(dtMaleProblemChart, "dtMaleProblemChart");
|
||
//体检结果汇总分析表
|
||
re.RegisterData(dtInfo, "dtInfo");
|
||
|
||
re.RegisterData(jkztzkDt, "jkztzkDt");
|
||
re.RegisterData(fb3, "fb3");
|
||
|
||
if (fb3TbNvDt.Rows.Count==0)
|
||
{
|
||
re.SetParameterValue("fb3TbNvDt_bj", "false");
|
||
fb3TbNvDt.Rows.Add(new object[] { "无", "人次", 1 });
|
||
fb3TbNvDt.Rows.Add(new object[] { "无", "检出率", 2 });
|
||
}
|
||
else
|
||
{
|
||
re.SetParameterValue("fb3TbNvDt_bj", "true");
|
||
}
|
||
re.RegisterData(fb3TbNvDt, "fb3TbNvDt");
|
||
re.RegisterData(fb3TbNanDt, "fb3TbNanDt");
|
||
re.RegisterData(txnrNewDt, "txnrNewDt");
|
||
|
||
re.RegisterData(hzfxDt, "hzfxDt");
|
||
|
||
//DataTable dtcs = new DataTable();
|
||
//dtcs.Columns.Add("name", Type.GetType("System.String"));
|
||
//dtcs.Columns.Add("sex", Type.GetType("System.String"));
|
||
//dtcs.Columns.Add("count", Type.GetType("System.Int32"));
|
||
|
||
//dtcs.Rows.Add(new object[] { "超重/肥胖" ,"人次" ,8 });
|
||
//dtcs.Rows.Add(new object[] { "超重/肥胖", "检出率", 57.14 });
|
||
|
||
//dtcs.Rows.Add(new object[] { "脂肪肝", "人次", 7 });
|
||
//dtcs.Rows.Add(new object[] { "脂肪肝", "检出率", 30.14 });
|
||
|
||
//dtcs.Rows.Add(new object[] { "高血压", "人次", 6 });
|
||
//dtcs.Rows.Add(new object[] { "高血压", "检出率", 51.14 });
|
||
|
||
//dtcs.Rows.Add(new object[] { "糖尿病", "人次", 11 });
|
||
//dtcs.Rows.Add(new object[] { "糖尿病", "检出率", 87.14 });
|
||
|
||
//dtcs.Rows.Add(new object[] { "脂肪肝", "人次", 9 });
|
||
//dtcs.Rows.Add(new object[] { "脂肪肝", "检出率", 75.11 });
|
||
|
||
//dtcs.Rows.Add(new object[] { "脑溢血", "人次", 1 });
|
||
//dtcs.Rows.Add(new object[] { "脑溢血", "检出率", 3.14 });
|
||
|
||
|
||
|
||
|
||
re.Preview = previewControl1;
|
||
re.Refresh();
|
||
re.Show();
|
||
|
||
}
|
||
else
|
||
{
|
||
if (re.Preview != null)
|
||
{
|
||
re.Preview.Clear();
|
||
re.Clear();
|
||
re.Refresh();
|
||
re.Show(false);
|
||
}
|
||
MessageBox.Show("无数据!");
|
||
return;
|
||
}
|
||
|
||
//thtfzbBindingSource.DataSource = service.GetListByhtbm(o.htbm);
|
||
|
||
//this.cbbfz1.DataSource = service.GetListByhtbm(o.htbm);
|
||
//this.cbbfz2.DataSource = service.GetListByhtbm(o.htbm);
|
||
//dataGridView2_CellClick(null, null);
|
||
//dataGridView5_CellClick(null, null);
|
||
//dataGridView9.DataSource = "";
|
||
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 统计健康问题人数
|
||
/// 2023-09-13 xulu 添加方法
|
||
/// </summary>
|
||
/// <param name="listUnhealthy">统计列表</param>
|
||
/// <param name="index">索引</param>
|
||
/// <param name="iType">类型</param>
|
||
/// <param name="iAllPerson">总人数</param>
|
||
/// <param name="strName">体检人员姓名</param>
|
||
public void statisticCount(ref List<unhealthyStatistics> listUnhealthy,int index,int iType,int iAllPerson,string strName)
|
||
{
|
||
switch(iType)
|
||
{
|
||
//35岁及以上男性
|
||
case 0:
|
||
listUnhealthy[index].maleC1 += 1;
|
||
listUnhealthy[index].maleP1 = listUnhealthy[index].maleC1 / Convert.ToDouble(iAllPerson);
|
||
listUnhealthy[index].strMaleName += strName+",";
|
||
break;
|
||
//35岁及以上女性
|
||
case 1:
|
||
listUnhealthy[index].femaleC1 += 1;
|
||
listUnhealthy[index].femaleP1 = listUnhealthy[index].femaleC1 / Convert.ToDouble(iAllPerson);
|
||
listUnhealthy[index].strFemaleName += strName + ",";
|
||
break;
|
||
//35岁以下男性
|
||
case 2:
|
||
listUnhealthy[index].maleC2 += 1;
|
||
listUnhealthy[index].maleP2 = listUnhealthy[index].maleC2 / Convert.ToDouble(iAllPerson);
|
||
listUnhealthy[index].strMaleName += strName + ",";
|
||
break;
|
||
//35岁以下女性
|
||
case 3:
|
||
listUnhealthy[index].femaleC2 += 1;
|
||
listUnhealthy[index].femaleP2 = listUnhealthy[index].femaleC2 / Convert.ToDouble(iAllPerson);
|
||
listUnhealthy[index].strFemaleName += strName + ",";
|
||
break;
|
||
}
|
||
listUnhealthy[index].allCount += 1;
|
||
listUnhealthy[index].allPercent = listUnhealthy[index].maleP1 + listUnhealthy[index].maleP2 + listUnhealthy[index].femaleP1 + listUnhealthy[index].femaleP2;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 累计项目检查人数
|
||
/// 2023-09-14 xulu 添加方法
|
||
/// </summary>
|
||
/// <param name="iSex">性别,0:男,1:女</param>
|
||
/// <param name="listUnhealthy">统计列表</param>
|
||
/// <param name="index">索引</param>
|
||
public void calculatePerson(int iSex, ref List<unhealthyStatistics> listUnhealthy,int index)
|
||
{
|
||
if (iSex == 0)
|
||
{
|
||
listUnhealthy[index].iMaleExamPersonCount += 1;
|
||
}
|
||
else
|
||
{
|
||
listUnhealthy[index].iFemaleExamPersonCount += 1;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据htbm获取体检结果信息
|
||
/// 2023-10-08 xulu
|
||
/// </summary>
|
||
/// <param name="iHtbm"></param>
|
||
/// <param name="listUnhealthy"></param>
|
||
/// <param name="listLifestyle"></param>
|
||
/// <param name="dtInfo"></param>
|
||
public void getResult(int iHtbm,ref List<unhealthyStatistics> listUnhealthy,ref List<unhealthyStatistics> listLifestyle,DataTable dtInfo,int iState=0)
|
||
{
|
||
//临时体检结果,根据合同编码查询出所有体检人员的体检结果
|
||
DataTable dtTempResult = ServiceContainer.GetService<IZongJian>().GetExamResultByHtbm(iHtbm);
|
||
if(iState == 0)
|
||
{
|
||
listUnhealthy = new List<unhealthyStatistics>();
|
||
string strProblems = "超重BMI≥24,腰围(男>90 女>85),葡萄糖偏高,血压偏高,心律不齐,肾囊肿,肝囊肿,胆囊息肉,肝功异常,甘油三酯异常,胆固醇异常,尿酸,尿素,肌酐,肿瘤标志物,血常规异常,幽门螺旋杆菌抗体异常,脂肪肝,肺炎,肺结节,肺纹理增粗,肺占位,颈椎退行性改变,颈椎骨质增生,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arr = strProblems.Split(',');
|
||
for (int i = 0; i < arr.Length; i++)
|
||
{
|
||
unhealthyStatistics unhealthy = new unhealthyStatistics();
|
||
unhealthy.healthProblem = arr[i];
|
||
listUnhealthy.Add(unhealthy);
|
||
}
|
||
listLifestyle = new List<unhealthyStatistics>();
|
||
string strLifestyle = "吸烟,饮酒,家族史,规律运动,不运动,饮食均衡,嗜油腻,高血压,糖尿病,脑卒中,冠心病,慢支气管炎";
|
||
string[] arrLifestyle = strLifestyle.Split(',');
|
||
for (int i = 0; i < arrLifestyle.Length; i++)
|
||
{
|
||
unhealthyStatistics lifestyle = new unhealthyStatistics();
|
||
lifestyle.healthProblem = arrLifestyle[i];
|
||
listLifestyle.Add(lifestyle);
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < dtInfo.Rows.Count; i++)
|
||
{
|
||
//姓名
|
||
string strName = dtInfo.Rows[i]["姓名"].ToString();
|
||
//性别
|
||
int iSex = dtInfo.Rows[i]["性别"].ToString() == "男" ? 0 : 1;
|
||
//年龄是否大于等于35
|
||
bool bAge = Convert.ToInt32(dtInfo.Rows[i]["年龄"]) >= 35 ? true : false;
|
||
//默认:35岁及以上男性
|
||
int iType = 0;
|
||
//35岁及以上女性
|
||
if (bAge && iSex == 1)
|
||
{
|
||
iType = 1;
|
||
}
|
||
//35岁以下男性
|
||
else if (!bAge && iSex == 0)
|
||
{
|
||
iType = 2;
|
||
}
|
||
//35岁以下女性
|
||
else if (!bAge && iSex == 1)
|
||
{
|
||
iType = 3;
|
||
}
|
||
//超重BMI≥24 索引:0
|
||
string strResult = dtInfo.Rows[i]["结果分析"].ToString();
|
||
if (strResult.IndexOf("体重指数>24") != -1 || strResult.IndexOf("体重指数>28") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 0, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 0);
|
||
|
||
//腰围(男>90 女>85) 索引:1
|
||
DataRow drjg = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '腹围' ").FirstOrDefault();
|
||
if (drjg != null && drjg["jg"].ToString() != "")
|
||
{
|
||
string strJg = drjg["jg"].ToString();
|
||
if (strJg.IndexOf("cm")!=-1)
|
||
{
|
||
strJg = strJg.Substring(0, strJg.Length-2);
|
||
}
|
||
if ((iSex == 0 && Convert.ToDouble(strJg) > 90) || (iSex == 1 && Convert.ToDouble(strJg) > 85))
|
||
{
|
||
statisticCount(ref listUnhealthy, 1, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 1);
|
||
}
|
||
|
||
//葡萄糖偏高 索引:2
|
||
if (strResult.IndexOf("葡萄糖(葡萄糖氧化酶)偏高") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 2, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 2);
|
||
//血压偏高 索引:3
|
||
if (strResult.IndexOf("血压偏高") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 3, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 3);
|
||
//心律不齐 索引:4
|
||
if (strResult.IndexOf("心律不齐") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 4, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 4);
|
||
//肾囊肿 索引:5
|
||
if (strResult.IndexOf("肾囊肿") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 5, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 5);
|
||
//肝囊肿 索引:6
|
||
if (strResult.IndexOf("肝囊肿") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 6, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 6);
|
||
//胆囊息肉 索引:7
|
||
if (strResult.IndexOf("胆囊息肉") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 7, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 7);
|
||
//肝功异常 索引:8
|
||
if (strResult.IndexOf("丙氨酸氨基转移酶") != -1 || strResult.IndexOf("天门冬氨酸氨基转移酶") != -1 ||
|
||
strResult.IndexOf("-谷氨酷转移酶") != -1 || strResult.IndexOf("碱性酸酶") != -1 ||
|
||
strResult.IndexOf("总蛋白") != -1 || strResult.IndexOf("白蛋白") != -1 ||
|
||
strResult.IndexOf("球蛋白") != -1 || strResult.IndexOf("白蛋白/球蛋白比值") != -1 ||
|
||
strResult.IndexOf("谷草/谷丙转氨酶") != -1 || strResult.IndexOf("总胆红素") != -1 ||
|
||
strResult.IndexOf("直接胆红素") != -1 || strResult.IndexOf("间接胆红素") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 8, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 8);
|
||
//甘油三酯异常 索引:9
|
||
if (strResult.IndexOf("甘油三酯") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 9, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 9);
|
||
//胆固醇异常 索引:10
|
||
if (strResult.IndexOf("胆固醇") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 10, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 10);
|
||
//尿酸 索引:11
|
||
if (strResult.IndexOf("尿酸") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 11, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 11);
|
||
//尿素 索引:12
|
||
if (strResult.IndexOf("尿素") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 12, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 12);
|
||
//肌酐 索引:13
|
||
if (strResult.IndexOf("肌酐") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 13, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 13);
|
||
//肿瘤标志物 索引:14
|
||
if (strResult.IndexOf("肿瘤检测") != -1 || strResult.IndexOf("肿瘤项目") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 14, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 14);
|
||
//血常规异常 索引:15
|
||
if (strResult.IndexOf("血常规") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 15, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 15);
|
||
//幽门螺旋杆菌抗体异常 索引:16
|
||
if (strResult.IndexOf("幽门螺旋杆菌") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 16, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 16);
|
||
//脂肪肝 索引:17
|
||
if (strResult.IndexOf("脂肪肝") != -1)
|
||
{
|
||
statisticCount(ref listUnhealthy, 17, iType, zjrs, strName);
|
||
}
|
||
calculatePerson(iSex, ref listUnhealthy, 17);
|
||
//肺炎 索引:18
|
||
DataRow drjg181 = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '胸部正、侧位片' ").FirstOrDefault();
|
||
DataRow drjg182 = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '双肺部CT' ").FirstOrDefault();
|
||
bool b181 = false;
|
||
bool b182 = false;
|
||
//肺结节 索引:19
|
||
bool b191 = false;
|
||
bool b192 = false;
|
||
//肺纹理增粗 索引:20
|
||
bool b201 = false;
|
||
bool b202 = false;
|
||
//肺占位 索引:21
|
||
bool b211 = false;
|
||
bool b212 = false;
|
||
|
||
if (drjg181 != null && drjg181["jg"] != null)
|
||
{
|
||
if (drjg181["jg"].ToString().IndexOf("肺炎") != -1)
|
||
{
|
||
b181 = true;
|
||
}
|
||
if (drjg181["jg"].ToString().IndexOf("肺结节") != -1)
|
||
{
|
||
b191 = true;
|
||
}
|
||
if (drjg181["jg"].ToString().IndexOf("肺纹理增粗") != -1 || drjg181["jg"].ToString().IndexOf("肺纹理增多") != -1)
|
||
{
|
||
b201 = true;
|
||
}
|
||
if (drjg181["jg"].ToString().IndexOf("肺占位") != -1)
|
||
{
|
||
b211 = true;
|
||
}
|
||
}
|
||
if (drjg182 != null && drjg182["jg"] != null)
|
||
{
|
||
if (drjg182["jg"].ToString().IndexOf("肺炎") != -1)
|
||
{
|
||
b182 = true;
|
||
}
|
||
if (drjg182["jg"].ToString().IndexOf("肺结节") != -1)
|
||
{
|
||
b192 = true;
|
||
}
|
||
if (drjg182["jg"].ToString().IndexOf("肺纹理增粗") != -1 || drjg182["jg"].ToString().IndexOf("肺纹理增多") != -1)
|
||
{
|
||
b202 = true;
|
||
}
|
||
if (drjg182["jg"].ToString().IndexOf("肺占位") != -1)
|
||
{
|
||
b212 = true;
|
||
}
|
||
}
|
||
if (b181 || b182)
|
||
{
|
||
statisticCount(ref listUnhealthy, 18, iType, zjrs, strName);
|
||
}
|
||
if (b191 || b192)
|
||
{
|
||
statisticCount(ref listUnhealthy, 19, iType, zjrs, strName);
|
||
}
|
||
if (b201 || b202)
|
||
{
|
||
statisticCount(ref listUnhealthy, 20, iType, zjrs, strName);
|
||
}
|
||
if (b211 || b212)
|
||
{
|
||
statisticCount(ref listUnhealthy, 21, iType, zjrs, strName);
|
||
}
|
||
if (drjg181 != null || drjg182 != null)
|
||
{
|
||
calculatePerson(iSex, ref listUnhealthy, 18);
|
||
calculatePerson(iSex, ref listUnhealthy, 19);
|
||
calculatePerson(iSex, ref listUnhealthy, 20);
|
||
calculatePerson(iSex, ref listUnhealthy, 21);
|
||
}
|
||
|
||
//颈椎退行性改变 索引:22
|
||
DataRow drjg221 = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '颈部/腰部' ").FirstOrDefault();
|
||
DataRow drjg222 = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '颈部CT' ").FirstOrDefault();
|
||
DataRow drjg223 = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '腰部CT' ").FirstOrDefault();
|
||
bool b221 = false;
|
||
bool b222 = false;
|
||
|
||
bool b231 = false;
|
||
bool b232 = false;
|
||
|
||
bool b241 = false;
|
||
bool b243 = false;
|
||
|
||
bool b251 = false;
|
||
bool b253 = false;
|
||
|
||
if (drjg221 != null && drjg221["jg"] != null)
|
||
{
|
||
if (drjg221["jg"].ToString().IndexOf("颈椎退行性改变") != -1 || drjg221["jg"].ToString().IndexOf("颈椎轻度退行性改变") != -1)
|
||
{
|
||
b221 = true;
|
||
}
|
||
//颈椎骨质增生 索引:23
|
||
if (drjg221["jg"].ToString().IndexOf("颈椎骨质增生") != -1 || drjg221["jg"].ToString().IndexOf("颈椎轻度骨质增生") != -1)
|
||
{
|
||
b231 = true;
|
||
}
|
||
//腰椎退行性改变 索引:24
|
||
if (drjg221["jg"].ToString().IndexOf("腰椎退行性改变") != -1 || drjg221["jg"].ToString().IndexOf("腰椎轻度退行性改变") != -1)
|
||
{
|
||
b241 = true;
|
||
}
|
||
//腰椎骨质增生 索引:25
|
||
if (drjg221["jg"].ToString().IndexOf("腰椎骨质增生") != -1 || drjg221["jg"].ToString().IndexOf("腰椎轻度骨质增生") != -1)
|
||
{
|
||
b251 = true;
|
||
}
|
||
}
|
||
if (drjg222 != null && drjg222["jg"] != null)
|
||
{
|
||
if (drjg222["jg"].ToString().IndexOf("退行性改变") != -1)
|
||
{
|
||
b222 = true;
|
||
}
|
||
//颈椎骨质增生 索引:23
|
||
if (drjg222["jg"].ToString().IndexOf("骨质增生") != -1)
|
||
{
|
||
b232 = true;
|
||
}
|
||
}
|
||
if (drjg223 != null && drjg223["jg"] != null)
|
||
{
|
||
//腰椎退行性改变 索引:24
|
||
if (drjg223["jg"].ToString().IndexOf("退行性改变") != -1)
|
||
{
|
||
b243 = true;
|
||
}
|
||
//腰椎骨质增生 索引:25
|
||
if (drjg223["jg"].ToString().IndexOf("骨质增生") != -1)
|
||
{
|
||
b253 = true;
|
||
}
|
||
}
|
||
|
||
if (b221 || b222)
|
||
{
|
||
statisticCount(ref listUnhealthy, 22, iType, zjrs, strName);
|
||
}
|
||
if(b231 || b232)
|
||
{
|
||
statisticCount(ref listUnhealthy, 23, iType, zjrs, strName);
|
||
}
|
||
if(b241 || b243)
|
||
{
|
||
statisticCount(ref listUnhealthy, 24, iType, zjrs, strName);
|
||
}
|
||
if (b251 || b253)
|
||
{
|
||
statisticCount(ref listUnhealthy, 25, iType, zjrs, strName);
|
||
}
|
||
|
||
if (drjg221 != null || drjg222 != null)
|
||
{
|
||
calculatePerson(iSex, ref listUnhealthy, 22);
|
||
calculatePerson(iSex, ref listUnhealthy, 23);
|
||
}
|
||
if (drjg221 != null || drjg223 != null)
|
||
{
|
||
calculatePerson(iSex, ref listUnhealthy, 24);
|
||
calculatePerson(iSex, ref listUnhealthy, 25);
|
||
}
|
||
//吸烟
|
||
DataRow drSmoke = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc like '%吸烟史%' ").FirstOrDefault();
|
||
if (drSmoke != null && drSmoke["jg"] != null)
|
||
{
|
||
if (drSmoke["jg"].ToString().IndexOf("无") == -1)
|
||
{
|
||
//dtLifestyle.Rows[iType]["smoke"] = Convert.ToInt32(dtLifestyle.Rows[iType]["smoke"]) + 1;
|
||
statisticCount(ref listLifestyle, 0, iType, zjrs, strName);
|
||
}
|
||
}
|
||
calculatePerson(iSex, ref listLifestyle, 0);
|
||
//饮酒
|
||
DataRow drDrink = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '饮酒史' ").FirstOrDefault();
|
||
if (drDrink != null && drDrink["jg"] != null)
|
||
{
|
||
if (drDrink["jg"].ToString().IndexOf("无") == -1)
|
||
{
|
||
//dtLifestyle.Rows[iType]["drink"] = Convert.ToInt32(dtLifestyle.Rows[iType]["drink"]) + 1;
|
||
statisticCount(ref listLifestyle, 1, iType, zjrs, strName);
|
||
}
|
||
}
|
||
calculatePerson(iSex, ref listLifestyle, 1);
|
||
//家族史
|
||
DataRow drFamily = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '家族史' ").FirstOrDefault();
|
||
if (drFamily != null && drFamily["jg"] != null)
|
||
{
|
||
if (drFamily["jg"].ToString().IndexOf("无") == -1)
|
||
{
|
||
//dtLifestyle.Rows[iType]["familyHistory"] = Convert.ToInt32(dtLifestyle.Rows[iType]["familyHistory"]) + 1;
|
||
statisticCount(ref listLifestyle, 2, iType, zjrs, strName);
|
||
}
|
||
}
|
||
calculatePerson(iSex, ref listLifestyle, 2);
|
||
//规律运动/不运动
|
||
DataRow drExercise = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '锻炼情况' ").FirstOrDefault();
|
||
if (drExercise != null && drExercise["jg"] != null)
|
||
{
|
||
if (drExercise["jg"].ToString().IndexOf("否") == -1)
|
||
{
|
||
//规律运动
|
||
//dtLifestyle.Rows[iType]["regularExercise"] = Convert.ToInt32(dtLifestyle.Rows[iType]["regularExercise"]) + 1;
|
||
statisticCount(ref listLifestyle, 3, iType, zjrs, strName);
|
||
}
|
||
else
|
||
{
|
||
//不运动
|
||
//dtLifestyle.Rows[iType]["noExercise"] = Convert.ToInt32(dtLifestyle.Rows[iType]["noExercise"]) + 1;
|
||
statisticCount(ref listLifestyle, 4, iType, zjrs, strName);
|
||
}
|
||
}
|
||
calculatePerson(iSex, ref listLifestyle, 3);
|
||
calculatePerson(iSex, ref listLifestyle, 4);
|
||
//嗜油腻/饮食均衡
|
||
DataRow drDiet = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '饮食情况' ").FirstOrDefault();
|
||
if (drDiet != null && drDiet["jg"] != null)
|
||
{
|
||
if (drDiet["jg"].ToString().IndexOf("嗜油") == -1)
|
||
{
|
||
//饮食均衡
|
||
//dtLifestyle.Rows[iType]["balanceDiet"] = Convert.ToInt32(dtLifestyle.Rows[iType]["balanceDiet"]) + 1;
|
||
statisticCount(ref listLifestyle, 5, iType, zjrs, strName);
|
||
}
|
||
else
|
||
{
|
||
//嗜油腻
|
||
//dtLifestyle.Rows[iType]["greasyDiet"] = Convert.ToInt32(dtLifestyle.Rows[iType]["greasyDiet"]) + 1;
|
||
statisticCount(ref listLifestyle, 6, iType, zjrs, strName);
|
||
}
|
||
}
|
||
//2023-10-24 xulu 新增高血压,糖尿病,脑卒中,冠心病,慢支气管炎
|
||
DataRow drAnamnesis = dtTempResult.Select("tm =" + dtInfo.Rows[i]["条码"] + " and jcxmmc = '既往病史' ").FirstOrDefault();
|
||
if(drAnamnesis != null && drAnamnesis["jg"] != null)
|
||
{
|
||
if (drAnamnesis["jg"].ToString().IndexOf("高血压") != -1)
|
||
{
|
||
//高血压
|
||
statisticCount(ref listLifestyle, 7, iType, zjrs, strName);
|
||
}
|
||
if(drAnamnesis["jg"].ToString().IndexOf("糖尿病") != -1)
|
||
{
|
||
//糖尿病
|
||
statisticCount(ref listLifestyle, 8, iType, zjrs, strName);
|
||
}
|
||
if (drAnamnesis["jg"].ToString().IndexOf("脑卒中") != -1)
|
||
{
|
||
//脑卒中
|
||
statisticCount(ref listLifestyle, 9, iType, zjrs, strName);
|
||
}
|
||
if (drAnamnesis["jg"].ToString().IndexOf("冠心病") != -1)
|
||
{
|
||
//冠心病
|
||
statisticCount(ref listLifestyle, 10, iType, zjrs, strName);
|
||
}
|
||
if (drAnamnesis["jg"].ToString().IndexOf("慢支气管炎") != -1)
|
||
{
|
||
//慢支气管炎
|
||
statisticCount(ref listLifestyle, 11, iType, zjrs, strName);
|
||
}
|
||
}
|
||
calculatePerson(iSex, ref listLifestyle, 5);
|
||
calculatePerson(iSex, ref listLifestyle, 6);
|
||
calculatePerson(iSex, ref listLifestyle, 7);
|
||
calculatePerson(iSex, ref listLifestyle, 8);
|
||
calculatePerson(iSex, ref listLifestyle, 9);
|
||
calculatePerson(iSex, ref listLifestyle, 10);
|
||
calculatePerson(iSex, ref listLifestyle, 11);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 年度疾病情况汇总
|
||
/// 2023-10-07 xulu
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
if (dataGridView1.CurrentRow == null || dataGridView1.CurrentRow.Index < 0)
|
||
{
|
||
MessageBox.Show("请选择单位!");
|
||
return;
|
||
}
|
||
int dt1 = dateTimePicker1.Value.Year;
|
||
int dt2 = dateTimePicker2.Value.Year;
|
||
|
||
t_ht o = dataGridView1.Rows[dataGridView1.CurrentRow.Index].DataBoundItem as t_ht;
|
||
//客户名称
|
||
khmc = o.htbj.ToString();
|
||
if (o.khbianma.ToString().IndexOf("济南二机床") != -1)
|
||
{
|
||
khmc = "济南二机床" + khmc;
|
||
}
|
||
string strTitle = khmc + "单位";
|
||
string strSubTitle = dt1.ToString() + "年和" + dt2.ToString() + "年查体数据对比";
|
||
|
||
MemoryStream ms = new MemoryStream();
|
||
XWPFDocument m_Docx = new XWPFDocument();
|
||
//m_Docx = CreatDocxTable();
|
||
XWPFParagraph p0 = m_Docx.CreateParagraph();
|
||
p0.Alignment = ParagraphAlignment.CENTER; //字体居中
|
||
XWPFRun r0 = p0.CreateRun();
|
||
r0.FontSize = 18;
|
||
r0.SetFontFamily("黑体", FontCharRange.None); //设置黑体
|
||
r0.SetText(strTitle);
|
||
r0.AddCarriageReturn();
|
||
r0 = p0.CreateRun();
|
||
r0.FontSize = 18;
|
||
r0.SetFontFamily("黑体", FontCharRange.None); //设置黑体
|
||
r0.SetText(strSubTitle);
|
||
|
||
XWPFParagraph p1 = m_Docx.CreateParagraph();
|
||
XWPFRun r1 = p1.CreateRun();
|
||
r1.FontSize = 16;
|
||
r1.IsBold = true;
|
||
r1.SetFontFamily("黑体", FontCharRange.None); //设置黑体
|
||
r1.SetText("一、单位基本信息统计");
|
||
|
||
XWPFParagraph p2 = m_Docx.CreateParagraph();
|
||
XWPFRun r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("1.单位基本信息");
|
||
XWPFTable table = m_Docx.CreateTable(2, 4);
|
||
//列宽设置
|
||
for(int i =0;i< 2;i++)
|
||
{
|
||
for(int j = 0;j<4;j++)
|
||
{
|
||
CT_TcPr m_Pr = table.GetRow(i).GetCell(j).GetCTTc().AddNewTcPr();
|
||
m_Pr.tcW = new CT_TblWidth();
|
||
if(j ==0)
|
||
{
|
||
m_Pr.tcW.w = "400";//单元格宽
|
||
}
|
||
else
|
||
{
|
||
m_Pr.tcW.w = "2000";//单元格宽
|
||
}
|
||
m_Pr.tcW.type = ST_TblWidth.dxa;
|
||
}
|
||
}
|
||
//合并列
|
||
table.GetRow(0).MergeCells(1, 3);
|
||
//填充内容
|
||
table.GetRow(0).GetCell(0).SetText("单位名称");
|
||
table.GetRow(0).GetCell(1).SetText(khmc);
|
||
table.GetRow(1).GetCell(0).SetText("联系单位");
|
||
table.GetRow(1).GetCell(1).SetText("职工医院社区科");
|
||
table.GetRow(1).GetCell(2).SetText("联系电话");
|
||
table.GetRow(1).GetCell(3).SetText("81617785");
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("2.该单位两年体检人数按年龄段分布情况如下所示:");
|
||
XWPFTable t1 = m_Docx.CreateTable(4, 8);
|
||
t1.Width = 5500;
|
||
//列宽设置
|
||
for (int i = 0; i < 4; i++)
|
||
{
|
||
for (int j = 0; j < 8; j++)
|
||
{
|
||
CT_TcPr m_Pr = t1.GetRow(i).GetCell(j).GetCTTc().AddNewTcPr();
|
||
m_Pr.tcW = new CT_TblWidth();
|
||
m_Pr.tcW.w = "800";//单元格宽
|
||
m_Pr.tcW.type = ST_TblWidth.dxa;
|
||
}
|
||
}
|
||
//合并行
|
||
MYMergeRows(t1, 0, 1, 0);
|
||
MYMergeRows(t1, 0, 1, 1);
|
||
MYMergeRows(t1, 0, 1, 2);
|
||
MYMergeRows(t1, 0, 1, 3);
|
||
MYMergeRows(t1, 0, 1, 7);
|
||
MYMergeRows(t1, 1, 3, 7);
|
||
//合并列
|
||
t1.GetRow(0).MergeCells(4, 6);
|
||
|
||
//填充内容
|
||
t1.GetRow(0).GetCell(0).SetText("年份");
|
||
t1.GetRow(0).GetCell(1).SetText("体检人数");
|
||
t1.GetRow(0).GetCell(2).SetText("男");
|
||
t1.GetRow(0).GetCell(3).SetText("女");
|
||
t1.GetRow(0).GetCell(4).SetText("年龄分布");
|
||
t1.GetRow(0).GetCell(5).SetText("总人数同比");
|
||
t1.GetRow(2).GetCell(0).SetText(dt1.ToString());
|
||
t1.GetRow(3).GetCell(0).SetText(dt2.ToString());
|
||
//t1.GetRow(4).GetCell(0).SetText("合计");
|
||
t1.GetRow(1).GetCell(4).SetText("40岁以上");
|
||
t1.GetRow(1).GetCell(5).SetText("35-40岁");
|
||
t1.GetRow(1).GetCell(6).SetText("35岁以下");
|
||
|
||
DataTable dtPerson = ServiceContainer.GetService<IZongJian>().GetPersonInfo(o.htbj.ToString(), dt1, dt2);
|
||
//体检人数
|
||
DataRow[] drP1 = dtPerson.Select("nd =" + dt1);
|
||
DataRow[] drP2 = dtPerson.Select("nd =" + dt2);
|
||
//男性人数
|
||
DataRow[] drNan1 = dtPerson.Select("xb=0 and nd ="+dt1);
|
||
DataRow[] drNan2 = dtPerson.Select("xb=0 and nd ="+dt2);
|
||
//女性人数
|
||
DataRow[] drNv1 = dtPerson.Select("xb=1 and nd =" + dt1);
|
||
DataRow[] drNv2 = dtPerson.Select("xb=1 and nd =" + dt2);
|
||
//40岁以上
|
||
DataRow[] drAge1 = dtPerson.Select("nl>40 and nd =" + dt1);
|
||
DataRow[] drAge2 = dtPerson.Select("nl>40 and nd =" + dt2);
|
||
//35-40岁
|
||
DataRow[] drAge3 = dtPerson.Select("nl<=40 and nl>=35 and nd =" + dt1);
|
||
DataRow[] drAge4 = dtPerson.Select("nl<=40 and nl>=35 and nd =" + dt2);
|
||
//35岁以下
|
||
DataRow[] drAge5 = dtPerson.Select("nl<35 and nd =" + dt1);
|
||
DataRow[] drAge6 = dtPerson.Select("nl<35 and nd =" + dt2);
|
||
//同比
|
||
double dP;
|
||
if (drP1.Length == 0)
|
||
{
|
||
dP = Convert.ToDouble(drP2.Length);
|
||
}
|
||
else
|
||
{
|
||
dP = Convert.ToDouble(drP2.Length - drP1.Length) / Convert.ToDouble(drP1.Length);
|
||
}
|
||
string strDp = dP.ToString("p");
|
||
if(dP>0)
|
||
{
|
||
strDp += " ↑";
|
||
}
|
||
else if(dP == 0)
|
||
{
|
||
strDp += " -";
|
||
}
|
||
else
|
||
{
|
||
strDp += " ↓";
|
||
}
|
||
t1.GetRow(2).GetCell(1).SetText(drP1.Length.ToString());
|
||
t1.GetRow(3).GetCell(1).SetText(drP2.Length.ToString());
|
||
t1.GetRow(2).GetCell(2).SetText(drNan1.Length.ToString());
|
||
t1.GetRow(3).GetCell(2).SetText(drNan2.Length.ToString());
|
||
t1.GetRow(2).GetCell(3).SetText(drNv1.Length.ToString());
|
||
t1.GetRow(3).GetCell(3).SetText(drNv2.Length.ToString());
|
||
t1.GetRow(2).GetCell(4).SetText(drAge1.Length.ToString());
|
||
t1.GetRow(3).GetCell(4).SetText(drAge2.Length.ToString());
|
||
t1.GetRow(2).GetCell(5).SetText(drAge3.Length.ToString());
|
||
t1.GetRow(3).GetCell(5).SetText(drAge4.Length.ToString());
|
||
t1.GetRow(2).GetCell(6).SetText(drAge5.Length.ToString());
|
||
t1.GetRow(3).GetCell(6).SetText(drAge6.Length.ToString());
|
||
t1.GetRow(1).GetCell(7).SetText(strDp);
|
||
//健康问题列表
|
||
List<unhealthyStatistics> listUnhealthy1 = new List<unhealthyStatistics>();
|
||
List<unhealthyStatistics> listUnhealthy2 = new List<unhealthyStatistics>();
|
||
|
||
//生活方式分布
|
||
List<unhealthyStatistics> listLifestyle1 = new List<unhealthyStatistics>();
|
||
List<unhealthyStatistics> listLifestyle2 = new List<unhealthyStatistics>();
|
||
//获取体检人员体检诊断
|
||
//2023-10-20 xulu 修改年度数据为0报错问题
|
||
string strHtbm1 = "0";
|
||
if(drP1.Length>0)
|
||
{
|
||
strHtbm1 = drP1[0]["htbm"].ToString();
|
||
}
|
||
string strHtbm2 = "0";
|
||
if (drP2.Length > 0)
|
||
{
|
||
strHtbm2 = drP2[0]["htbm"].ToString();
|
||
}
|
||
DataTable dtInfo1 = ServiceContainer.GetService<IZongJian>().GetTTHZJG(strHtbm1);
|
||
getResult(Convert.ToInt32(strHtbm1), ref listUnhealthy1, ref listLifestyle1, dtInfo1);
|
||
DataTable dtInfo2 = ServiceContainer.GetService<IZongJian>().GetTTHZJG(strHtbm2);
|
||
getResult(Convert.ToInt32(strHtbm2), ref listUnhealthy2, ref listLifestyle2, dtInfo2);
|
||
//---------修改年度数据为0报错问题 end----------------
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("3.两年健康问题人员分布对比:");
|
||
XWPFTable t2 = m_Docx.CreateTable(29, 12);
|
||
t2.Width = 5500;
|
||
MYMergeRows(t2, 0, 2, 0);
|
||
MYMergeRows(t2, 0, 2, 11);
|
||
MYMergeRows(t2, 1, 2, 5);
|
||
MYMergeRows(t2, 1, 2, 10);
|
||
|
||
t2.GetRow(0).MergeCells(1, 5);
|
||
t2.GetRow(0).MergeCells(2, 6);
|
||
t2.GetRow(1).MergeCells(1, 2);
|
||
t2.GetRow(1).MergeCells(2, 3);
|
||
t2.GetRow(1).MergeCells(4, 5);
|
||
t2.GetRow(1).MergeCells(5, 6);
|
||
|
||
t2.GetRow(0).GetCell(0).SetText("项目");
|
||
t2.GetRow(0).GetCell(1).SetText(dt1.ToString()+"年");
|
||
t2.GetRow(0).GetCell(2).SetText(dt2.ToString()+"年");
|
||
t2.GetRow(0).GetCell(3).SetText("同比");
|
||
t2.GetRow(1).GetCell(1).SetText("35岁及以上");
|
||
t2.GetRow(1).GetCell(2).SetText("35岁以下");
|
||
t2.GetRow(1).GetCell(3).SetText("合计");
|
||
t2.GetRow(1).GetCell(4).SetText("35岁及以上");
|
||
t2.GetRow(1).GetCell(5).SetText("35岁以下");
|
||
t2.GetRow(1).GetCell(6).SetText("合计");
|
||
t2.GetRow(2).GetCell(1).SetText("男性");
|
||
t2.GetRow(2).GetCell(2).SetText("女性");
|
||
t2.GetRow(2).GetCell(3).SetText("男性");
|
||
t2.GetRow(2).GetCell(4).SetText("女性");
|
||
t2.GetRow(2).GetCell(6).SetText("男性");
|
||
t2.GetRow(2).GetCell(7).SetText("女性");
|
||
t2.GetRow(2).GetCell(8).SetText("男性");
|
||
t2.GetRow(2).GetCell(9).SetText("女性");
|
||
|
||
for(int i=0;i<listUnhealthy1.Count;i++)
|
||
{
|
||
t2.GetRow(i + 3).GetCell(0).SetText(listUnhealthy1[i].healthProblem);
|
||
t2.GetRow(i + 3).GetCell(1).SetText(listUnhealthy1[i].maleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(2).SetText(listUnhealthy1[i].femaleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(3).SetText(listUnhealthy1[i].maleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(4).SetText(listUnhealthy1[i].femaleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(5).SetText(listUnhealthy1[i].allCount.ToString());
|
||
}
|
||
for (int i = 0; i < listUnhealthy2.Count; i++)
|
||
{
|
||
t2.GetRow(i + 3).GetCell(6).SetText(listUnhealthy2[i].maleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(7).SetText(listUnhealthy2[i].femaleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(8).SetText(listUnhealthy2[i].maleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(9).SetText(listUnhealthy2[i].femaleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(10).SetText(listUnhealthy2[i].allCount.ToString());
|
||
//计算同比
|
||
if(listUnhealthy1[i].allCount ==0)
|
||
{
|
||
dP = Convert.ToDouble(listUnhealthy2[i].allCount);
|
||
}
|
||
else
|
||
{
|
||
dP = Convert.ToDouble(listUnhealthy2[i].allCount - listUnhealthy1[i].allCount) / Convert.ToDouble(listUnhealthy1[i].allCount);
|
||
}
|
||
strDp = dP.ToString("p");
|
||
if (dP > 0)
|
||
{
|
||
strDp += " ↑";
|
||
}
|
||
else if (dP == 0)
|
||
{
|
||
strDp += " -";
|
||
}
|
||
else
|
||
{
|
||
strDp += " ↓";
|
||
}
|
||
t2.GetRow(i + 3).GetCell(11).SetText(strDp);
|
||
}
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("4.两年职工生活方式情况分布对比:");
|
||
XWPFTable t3 = m_Docx.CreateTable(15, 12);
|
||
t3.Width = 5500;
|
||
MYMergeRows(t3, 0, 2, 0);
|
||
MYMergeRows(t3, 0, 2, 11);
|
||
MYMergeRows(t3, 1, 2, 5);
|
||
MYMergeRows(t3, 1, 2, 10);
|
||
|
||
t3.GetRow(0).MergeCells(1, 5);
|
||
t3.GetRow(0).MergeCells(2, 6);
|
||
t3.GetRow(1).MergeCells(1, 2);
|
||
t3.GetRow(1).MergeCells(2, 3);
|
||
t3.GetRow(1).MergeCells(4, 5);
|
||
t3.GetRow(1).MergeCells(5, 6);
|
||
|
||
t3.GetRow(0).GetCell(0).SetText("项目");
|
||
t3.GetRow(0).GetCell(1).SetText(dt1.ToString() + "年");
|
||
t3.GetRow(0).GetCell(2).SetText(dt2.ToString() + "年");
|
||
t3.GetRow(0).GetCell(3).SetText("同比");
|
||
t3.GetRow(1).GetCell(1).SetText("35岁及以上");
|
||
t3.GetRow(1).GetCell(2).SetText("35岁以下");
|
||
t3.GetRow(1).GetCell(3).SetText("合计");
|
||
t3.GetRow(1).GetCell(4).SetText("35岁及以上");
|
||
t3.GetRow(1).GetCell(5).SetText("35岁以下");
|
||
t3.GetRow(1).GetCell(6).SetText("合计");
|
||
t3.GetRow(2).GetCell(1).SetText("男性");
|
||
t3.GetRow(2).GetCell(2).SetText("女性");
|
||
t3.GetRow(2).GetCell(3).SetText("男性");
|
||
t3.GetRow(2).GetCell(4).SetText("女性");
|
||
t3.GetRow(2).GetCell(6).SetText("男性");
|
||
t3.GetRow(2).GetCell(7).SetText("女性");
|
||
t3.GetRow(2).GetCell(8).SetText("男性");
|
||
t3.GetRow(2).GetCell(9).SetText("女性");
|
||
for (int i = 0; i < listLifestyle1.Count; i++)
|
||
{
|
||
t3.GetRow(i + 3).GetCell(0).SetText(listLifestyle1[i].healthProblem);
|
||
t3.GetRow(i + 3).GetCell(1).SetText(listLifestyle1[i].maleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(2).SetText(listLifestyle1[i].femaleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(3).SetText(listLifestyle1[i].maleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(4).SetText(listLifestyle1[i].femaleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(5).SetText(listLifestyle1[i].allCount.ToString());
|
||
}
|
||
for (int i = 0; i < listLifestyle2.Count; i++)
|
||
{
|
||
t3.GetRow(i + 3).GetCell(6).SetText(listLifestyle2[i].maleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(7).SetText(listLifestyle2[i].femaleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(8).SetText(listLifestyle2[i].maleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(9).SetText(listLifestyle2[i].femaleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(10).SetText(listLifestyle2[i].allCount.ToString());
|
||
//计算同比
|
||
if (listLifestyle1[i].allCount == 0)
|
||
{
|
||
dP = Convert.ToDouble(listLifestyle2[i].allCount);
|
||
}
|
||
else
|
||
{
|
||
dP = Convert.ToDouble(listLifestyle2[i].allCount - listLifestyle1[i].allCount) / Convert.ToDouble(listLifestyle1[i].allCount);
|
||
}
|
||
strDp = dP.ToString("p");
|
||
if (dP > 0)
|
||
{
|
||
strDp += " ↑";
|
||
}
|
||
else if (dP == 0)
|
||
{
|
||
strDp += " ─";
|
||
}
|
||
else
|
||
{
|
||
strDp += " ↓";
|
||
}
|
||
t3.GetRow(i + 3).GetCell(11).SetText(strDp);
|
||
}
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("结论:");
|
||
|
||
m_Docx.Write(ms);
|
||
ms.Flush();
|
||
string strFileName = dt1.ToString() + "年-" + dt2.ToString() + "年" + khmc + "单位体检数据分析";
|
||
string saveFileName = "";
|
||
SaveFileDialog saveDialog = new SaveFileDialog();
|
||
saveDialog.DefaultExt = "doc";
|
||
saveDialog.Filter = "Microsoft Word 97-2003 文件|*.doc";
|
||
saveDialog.FileName = strFileName;
|
||
saveDialog.ShowDialog();
|
||
saveFileName = saveDialog.FileName;
|
||
if (saveFileName.IndexOf(":") < 0)
|
||
{
|
||
return; //被点了取消
|
||
}
|
||
SaveToFile(ms, saveFileName);
|
||
MessageBox.Show("成功!");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 合并单元格-行
|
||
/// 2023-10-08 xulu
|
||
/// </summary>
|
||
/// <param name="table"></param>
|
||
/// <param name="fromRow"></param>
|
||
/// <param name="toRow"></param>
|
||
/// <param name="colIndex"></param>
|
||
public void MYMergeRows(XWPFTable table, int fromRow, int toRow, int colIndex)
|
||
{
|
||
for (int rowIndex = fromRow; rowIndex <= toRow; rowIndex++)
|
||
{
|
||
XWPFTableCell rowcell = table.GetRow(rowIndex).GetCell(colIndex);
|
||
rowcell.SetVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
|
||
CT_Tc cttc = rowcell.GetCTTc();
|
||
CT_TcPr ctTcPr = cttc.tcPr;
|
||
if (ctTcPr == null)
|
||
{
|
||
ctTcPr = cttc.AddNewTcPr();
|
||
}
|
||
|
||
if (rowIndex == fromRow)
|
||
{
|
||
// The first merged cell is set with RESTART merge value
|
||
ctTcPr.AddNewVMerge().val = ST_Merge.restart;
|
||
}
|
||
else
|
||
{
|
||
// Cells which join (merge) the first one, are set with CONTINUE
|
||
ctTcPr.AddNewVMerge().val = ST_Merge.@continue;//继续合并行
|
||
}
|
||
ctTcPr.AddNewVAlign().val = ST_VerticalJc.center;//垂直
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 保存文件
|
||
/// 2023-10-07 xulu
|
||
/// </summary>
|
||
/// <param name="ms"></param>
|
||
/// <param name="fileName"></param>
|
||
static void SaveToFile(MemoryStream ms, string fileName)
|
||
{
|
||
using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
|
||
{
|
||
byte[] data = ms.ToArray();
|
||
|
||
fs.Write(data, 0, data.Length);
|
||
fs.Flush();
|
||
data = null;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 展示结论选中按钮
|
||
/// 2023-10-13 xulu
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
if (checkBox1.Checked)
|
||
{
|
||
bShowResult = true;
|
||
}
|
||
else
|
||
{
|
||
bShowResult = false;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 2023-10-25 xulu 新增集团检查结果查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
int iYear = dateTimePicker3.Value.Year;
|
||
//获取集团所有人信息
|
||
DataTable ttgzbDt2 = ServiceContainer.GetService<IZongJian>().GetPersonInfo(iYear, "济南二机床集团有限公司");
|
||
int[] arrHtbm;
|
||
List<int> listHtbm=new List<int>();
|
||
foreach (DataRow dr in ttgzbDt2.Rows)
|
||
{
|
||
//判断是否有空行 方法一
|
||
if (dr["htbm"].Equals(DBNull.Value)) continue;
|
||
listHtbm.Add(Convert.ToInt32(dr["htbm"]));
|
||
}
|
||
arrHtbm = listHtbm.Distinct().ToArray();
|
||
var IZongJian = ServiceContainer.GetService<IZongJian>();
|
||
//获取已体检的人员
|
||
DataRow[] drChecked = ttgzbDt2.Select("tmztz > 3");
|
||
|
||
//年龄分布表
|
||
DataTable nlfbtDt = new DataTable();
|
||
//年龄分布图
|
||
DataTable nlfbtDtChart = new DataTable();
|
||
|
||
//MessageBox.Show("2");
|
||
if (drChecked.Length != 0)
|
||
{
|
||
frmWaitingBox f = new frmWaitingBox((obj, args) =>
|
||
{
|
||
khmc = drChecked[0]["khmc"].ToString();
|
||
//开始统计年龄分布图
|
||
DataRow[] drNv1 = ttgzbDt2.Select("xb=1 and nl > 0 and nl<35 and tmztz > 3");
|
||
DataRow[] drNv2 = ttgzbDt2.Select("xb=1 and nl >=35 and tmztz > 3");
|
||
|
||
DataRow[] drNan1 = ttgzbDt2.Select("xb=0 and nl > 0 and nl<35 and tmztz > 3");
|
||
DataRow[] drNan2 = ttgzbDt2.Select("xb=0 and nl >= 35 and tmztz > 3");
|
||
|
||
//35岁以下所有人员
|
||
DataRow[] drAll1 = ttgzbDt2.Select("nl > 0 and nl<35 ");
|
||
//35岁及以上所有人员
|
||
DataRow[] drAll2 = ttgzbDt2.Select("nl >= 35 ");
|
||
|
||
//35岁以下男比例
|
||
double dMale1 = Convert.ToDouble(drNan1.Length) / Convert.ToDouble(drChecked.Length);
|
||
string strMale1 = dMale1.ToString("p");
|
||
//35岁及以上男比例
|
||
double dMale2 = Convert.ToDouble(drNan2.Length) / Convert.ToDouble(drChecked.Length);
|
||
string strMale2 = dMale2.ToString("p");
|
||
|
||
//35岁以下女比例
|
||
double dFemale1 = Convert.ToDouble(drNv1.Length) / Convert.ToDouble(drChecked.Length);
|
||
string strFemale1 = dFemale1.ToString("p");
|
||
//35岁及以上女比例
|
||
double dFemale2 = Convert.ToDouble(drNv2.Length) / Convert.ToDouble(drChecked.Length);
|
||
string strFemale2 = dFemale2.ToString("p");
|
||
|
||
//35岁以下总比例
|
||
//string strAllPercent1 = (dMale1+ dFemale1).ToString("p");
|
||
//35岁及以上总比例
|
||
//string strAllPercent2 = (dMale2 + dFemale2).ToString("p");
|
||
double dAllPercent1 = Convert.ToDouble(drNan1.Length + drNv1.Length) / Convert.ToDouble(drAll1.Length);
|
||
double dAllPercent2 = Convert.ToDouble(drNan2.Length + drNv2.Length) / Convert.ToDouble(drAll2.Length);
|
||
|
||
string strAllPercent1 = dAllPercent1.ToString("p");
|
||
string strAllPercent2 = dAllPercent2.ToString("p");
|
||
|
||
//未查体占比
|
||
double dNullInspectionP1 = Convert.ToDouble(drAll1.Length - drNan1.Length - drNv1.Length) / Convert.ToDouble(drAll1.Length);
|
||
double dNullInspectionP2 = Convert.ToDouble(drAll2.Length - drNan2.Length - drNv2.Length) / Convert.ToDouble(drAll2.Length);
|
||
|
||
string strNullInspectionP1 = dNullInspectionP1.ToString("p");
|
||
string strNullInspectionP2 = dNullInspectionP2.ToString("p");
|
||
|
||
nlfbtDt.Columns.Add("title", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("maleCount", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("malePercent", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("femaleCount", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("femalePercent", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("allCount", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("allPercent", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("nullInspection", Type.GetType("System.String"));
|
||
nlfbtDt.Columns.Add("nullInspectionP", Type.GetType("System.String"));
|
||
|
||
nlfbtDt.Rows.Add(new object[] { "35岁以下", drNan1.Length, strMale1, drNv1.Length, strFemale1, drNan1.Length + drNv1.Length, strAllPercent1, drAll1.Length - drNan1.Length - drNv1.Length, strNullInspectionP1 });
|
||
nlfbtDt.Rows.Add(new object[] { "35岁及以上", drNan2.Length, strMale2, drNv2.Length, strFemale2, drNan2.Length + drNv2.Length, strAllPercent2, drAll2.Length - drNan2.Length - drNv2.Length, strNullInspectionP2 });
|
||
|
||
nlfbtDtChart.Columns.Add("name", Type.GetType("System.String"));
|
||
nlfbtDtChart.Columns.Add("sex", Type.GetType("System.String"));
|
||
nlfbtDtChart.Columns.Add("count", Type.GetType("System.Int32"));
|
||
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁以下", "人数(女)", drNv1.Length });
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁及以上", "人数(女)", drNv2.Length });
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁以下", "人数(男)", drNan1.Length });
|
||
nlfbtDtChart.Rows.Add(new object[] { "35岁及以上", "人数(男)", drNan2.Length });
|
||
|
||
|
||
re.Load(System.Windows.Forms.Application.StartupPath + "\\Report\\ttjbtj1.frx");
|
||
|
||
zjrs = 0;
|
||
|
||
//体检总人数
|
||
zjrs = drChecked.Length;
|
||
//男性人数
|
||
DataRow[] drNan = ttgzbDt2.Select("xb=0 and tmztz > 3");
|
||
nanRS = drNan.Length;
|
||
//女性人数
|
||
DataRow[] drNv = ttgzbDt2.Select("xb=1 and tmztz > 3");
|
||
nvRS = drNv.Length;
|
||
|
||
//单位体检分组项目
|
||
List<Entities.t_htfzb> listGroup = ServiceContainer.GetService<It_htfzb>().GetListByhtbm(arrHtbm);
|
||
|
||
DataTable dtProjectGroup = new DataTable();
|
||
dtProjectGroup.Columns.Add("groupCode", Type.GetType("System.String"));
|
||
dtProjectGroup.Columns.Add("groupName", Type.GetType("System.String"));
|
||
dtProjectGroup.Columns.Add("groupGendar", Type.GetType("System.String"));
|
||
dtProjectGroup.Columns.Add("groupPersonCount", Type.GetType("System.Int32"));
|
||
dtProjectGroup.Columns.Add("groupExams", Type.GetType("System.String"));
|
||
|
||
if (listGroup.Count > 0)
|
||
{
|
||
for (int i = 0; i < listGroup.Count; i++)
|
||
{
|
||
//根据分组合同编码获取团检人员
|
||
String data = ServiceContainer.GetService<It_ttgzb>().GetList2(listGroup[i].htfzbm);
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
|
||
int iPersonCount = dt.Rows.Count;
|
||
//根据分组合同编码获取体检项目
|
||
List<Entities.t_zhxm> listExams = ServiceContainer.GetService<It_zhxm>().GetzhxmByhtfzbm(listGroup[i].htfzbm);
|
||
string strExam = "";
|
||
for (int j = 0; j < listExams.Count; j++)
|
||
{
|
||
strExam += listExams[j].zhmc + ",";
|
||
}
|
||
strExam = strExam.Substring(0, strExam.Length - 1);
|
||
|
||
dtProjectGroup.Rows.Add(new object[] { listGroup[i].htfzbm, listGroup[i].htfzmc, listGroup[i].xb == 0 ? "男" : "女", iPersonCount, strExam });
|
||
}
|
||
|
||
}
|
||
|
||
//健康问题人员分布
|
||
DataTable dtUnhealthy = new DataTable();
|
||
dtUnhealthy.Columns.Add("healthProblem", Type.GetType("System.String"));
|
||
//35岁及以上男性
|
||
dtUnhealthy.Columns.Add("maleC1", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("maleP1", Type.GetType("System.String"));
|
||
//35岁及以上女性
|
||
dtUnhealthy.Columns.Add("femaleC1", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("femaleP1", Type.GetType("System.String"));
|
||
//35岁以下男性
|
||
dtUnhealthy.Columns.Add("maleC2", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("maleP2", Type.GetType("System.String"));
|
||
//35岁以下女性
|
||
dtUnhealthy.Columns.Add("femaleC2", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("femaleP2", Type.GetType("System.String"));
|
||
dtUnhealthy.Columns.Add("allCount", Type.GetType("System.Int32"));
|
||
dtUnhealthy.Columns.Add("allPercent", Type.GetType("System.String"));
|
||
|
||
//生活方式人员情况分布
|
||
DataTable dtLifestyle = new DataTable();
|
||
dtLifestyle = dtUnhealthy.Clone();
|
||
|
||
//健康问题列表
|
||
List<unhealthyStatistics> listUnhealthy = new List<unhealthyStatistics>();
|
||
//生活方式分布
|
||
List<unhealthyStatistics> listLifestyle = new List<unhealthyStatistics>();
|
||
listUnhealthy = new List<unhealthyStatistics>();
|
||
string strProblems = "超重BMI≥24,腰围(男>90 女>85),葡萄糖偏高,血压偏高,心律不齐,肾囊肿,肝囊肿,胆囊息肉,肝功异常,甘油三酯异常,胆固醇异常,尿酸,尿素,肌酐,肿瘤标志物,血常规异常,幽门螺旋杆菌抗体异常,脂肪肝,肺炎,肺结节,肺纹理增粗,肺占位,颈椎退行性改变,颈椎骨质增生,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arr = strProblems.Split(',');
|
||
for (int i = 0; i < arr.Length; i++)
|
||
{
|
||
unhealthyStatistics unhealthy = new unhealthyStatistics();
|
||
unhealthy.healthProblem = arr[i];
|
||
listUnhealthy.Add(unhealthy);
|
||
}
|
||
listLifestyle = new List<unhealthyStatistics>();
|
||
string strLifestyle = "吸烟,饮酒,家族史,规律运动,不运动,饮食均衡,嗜油腻,高血压,糖尿病,脑卒中,冠心病,慢支气管炎";
|
||
string[] arrLifestyle = strLifestyle.Split(',');
|
||
for (int i = 0; i < arrLifestyle.Length; i++)
|
||
{
|
||
unhealthyStatistics lifestyle = new unhealthyStatistics();
|
||
lifestyle.healthProblem = arrLifestyle[i];
|
||
listLifestyle.Add(lifestyle);
|
||
}
|
||
|
||
//获取体检人员体检诊断
|
||
for (int i=0;i<arrHtbm.Length;i++)
|
||
{
|
||
DataTable dtInfo = ServiceContainer.GetService<IZongJian>().GetTTHZJG(arrHtbm[i].ToString());
|
||
getResult(arrHtbm[i], ref listUnhealthy, ref listLifestyle, dtInfo, 1);
|
||
}
|
||
|
||
//填充健康问题表
|
||
for (int i = 0; i < listUnhealthy.Count; i++)
|
||
{
|
||
DataRow drUnhealthy = dtUnhealthy.NewRow();
|
||
drUnhealthy["healthProblem"] = listUnhealthy[i].healthProblem;
|
||
drUnhealthy["maleC1"] = listUnhealthy[i].maleC1;
|
||
drUnhealthy["maleP1"] = listUnhealthy[i].maleP1.ToString("p");
|
||
drUnhealthy["femaleC1"] = listUnhealthy[i].femaleC1;
|
||
drUnhealthy["femaleP1"] = listUnhealthy[i].femaleP1.ToString("p");
|
||
drUnhealthy["maleC2"] = listUnhealthy[i].maleC2;
|
||
drUnhealthy["maleP2"] = listUnhealthy[i].maleP2.ToString("p");
|
||
drUnhealthy["femaleC2"] = listUnhealthy[i].femaleC2;
|
||
drUnhealthy["femaleP2"] = listUnhealthy[i].femaleP2.ToString("p");
|
||
drUnhealthy["allCount"] = listUnhealthy[i].allCount;
|
||
drUnhealthy["allPercent"] = listUnhealthy[i].allPercent.ToString("p");
|
||
dtUnhealthy.Rows.Add(drUnhealthy.ItemArray);
|
||
}
|
||
//创建 健康问题柱状图表,一张表放9个问题
|
||
DataTable dtUnhealthyChart1 = new DataTable();
|
||
DataTable dtUnhealthyChart2 = new DataTable();
|
||
DataTable dtUnhealthyChart3 = new DataTable();
|
||
|
||
dtUnhealthyChart1.Columns.Add("Name", Type.GetType("System.String"));
|
||
dtUnhealthyChart1.Columns.Add("Count", Type.GetType("System.String"));
|
||
dtUnhealthyChart1.Columns.Add("Age", Type.GetType("System.String"));
|
||
dtUnhealthyChart2 = dtUnhealthyChart1.Clone();
|
||
dtUnhealthyChart3 = dtUnhealthyChart1.Clone();
|
||
|
||
for (int i = 0; i < listUnhealthy.Count; i++)
|
||
{
|
||
if (i < 9)
|
||
{
|
||
dtUnhealthyChart1.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC1 + listUnhealthy[i].femaleC1, "35岁及以上" });
|
||
dtUnhealthyChart1.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC2 + listUnhealthy[i].femaleC2, "35岁以下" });
|
||
}
|
||
else if (i >= 9 && i < 18)
|
||
{
|
||
dtUnhealthyChart2.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC1 + listUnhealthy[i].femaleC1, "35岁及以上" });
|
||
dtUnhealthyChart2.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC2 + listUnhealthy[i].femaleC2, "35岁以下" });
|
||
}
|
||
else if (i >= 18 && i < 27)
|
||
{
|
||
dtUnhealthyChart3.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC1 + listUnhealthy[i].femaleC1, "35岁及以上" });
|
||
dtUnhealthyChart3.Rows.Add(new object[] { listUnhealthy[i].healthProblem, listUnhealthy[i].maleC2 + listUnhealthy[i].femaleC2, "35岁以下" });
|
||
}
|
||
}
|
||
|
||
//填充生活方式表
|
||
for (int i = 0; i < listLifestyle.Count; i++)
|
||
{
|
||
DataRow drLifestyle = dtLifestyle.NewRow();
|
||
drLifestyle["healthProblem"] = listLifestyle[i].healthProblem;
|
||
drLifestyle["maleC1"] = listLifestyle[i].maleC1;
|
||
drLifestyle["maleP1"] = listLifestyle[i].maleP1.ToString("p");
|
||
drLifestyle["femaleC1"] = listLifestyle[i].femaleC1;
|
||
drLifestyle["femaleP1"] = listLifestyle[i].femaleP1.ToString("p");
|
||
drLifestyle["maleC2"] = listLifestyle[i].maleC2;
|
||
drLifestyle["maleP2"] = listLifestyle[i].maleP2.ToString("p");
|
||
drLifestyle["femaleC2"] = listLifestyle[i].femaleC2;
|
||
drLifestyle["femaleP2"] = listLifestyle[i].femaleP2.ToString("p");
|
||
drLifestyle["allCount"] = listLifestyle[i].allCount;
|
||
drLifestyle["allPercent"] = listLifestyle[i].allPercent.ToString("p");
|
||
dtLifestyle.Rows.Add(drLifestyle.ItemArray);
|
||
}
|
||
//创建 生活方式柱状图表
|
||
DataTable dtLifestyleChart = new DataTable();
|
||
dtLifestyleChart = dtUnhealthyChart1.Clone();
|
||
for (int i = 0; i < listLifestyle.Count; i++)
|
||
{
|
||
dtLifestyleChart.Rows.Add(new object[] { listLifestyle[i].healthProblem, listLifestyle[i].maleC1 + listLifestyle[i].femaleC1, "35岁及以上" });
|
||
dtLifestyleChart.Rows.Add(new object[] { listLifestyle[i].healthProblem, listLifestyle[i].maleC2 + listLifestyle[i].femaleC2, "35岁以下" });
|
||
}
|
||
//健康问题描述与建议
|
||
DataTable dtDescribe = new DataTable();
|
||
dtDescribe.Columns.Add("problem", Type.GetType("System.String"));
|
||
dtDescribe.Columns.Add("describe", Type.GetType("System.String"));
|
||
//strDescribe与strProblems一一对应
|
||
string strDescribe = "体重指数>24,腰围(男>90 女>85),空腹血葡萄糖(GLU)偏高,体检血压高," +
|
||
"心律不齐,肾囊肿,肝囊肿,胆囊息肉,肝功能多项指标异常,甘油三酯(TG)偏高,总胆固醇(TC)偏高,尿酸(UA)偏高," +
|
||
"尿素增高,肌酐(CRE)偏高,肿瘤八项轻度增高,血常规部分项目轻度异常,幽门螺旋杆菌阳性(+),中度脂肪肝,肺炎,肺结节," +
|
||
"肺纹理增粗,肺占位病变(中央型),颈椎退行性改变,颈椎骨质增生,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arrDescribe = strDescribe.Split(',');
|
||
for (int i = 0; i < arrDescribe.Length; i++)
|
||
{
|
||
t_jyms jyms = ServiceContainer.GetService<It_jyms>().GetjymsList(arrDescribe[i], "").FirstOrDefault();
|
||
if (jyms != null)
|
||
{
|
||
dtDescribe.Rows.Add(new object[] { listUnhealthy[i].healthProblem, jyms.jcjy });
|
||
}
|
||
|
||
}
|
||
//女性健康问题人员分布
|
||
DataTable dtFemaleProblem = new DataTable();
|
||
dtFemaleProblem.Columns.Add("problem", Type.GetType("System.String"));
|
||
dtFemaleProblem.Columns.Add("age1", Type.GetType("System.Int32"));
|
||
dtFemaleProblem.Columns.Add("age2", Type.GetType("System.Int32"));
|
||
dtFemaleProblem.Columns.Add("all", Type.GetType("System.Int32"));
|
||
dtFemaleProblem.Columns.Add("percent", Type.GetType("System.String"));
|
||
dtFemaleProblem.Columns.Add("name", Type.GetType("System.String"));
|
||
dtFemaleProblem.Columns.Add("examAll", Type.GetType("System.Int32"));
|
||
|
||
DataTable dtFemaleProblemChart = new DataTable();
|
||
dtFemaleProblemChart.Columns.Add("problem", Type.GetType("System.String"));
|
||
dtFemaleProblemChart.Columns.Add("age", Type.GetType("System.String"));
|
||
dtFemaleProblemChart.Columns.Add("count", Type.GetType("System.String"));
|
||
|
||
string strFemaleProblem = "胆固醇异常,血压偏高,颈椎退行性改变,颈椎骨质增生,肝囊肿,肝功异常,尿酸,血常规异常,幽门螺旋杆菌抗体异常";
|
||
string[] arrFemaleProblem = strFemaleProblem.Split(',');
|
||
for (int i = 0; i < arrFemaleProblem.Length; i++)
|
||
{
|
||
unhealthyStatistics un = listUnhealthy.Where(item => item.healthProblem == arrFemaleProblem[i]).FirstOrDefault();
|
||
if (un != null)
|
||
{
|
||
int iAllProblemPerson = un.femaleC1 + un.femaleC2;
|
||
double dPercent = Convert.ToDouble(iAllProblemPerson) / Convert.ToDouble(un.iFemaleExamPersonCount);
|
||
string strPercent = dPercent.ToString("p");
|
||
if (un.strFemaleName != null)
|
||
{
|
||
un.strFemaleName = un.strFemaleName.Substring(0, un.strFemaleName.Length - 1);
|
||
}
|
||
dtFemaleProblem.Rows.Add(new object[] { arrFemaleProblem[i], un.femaleC1, un.femaleC2, iAllProblemPerson, strPercent, un.strFemaleName, un.iFemaleExamPersonCount });
|
||
dtFemaleProblemChart.Rows.Add(new object[] { arrFemaleProblem[i], "35岁及以上", un.femaleC1 });
|
||
dtFemaleProblemChart.Rows.Add(new object[] { arrFemaleProblem[i], "35岁以下", un.femaleC2 });
|
||
}
|
||
|
||
}
|
||
//男性健康问题人员分布
|
||
DataTable dtMaleProblem = new DataTable();
|
||
dtMaleProblem = dtFemaleProblem.Clone();
|
||
DataTable dtMaleProblemChart = new DataTable();
|
||
dtMaleProblemChart = dtFemaleProblemChart.Clone();
|
||
|
||
string strMaleProblem = "超重BMI≥24,腰围(男>90 女>85),幽门螺旋杆菌抗体异常,颈椎退行性改变,颈椎骨质增生," +
|
||
"脂肪肝,肝功异常,肝囊肿,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arrMaleProblem = strMaleProblem.Split(',');
|
||
for (int i = 0; i < arrMaleProblem.Length; i++)
|
||
{
|
||
unhealthyStatistics un = listUnhealthy.Where(item => item.healthProblem == arrMaleProblem[i]).FirstOrDefault();
|
||
if (un != null)
|
||
{
|
||
int iAllProblemPerson = un.maleC1 + un.maleC2;
|
||
double dPercent = Convert.ToDouble(iAllProblemPerson) / Convert.ToDouble(un.iMaleExamPersonCount);
|
||
string strPercent = dPercent.ToString("p");
|
||
if (un.strMaleName != null)
|
||
{
|
||
un.strMaleName = un.strMaleName.Substring(0, un.strMaleName.Length - 1);
|
||
}
|
||
dtMaleProblem.Rows.Add(new object[] { arrMaleProblem[i], un.maleC1, un.maleC2, iAllProblemPerson, strPercent, un.strMaleName, un.iMaleExamPersonCount });
|
||
dtMaleProblemChart.Rows.Add(new object[] { arrMaleProblem[i], "35岁及以上", un.maleC1 });
|
||
dtMaleProblemChart.Rows.Add(new object[] { arrMaleProblem[i], "35岁以下", un.maleC2 });
|
||
}
|
||
|
||
}
|
||
//===========================================================
|
||
|
||
//MessageBox.Show("7");
|
||
//客户名称(单位名称)
|
||
re.SetParameterValue("khmc", khmc);
|
||
//单位编号
|
||
re.SetParameterValue("dwbh", "");
|
||
//联系人
|
||
re.SetParameterValue("lxr","");
|
||
//联系电话
|
||
re.SetParameterValue("lxdh", "");
|
||
//体检分组数量
|
||
re.SetParameterValue("groupCount", listGroup.Count);
|
||
//体检总人数
|
||
re.SetParameterValue("zjrs", zjrs);
|
||
//男性人数
|
||
re.SetParameterValue("nanRS", nanRS);
|
||
//女性人数
|
||
re.SetParameterValue("nvRS", nvRS);
|
||
re.SetParameterValue("jcxms", jcxmList);
|
||
re.SetParameterValue("ksrq", ksrq);
|
||
re.SetParameterValue("jsrq", jsrq);
|
||
re.SetParameterValue("gjts", gjts);
|
||
|
||
re.SetParameterValue("zczbrs", zczbrs);
|
||
re.SetParameterValue("zczbrsBfb", zczbrsBfb);
|
||
re.SetParameterValue("yczbrs", yczbrs);
|
||
re.SetParameterValue("yczbrsBfb", yczbrsBfb);
|
||
re.SetParameterValue("yczbNanRs", yczbNanRs);
|
||
re.SetParameterValue("yczbNanRsBfb", yczbNanRsBfb);
|
||
re.SetParameterValue("yczbNvRs", yczbNvRs);
|
||
re.SetParameterValue("yczbNvRsBfb", yczbNvRsBfb);
|
||
re.SetParameterValue("ygbdxdzRs", ygbdxdzRs);
|
||
re.SetParameterValue("ygrsBfb", ygrsBfb);
|
||
|
||
//2023-10-20 xulu 添加合计
|
||
re.SetParameterValue("male", drNan2.Length + drNan1.Length);
|
||
re.SetParameterValue("female", drNv2.Length + drNv1.Length);
|
||
re.SetParameterValue("all", drNan2.Length + drNv2.Length + drNan1.Length + drNv1.Length);
|
||
re.SetParameterValue("allnull", (drAll2.Length - drNan2.Length - drNv2.Length) + (drAll1.Length - drNan1.Length - drNv1.Length));
|
||
int iAll = drNan2.Length + drNv2.Length + drNan1.Length + drNv1.Length;
|
||
int iAllNull = (drAll2.Length - drNan2.Length - drNv2.Length) + (drAll1.Length - drNan1.Length - drNv1.Length);
|
||
double dAllnullP = Convert.ToDouble(iAllNull) /(Convert.ToDouble(iAll+iAllNull));
|
||
re.SetParameterValue("allnullp", dAllnullP.ToString("p"));
|
||
double dmp = Convert.ToDouble(drNan2.Length + drNan1.Length) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("maleP", dmp.ToString("p"));
|
||
double dfp = Convert.ToDouble(drNv2.Length + drNv1.Length) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("femaleP", dfp.ToString("p"));
|
||
double dallp = Convert.ToDouble(iAll) / (Convert.ToDouble(iAll + iAllNull));
|
||
re.SetParameterValue("allP", dallp.ToString("p"));
|
||
//------------------------------------
|
||
|
||
//团检年龄分布表
|
||
re.RegisterData(nlfbtDt, "nlFbt");
|
||
//团检年龄分布图
|
||
re.RegisterData(nlfbtDtChart, "nlFbtChart");
|
||
//体检分组项目表
|
||
re.RegisterData(dtProjectGroup, "dtProjectGroup");
|
||
//健康问题表
|
||
re.RegisterData(dtUnhealthy, "dtUnhealthy");
|
||
//健康问题图表1
|
||
re.RegisterData(dtUnhealthyChart1, "dtUnhealthyChart1");
|
||
//健康问题图表2
|
||
re.RegisterData(dtUnhealthyChart2, "dtUnhealthyChart2");
|
||
//健康问题图表3
|
||
re.RegisterData(dtUnhealthyChart3, "dtUnhealthyChart3");
|
||
//生活方式情况人员分布表
|
||
re.RegisterData(dtLifestyle, "dtLifestyle");
|
||
//生活方式情况人员分布图表
|
||
re.RegisterData(dtLifestyleChart, "dtLifestyleChart");
|
||
//健康问题描述及建议表
|
||
re.RegisterData(dtDescribe, "dtDescribe");
|
||
//女性健康问题人员分布表
|
||
re.RegisterData(dtFemaleProblem, "dtFemaleProblem");
|
||
//女性健康问题人员分布图表
|
||
re.RegisterData(dtFemaleProblemChart, "dtFemaleProblemChart");
|
||
//男性健康问题人员分布表
|
||
re.RegisterData(dtMaleProblem, "dtMaleProblem");
|
||
//男性健康问题人员分布图表
|
||
re.RegisterData(dtMaleProblemChart, "dtMaleProblemChart");
|
||
//体检结果汇总分析表
|
||
//re.RegisterData(dtInfo, "dtInfo");
|
||
|
||
}, 100000, "正在分析...", false, false);
|
||
f.ShowDialog();
|
||
re.Preview = previewControl1;
|
||
re.Refresh();
|
||
re.Show();
|
||
|
||
}
|
||
else
|
||
{
|
||
if (re.Preview != null)
|
||
{
|
||
re.Preview.Clear();
|
||
re.Clear();
|
||
re.Refresh();
|
||
re.Show(false);
|
||
}
|
||
MessageBox.Show("无数据!");
|
||
return;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 集团年度疾病对比
|
||
/// 2023-11-2
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void button4_Click(object sender, EventArgs e)
|
||
{
|
||
int dt1 = dateTimePicker1.Value.Year;
|
||
int dt2 = dateTimePicker2.Value.Year;
|
||
|
||
//客户名称
|
||
khmc = "济南二机床集团有限公司";
|
||
|
||
string strTitle = khmc;
|
||
string strSubTitle = dt1.ToString() + "年和" + dt2.ToString() + "年查体数据对比";
|
||
|
||
MemoryStream ms = new MemoryStream();
|
||
XWPFDocument m_Docx = new XWPFDocument();
|
||
//m_Docx = CreatDocxTable();
|
||
XWPFParagraph p0 = m_Docx.CreateParagraph();
|
||
p0.Alignment = ParagraphAlignment.CENTER; //字体居中
|
||
XWPFRun r0 = p0.CreateRun();
|
||
r0.FontSize = 18;
|
||
r0.SetFontFamily("黑体", FontCharRange.None); //设置黑体
|
||
r0.SetText(strTitle);
|
||
r0.AddCarriageReturn();
|
||
r0 = p0.CreateRun();
|
||
r0.FontSize = 18;
|
||
r0.SetFontFamily("黑体", FontCharRange.None); //设置黑体
|
||
r0.SetText(strSubTitle);
|
||
|
||
XWPFParagraph p1 = m_Docx.CreateParagraph();
|
||
XWPFRun r1 = p1.CreateRun();
|
||
r1.FontSize = 16;
|
||
r1.IsBold = true;
|
||
r1.SetFontFamily("黑体", FontCharRange.None); //设置黑体
|
||
r1.SetText("一、单位基本信息统计");
|
||
|
||
XWPFParagraph p2 = m_Docx.CreateParagraph();
|
||
XWPFRun r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("1.单位基本信息");
|
||
XWPFTable table = m_Docx.CreateTable(2, 4);
|
||
//列宽设置
|
||
for (int i = 0; i < 2; i++)
|
||
{
|
||
for (int j = 0; j < 4; j++)
|
||
{
|
||
CT_TcPr m_Pr = table.GetRow(i).GetCell(j).GetCTTc().AddNewTcPr();
|
||
m_Pr.tcW = new CT_TblWidth();
|
||
if (j == 0)
|
||
{
|
||
m_Pr.tcW.w = "400";//单元格宽
|
||
}
|
||
else
|
||
{
|
||
m_Pr.tcW.w = "2000";//单元格宽
|
||
}
|
||
m_Pr.tcW.type = ST_TblWidth.dxa;
|
||
}
|
||
}
|
||
//合并列
|
||
table.GetRow(0).MergeCells(1, 3);
|
||
//填充内容
|
||
table.GetRow(0).GetCell(0).SetText("单位名称");
|
||
table.GetRow(0).GetCell(1).SetText(khmc);
|
||
table.GetRow(1).GetCell(0).SetText("联系单位");
|
||
table.GetRow(1).GetCell(1).SetText("职工医院社区科");
|
||
table.GetRow(1).GetCell(2).SetText("联系电话");
|
||
table.GetRow(1).GetCell(3).SetText("81617785");
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("2.该单位两年体检人数按年龄段分布情况如下所示:");
|
||
XWPFTable t1 = m_Docx.CreateTable(4, 8);
|
||
t1.Width = 5500;
|
||
//列宽设置
|
||
for (int i = 0; i < 4; i++)
|
||
{
|
||
for (int j = 0; j < 8; j++)
|
||
{
|
||
CT_TcPr m_Pr = t1.GetRow(i).GetCell(j).GetCTTc().AddNewTcPr();
|
||
m_Pr.tcW = new CT_TblWidth();
|
||
m_Pr.tcW.w = "800";//单元格宽
|
||
m_Pr.tcW.type = ST_TblWidth.dxa;
|
||
}
|
||
}
|
||
//合并行
|
||
MYMergeRows(t1, 0, 1, 0);
|
||
MYMergeRows(t1, 0, 1, 1);
|
||
MYMergeRows(t1, 0, 1, 2);
|
||
MYMergeRows(t1, 0, 1, 3);
|
||
MYMergeRows(t1, 0, 1, 7);
|
||
MYMergeRows(t1, 1, 3, 7);
|
||
//合并列
|
||
t1.GetRow(0).MergeCells(4, 6);
|
||
|
||
//填充内容
|
||
t1.GetRow(0).GetCell(0).SetText("年份");
|
||
t1.GetRow(0).GetCell(1).SetText("体检人数");
|
||
t1.GetRow(0).GetCell(2).SetText("男");
|
||
t1.GetRow(0).GetCell(3).SetText("女");
|
||
t1.GetRow(0).GetCell(4).SetText("年龄分布");
|
||
t1.GetRow(0).GetCell(5).SetText("总人数同比");
|
||
t1.GetRow(2).GetCell(0).SetText(dt1.ToString());
|
||
t1.GetRow(3).GetCell(0).SetText(dt2.ToString());
|
||
//t1.GetRow(4).GetCell(0).SetText("合计");
|
||
t1.GetRow(1).GetCell(4).SetText("40岁以上");
|
||
t1.GetRow(1).GetCell(5).SetText("35-40岁");
|
||
t1.GetRow(1).GetCell(6).SetText("35岁以下");
|
||
|
||
DataTable dtPerson1 = ServiceContainer.GetService<IZongJian>().GetPersonInfo(dt1, khmc);
|
||
DataTable dtPerson2 = ServiceContainer.GetService<IZongJian>().GetPersonInfo(dt2, khmc);
|
||
DataRow[] drP1 = dtPerson1.Select("tmztz > 3");
|
||
DataRow[] drP2 = dtPerson2.Select("tmztz > 3");
|
||
int[] arrHtbm1;
|
||
List<int> listHtbm1 = new List<int>();
|
||
foreach (DataRow dr in drP1)
|
||
{
|
||
//判断是否有空行 方法一
|
||
if (dr["htbm"].Equals(DBNull.Value)) continue;
|
||
listHtbm1.Add(Convert.ToInt32(dr["htbm"]));
|
||
}
|
||
arrHtbm1 = listHtbm1.Distinct().ToArray();
|
||
|
||
int[] arrHtbm2;
|
||
List<int> listHtbm2 = new List<int>();
|
||
foreach (DataRow dr in drP2)
|
||
{
|
||
//判断是否有空行 方法一
|
||
if (dr["htbm"].Equals(DBNull.Value)) continue;
|
||
listHtbm2.Add(Convert.ToInt32(dr["htbm"]));
|
||
}
|
||
arrHtbm2 = listHtbm2.Distinct().ToArray();
|
||
//体检人数
|
||
//DataRow[] drP1 = dtPerson1;
|
||
//DataRow[] drP2 = dtPerson.Select("nd =" + dt2);
|
||
//男性人数
|
||
DataRow[] drNan1 = dtPerson1.Select("xb=0 and tmztz > 3");
|
||
DataRow[] drNan2 = dtPerson2.Select("xb=0 and tmztz > 3");
|
||
//女性人数
|
||
DataRow[] drNv1 = dtPerson1.Select("xb=1 and tmztz > 3");
|
||
DataRow[] drNv2 = dtPerson2.Select("xb=1 and tmztz > 3");
|
||
//40岁以上
|
||
DataRow[] drAge1 = dtPerson1.Select("nl>40 and tmztz > 3");
|
||
DataRow[] drAge2 = dtPerson2.Select("nl>40 and tmztz > 3");
|
||
//35-40岁
|
||
DataRow[] drAge3 = dtPerson1.Select("nl<=40 and nl>=35 and tmztz > 3");
|
||
DataRow[] drAge4 = dtPerson2.Select("nl<=40 and nl>=35 and tmztz > 3");
|
||
//35岁以下
|
||
DataRow[] drAge5 = dtPerson1.Select("nl<35 and tmztz > 3");
|
||
DataRow[] drAge6 = dtPerson2.Select("nl<35 and tmztz > 3");
|
||
//同比
|
||
double dP;
|
||
if (drP1.Length == 0)
|
||
{
|
||
dP = Convert.ToDouble(drP2.Length);
|
||
}
|
||
else
|
||
{
|
||
dP = Convert.ToDouble(drP2.Length - drP1.Length) / Convert.ToDouble(drP1.Length);
|
||
}
|
||
string strDp = dP.ToString("p");
|
||
if (dP > 0)
|
||
{
|
||
strDp += " ↑";
|
||
}
|
||
else if (dP == 0)
|
||
{
|
||
strDp += " -";
|
||
}
|
||
else
|
||
{
|
||
strDp += " ↓";
|
||
}
|
||
t1.GetRow(2).GetCell(1).SetText(drP1.Length.ToString());
|
||
t1.GetRow(3).GetCell(1).SetText(drP2.Length.ToString());
|
||
t1.GetRow(2).GetCell(2).SetText(drNan1.Length.ToString());
|
||
t1.GetRow(3).GetCell(2).SetText(drNan2.Length.ToString());
|
||
t1.GetRow(2).GetCell(3).SetText(drNv1.Length.ToString());
|
||
t1.GetRow(3).GetCell(3).SetText(drNv2.Length.ToString());
|
||
t1.GetRow(2).GetCell(4).SetText(drAge1.Length.ToString());
|
||
t1.GetRow(3).GetCell(4).SetText(drAge2.Length.ToString());
|
||
t1.GetRow(2).GetCell(5).SetText(drAge3.Length.ToString());
|
||
t1.GetRow(3).GetCell(5).SetText(drAge4.Length.ToString());
|
||
t1.GetRow(2).GetCell(6).SetText(drAge5.Length.ToString());
|
||
t1.GetRow(3).GetCell(6).SetText(drAge6.Length.ToString());
|
||
t1.GetRow(1).GetCell(7).SetText(strDp);
|
||
//健康问题列表
|
||
List<unhealthyStatistics> listUnhealthy1 = new List<unhealthyStatistics>();
|
||
List<unhealthyStatistics> listUnhealthy2 = new List<unhealthyStatistics>();
|
||
|
||
//生活方式分布
|
||
List<unhealthyStatistics> listLifestyle1 = new List<unhealthyStatistics>();
|
||
List<unhealthyStatistics> listLifestyle2 = new List<unhealthyStatistics>();
|
||
|
||
|
||
/* //健康问题列表
|
||
List<unhealthyStatistics> listUnhealthy = new List<unhealthyStatistics>();
|
||
//生活方式分布
|
||
List<unhealthyStatistics> listLifestyle = new List<unhealthyStatistics>();*/
|
||
listUnhealthy1 = new List<unhealthyStatistics>();
|
||
listUnhealthy2 = new List<unhealthyStatistics>();
|
||
listLifestyle1 = new List<unhealthyStatistics>();
|
||
listLifestyle2 = new List<unhealthyStatistics>();
|
||
string strProblems = "超重BMI≥24,腰围(男>90 女>85),葡萄糖偏高,血压偏高,心律不齐,肾囊肿,肝囊肿,胆囊息肉,肝功异常,甘油三酯异常,胆固醇异常,尿酸,尿素,肌酐,肿瘤标志物,血常规异常,幽门螺旋杆菌抗体异常,脂肪肝,肺炎,肺结节,肺纹理增粗,肺占位,颈椎退行性改变,颈椎骨质增生,腰椎退行性改变,腰椎骨质增生";
|
||
string[] arr = strProblems.Split(',');
|
||
for (int i = 0; i < arr.Length; i++)
|
||
{
|
||
unhealthyStatistics unhealthy = new unhealthyStatistics();
|
||
unhealthy.healthProblem = arr[i];
|
||
listUnhealthy1.Add(unhealthy);
|
||
}
|
||
|
||
string strLifestyle = "吸烟,饮酒,家族史,规律运动,不运动,饮食均衡,嗜油腻,高血压,糖尿病,脑卒中,冠心病,慢支气管炎";
|
||
string[] arrLifestyle = strLifestyle.Split(',');
|
||
for (int i = 0; i < arrLifestyle.Length; i++)
|
||
{
|
||
unhealthyStatistics lifestyle = new unhealthyStatistics();
|
||
lifestyle.healthProblem = arrLifestyle[i];
|
||
listLifestyle1.Add(lifestyle);
|
||
}
|
||
|
||
for (int i = 0; i < arr.Length; i++)
|
||
{
|
||
unhealthyStatistics unhealthy = new unhealthyStatistics();
|
||
unhealthy.healthProblem = arr[i];
|
||
listUnhealthy2.Add(unhealthy);
|
||
}
|
||
|
||
for (int i = 0; i < arrLifestyle.Length; i++)
|
||
{
|
||
unhealthyStatistics lifestyle = new unhealthyStatistics();
|
||
lifestyle.healthProblem = arrLifestyle[i];
|
||
listLifestyle2.Add(lifestyle);
|
||
}
|
||
|
||
//获取体检人员体检诊断
|
||
//2023-10-20 xulu 修改年度数据为0报错问题
|
||
string strHtbm1 = "0";
|
||
if (dtPerson1.Rows.Count > 0)
|
||
{
|
||
strHtbm1 = dtPerson1.Rows[0]["htbm"].ToString();
|
||
}
|
||
string strHtbm2 = "0";
|
||
if (dtPerson2.Rows.Count > 0)
|
||
{
|
||
strHtbm2 = dtPerson2.Rows[0]["htbm"].ToString();
|
||
}
|
||
/*DataTable dtInfo1 = ServiceContainer.GetService<IZongJian>().GetTTHZJG(strHtbm1);
|
||
getResult(Convert.ToInt32(strHtbm1), ref listUnhealthy1, ref listLifestyle1, dtInfo1);
|
||
DataTable dtInfo2 = ServiceContainer.GetService<IZongJian>().GetTTHZJG(strHtbm2);
|
||
getResult(Convert.ToInt32(strHtbm2), ref listUnhealthy2, ref listLifestyle2, dtInfo2);*/
|
||
|
||
//获取体检人员体检诊断
|
||
for (int i = 0; i < arrHtbm1.Length; i++)
|
||
{
|
||
DataTable dtInfo1 = ServiceContainer.GetService<IZongJian>().GetTTHZJG(arrHtbm1[i].ToString());
|
||
getResult(arrHtbm1[i], ref listUnhealthy1, ref listLifestyle1, dtInfo1,1);
|
||
}
|
||
for (int i = 0; i < arrHtbm2.Length; i++)
|
||
{
|
||
DataTable dtInfo2 = ServiceContainer.GetService<IZongJian>().GetTTHZJG(arrHtbm2[i].ToString());
|
||
getResult(arrHtbm2[i], ref listUnhealthy2, ref listLifestyle2, dtInfo2,1);
|
||
}
|
||
//---------修改年度数据为0报错问题 end----------------
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("3.两年健康问题人员分布对比:");
|
||
XWPFTable t2 = m_Docx.CreateTable(29, 12);
|
||
t2.Width = 5500;
|
||
MYMergeRows(t2, 0, 2, 0);
|
||
MYMergeRows(t2, 0, 2, 11);
|
||
MYMergeRows(t2, 1, 2, 5);
|
||
MYMergeRows(t2, 1, 2, 10);
|
||
|
||
t2.GetRow(0).MergeCells(1, 5);
|
||
t2.GetRow(0).MergeCells(2, 6);
|
||
t2.GetRow(1).MergeCells(1, 2);
|
||
t2.GetRow(1).MergeCells(2, 3);
|
||
t2.GetRow(1).MergeCells(4, 5);
|
||
t2.GetRow(1).MergeCells(5, 6);
|
||
|
||
t2.GetRow(0).GetCell(0).SetText("项目");
|
||
t2.GetRow(0).GetCell(1).SetText(dt1.ToString() + "年");
|
||
t2.GetRow(0).GetCell(2).SetText(dt2.ToString() + "年");
|
||
t2.GetRow(0).GetCell(3).SetText("同比");
|
||
t2.GetRow(1).GetCell(1).SetText("35岁及以上");
|
||
t2.GetRow(1).GetCell(2).SetText("35岁以下");
|
||
t2.GetRow(1).GetCell(3).SetText("合计");
|
||
t2.GetRow(1).GetCell(4).SetText("35岁及以上");
|
||
t2.GetRow(1).GetCell(5).SetText("35岁以下");
|
||
t2.GetRow(1).GetCell(6).SetText("合计");
|
||
t2.GetRow(2).GetCell(1).SetText("男性");
|
||
t2.GetRow(2).GetCell(2).SetText("女性");
|
||
t2.GetRow(2).GetCell(3).SetText("男性");
|
||
t2.GetRow(2).GetCell(4).SetText("女性");
|
||
t2.GetRow(2).GetCell(6).SetText("男性");
|
||
t2.GetRow(2).GetCell(7).SetText("女性");
|
||
t2.GetRow(2).GetCell(8).SetText("男性");
|
||
t2.GetRow(2).GetCell(9).SetText("女性");
|
||
|
||
for (int i = 0; i < listUnhealthy1.Count; i++)
|
||
{
|
||
t2.GetRow(i + 3).GetCell(0).SetText(listUnhealthy1[i].healthProblem);
|
||
t2.GetRow(i + 3).GetCell(1).SetText(listUnhealthy1[i].maleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(2).SetText(listUnhealthy1[i].femaleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(3).SetText(listUnhealthy1[i].maleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(4).SetText(listUnhealthy1[i].femaleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(5).SetText(listUnhealthy1[i].allCount.ToString());
|
||
}
|
||
for (int i = 0; i < listUnhealthy2.Count; i++)
|
||
{
|
||
t2.GetRow(i + 3).GetCell(6).SetText(listUnhealthy2[i].maleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(7).SetText(listUnhealthy2[i].femaleC1.ToString());
|
||
t2.GetRow(i + 3).GetCell(8).SetText(listUnhealthy2[i].maleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(9).SetText(listUnhealthy2[i].femaleC2.ToString());
|
||
t2.GetRow(i + 3).GetCell(10).SetText(listUnhealthy2[i].allCount.ToString());
|
||
//计算同比
|
||
if (listUnhealthy1[i].allCount == 0)
|
||
{
|
||
dP = Convert.ToDouble(listUnhealthy2[i].allCount);
|
||
}
|
||
else
|
||
{
|
||
dP = Convert.ToDouble(listUnhealthy2[i].allCount - listUnhealthy1[i].allCount) / Convert.ToDouble(listUnhealthy1[i].allCount);
|
||
}
|
||
strDp = dP.ToString("p");
|
||
if (dP > 0)
|
||
{
|
||
strDp += " ↑";
|
||
}
|
||
else if (dP == 0)
|
||
{
|
||
strDp += " -";
|
||
}
|
||
else
|
||
{
|
||
strDp += " ↓";
|
||
}
|
||
t2.GetRow(i + 3).GetCell(11).SetText(strDp);
|
||
}
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("4.两年职工生活方式情况分布对比:");
|
||
XWPFTable t3 = m_Docx.CreateTable(15, 12);
|
||
t3.Width = 5500;
|
||
MYMergeRows(t3, 0, 2, 0);
|
||
MYMergeRows(t3, 0, 2, 11);
|
||
MYMergeRows(t3, 1, 2, 5);
|
||
MYMergeRows(t3, 1, 2, 10);
|
||
|
||
t3.GetRow(0).MergeCells(1, 5);
|
||
t3.GetRow(0).MergeCells(2, 6);
|
||
t3.GetRow(1).MergeCells(1, 2);
|
||
t3.GetRow(1).MergeCells(2, 3);
|
||
t3.GetRow(1).MergeCells(4, 5);
|
||
t3.GetRow(1).MergeCells(5, 6);
|
||
|
||
t3.GetRow(0).GetCell(0).SetText("项目");
|
||
t3.GetRow(0).GetCell(1).SetText(dt1.ToString() + "年");
|
||
t3.GetRow(0).GetCell(2).SetText(dt2.ToString() + "年");
|
||
t3.GetRow(0).GetCell(3).SetText("同比");
|
||
t3.GetRow(1).GetCell(1).SetText("35岁及以上");
|
||
t3.GetRow(1).GetCell(2).SetText("35岁以下");
|
||
t3.GetRow(1).GetCell(3).SetText("合计");
|
||
t3.GetRow(1).GetCell(4).SetText("35岁及以上");
|
||
t3.GetRow(1).GetCell(5).SetText("35岁以下");
|
||
t3.GetRow(1).GetCell(6).SetText("合计");
|
||
t3.GetRow(2).GetCell(1).SetText("男性");
|
||
t3.GetRow(2).GetCell(2).SetText("女性");
|
||
t3.GetRow(2).GetCell(3).SetText("男性");
|
||
t3.GetRow(2).GetCell(4).SetText("女性");
|
||
t3.GetRow(2).GetCell(6).SetText("男性");
|
||
t3.GetRow(2).GetCell(7).SetText("女性");
|
||
t3.GetRow(2).GetCell(8).SetText("男性");
|
||
t3.GetRow(2).GetCell(9).SetText("女性");
|
||
for (int i = 0; i < listLifestyle1.Count; i++)
|
||
{
|
||
t3.GetRow(i + 3).GetCell(0).SetText(listLifestyle1[i].healthProblem);
|
||
t3.GetRow(i + 3).GetCell(1).SetText(listLifestyle1[i].maleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(2).SetText(listLifestyle1[i].femaleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(3).SetText(listLifestyle1[i].maleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(4).SetText(listLifestyle1[i].femaleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(5).SetText(listLifestyle1[i].allCount.ToString());
|
||
}
|
||
for (int i = 0; i < listLifestyle2.Count; i++)
|
||
{
|
||
t3.GetRow(i + 3).GetCell(6).SetText(listLifestyle2[i].maleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(7).SetText(listLifestyle2[i].femaleC1.ToString());
|
||
t3.GetRow(i + 3).GetCell(8).SetText(listLifestyle2[i].maleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(9).SetText(listLifestyle2[i].femaleC2.ToString());
|
||
t3.GetRow(i + 3).GetCell(10).SetText(listLifestyle2[i].allCount.ToString());
|
||
//计算同比
|
||
if (listLifestyle1[i].allCount == 0)
|
||
{
|
||
dP = Convert.ToDouble(listLifestyle2[i].allCount);
|
||
}
|
||
else
|
||
{
|
||
dP = Convert.ToDouble(listLifestyle2[i].allCount - listLifestyle1[i].allCount) / Convert.ToDouble(listLifestyle1[i].allCount);
|
||
}
|
||
strDp = dP.ToString("p");
|
||
if (dP > 0)
|
||
{
|
||
strDp += " ↑";
|
||
}
|
||
else if (dP == 0)
|
||
{
|
||
strDp += " ─";
|
||
}
|
||
else
|
||
{
|
||
strDp += " ↓";
|
||
}
|
||
t3.GetRow(i + 3).GetCell(11).SetText(strDp);
|
||
}
|
||
//空一行
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
|
||
p2 = m_Docx.CreateParagraph();
|
||
r2 = p2.CreateRun();
|
||
//r2.FontSize = 10;
|
||
r2.SetFontFamily("宋体", FontCharRange.None);
|
||
r2.SetText("结论:");
|
||
|
||
m_Docx.Write(ms);
|
||
ms.Flush();
|
||
string strFileName = dt1.ToString() + "年-" + dt2.ToString() + "年" + khmc + "单位体检数据分析";
|
||
string saveFileName = "";
|
||
SaveFileDialog saveDialog = new SaveFileDialog();
|
||
saveDialog.DefaultExt = "doc";
|
||
saveDialog.Filter = "Microsoft Word 97-2003 文件|*.doc";
|
||
saveDialog.FileName = strFileName;
|
||
saveDialog.ShowDialog();
|
||
saveFileName = saveDialog.FileName;
|
||
if (saveFileName.IndexOf(":") < 0)
|
||
{
|
||
return; //被点了取消
|
||
}
|
||
SaveToFile(ms, saveFileName);
|
||
MessageBox.Show("成功!");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 健康问题统计类
|
||
/// 2023-09-13 xulu 添加类
|
||
/// </summary>
|
||
public class unhealthyStatistics
|
||
{
|
||
//健康问题
|
||
public string healthProblem { get; set; }
|
||
|
||
//35岁以上男性
|
||
public int maleC1 { get; set; }
|
||
|
||
public double maleP1 { get; set; }
|
||
|
||
//35岁以上女性
|
||
public int femaleC1 { get; set; }
|
||
|
||
public double femaleP1 { get; set; }
|
||
|
||
//35岁及以下男性
|
||
public int maleC2 { get; set; }
|
||
|
||
public double maleP2 { get; set; }
|
||
|
||
//35岁及以下女性
|
||
public int femaleC2 { get; set; }
|
||
|
||
public double femaleP2 { get; set; }
|
||
|
||
//当前健康问题人数
|
||
public int allCount { get; set; }
|
||
|
||
//总百分比
|
||
public double allPercent { get; set; }
|
||
|
||
//健康问题人员名单(男)
|
||
public string strMaleName { get; set; }
|
||
|
||
//健康问题人员名单(女)
|
||
public string strFemaleName { get; set; }
|
||
|
||
//项目检查人数(女)
|
||
public int iFemaleExamPersonCount { get; set; }
|
||
|
||
//项目检查人数(男)
|
||
public int iMaleExamPersonCount { get; set; }
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 临时结果存放类
|
||
/// 2023-09-15 xulu 添加类
|
||
/// </summary>
|
||
public class tempResult
|
||
{
|
||
//条码
|
||
public string strCode { get; set; }
|
||
|
||
//项目名称
|
||
public string strExam { get;set; }
|
||
|
||
//检查结果
|
||
public string strResult { get; set; }
|
||
}
|
||
}
|