tijian_jichuang/Code/QianTai/frmTJQKCX.cs
2025-02-20 11:54:48 +08:00

82 lines
2.7 KiB
C#

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;
using System.Data;
using System.Collections.Generic;
namespace SOH.QianTai
{
[ModuleAttribute(ModuleID = "CDF067EE-1FD1-4D54-B049-C922891395DA", ModuleName = "体检情况查询")]
public partial class frmTJQKCX : SOH.Window.baseChildForm
{
public frmTJQKCX()
{
InitializeComponent();
}
private DataTable dt;
Object rq1 = null;
Object rq2 = null;
private void frmTJQKCX_Load(object sender, System.EventArgs e)
{
DateTime date1 = dtptjri1.Value.Date;
DateTime date2 = dtptjrq2.Value.Date.AddDays(1).AddMilliseconds(-1);
if (DateTime.Compare(date1, date2) > 0)
{
MessageBox.Show("体检日期输入错误!请重新选择!");
return;
}
else
{
rq1 = date1;
rq2 = date2;
}
var vservice = ServiceContainer.GetService<IZongJian>();
String data = vservice.selectTjztAll(rq1, rq2, short.Parse(LoginUser.yydm));
dt = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
Dictionary<string, int> dtcount = new Dictionary<String, int>();
dtcount.Add("0", 0);
dtcount.Add("1", 0);
dtcount.Add("2", 0);
dtcount.Add("3", 0);
dtcount.Add("4", 0);
dtcount.Add("5", 0);
dtcount.Add("6", 0);
dtcount.Add("7", 0);
dtcount.Add("8", 0);
dtcount.Add("9", 0);
dtcount.Add("-1", 0);
dtcount.Add("-2", 0);
dtcount.Add("10", 0);
for (int i = 0; i < dt.Rows.Count; i++)
{
dtcount[dt.Rows[i]["tmztz"].ToString()] = dtcount[dt.Rows[i]["tmztz"].ToString()] + 1;
}
DataTable countDt = new DataTable();
countDt.Columns.Add("type", typeof(string));
countDt.Columns.Add("count", typeof(string));
countDt.Columns.Add("typeid", typeof(int));
foreach (KeyValuePair<string, int> kv in dtcount)
{
if (kv.Value != 0)
{
DataRow row = countDt.NewRow();
row["type"] = (tjryzt)Convert.ToInt32(kv.Key);
row["count"] = kv.Value;
row["typeid"] = Convert.ToInt32(kv.Key);
countDt.Rows.Add(row);
}
}
//dgvtj.DataSource = countDt;
//dgvtj.Refresh();
}
}
}