1244 lines
44 KiB
C#
1244 lines
44 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using Dapper;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace dccdc.DAL
|
|||
|
|
{
|
|||
|
|
public class DataInput
|
|||
|
|
{
|
|||
|
|
static object o = new object();
|
|||
|
|
|
|||
|
|
public List<dynamic> crblssj
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
lock (o)
|
|||
|
|
{
|
|||
|
|
if (System.Web.HttpContext.Current.Application["crb"] == null)
|
|||
|
|
{
|
|||
|
|
string sql = "select * from crbsj";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var data = conn.Query(sql).ToList();
|
|||
|
|
System.Web.HttpContext.Current.Application["crb"] = data;
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return System.Web.HttpContext.Current.Application["crb"] as List<dynamic>;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public List<dynamic> zlsj
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
lock (o)
|
|||
|
|
{
|
|||
|
|
if (System.Web.HttpContext.Current.Application["zl"] == null)
|
|||
|
|
{
|
|||
|
|
string sql = "select *,sfzh yxzjh from old_zl";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var data = conn.Query(sql).ToList();
|
|||
|
|
System.Web.HttpContext.Current.Application["zl"] = data;
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return System.Web.HttpContext.Current.Application["zl"] as List<dynamic>;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public List<dynamic> nczsj
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
lock (o)
|
|||
|
|
{
|
|||
|
|
if (System.Web.HttpContext.Current.Application["ncz"] == null)
|
|||
|
|
{
|
|||
|
|
string sql = "select * from NCZSJ";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var data = conn.Query(sql).ToList();
|
|||
|
|
System.Web.HttpContext.Current.Application["ncz"] = data;
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return System.Web.HttpContext.Current.Application["ncz"] as List<dynamic>;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public List<dynamic> gxbsj
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
lock (o)
|
|||
|
|
{
|
|||
|
|
if (System.Web.HttpContext.Current.Application["gxb"] == null)
|
|||
|
|
{
|
|||
|
|
string sql = "select * from gxbSJ";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var data = conn.Query(sql).ToList();
|
|||
|
|
System.Web.HttpContext.Current.Application["gxb"] = data;
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return System.Web.HttpContext.Current.Application["gxb"] as List<dynamic>;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public void uploadOldDatazl(DataTable dataTable, string drr)
|
|||
|
|
{
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = @"INSERT INTO [old_zl]
|
|||
|
|
([bm]
|
|||
|
|
,[sbrq]
|
|||
|
|
,[mzh]
|
|||
|
|
,[zyh]
|
|||
|
|
,[xm]
|
|||
|
|
,[sfzh]
|
|||
|
|
,[xb]
|
|||
|
|
,[mz]
|
|||
|
|
,[csrq]
|
|||
|
|
,[nl]
|
|||
|
|
,[hjd]
|
|||
|
|
,[czd]
|
|||
|
|
,[lxdh]
|
|||
|
|
,[gzdw]
|
|||
|
|
,[zd]
|
|||
|
|
,[bl]
|
|||
|
|
,[icd10]
|
|||
|
|
,[icd10name]
|
|||
|
|
,[bgys],bgdw,drr,drsj,hjzbm,czzbm)
|
|||
|
|
VALUES
|
|||
|
|
(@bm
|
|||
|
|
,@sbrq
|
|||
|
|
,@mzh
|
|||
|
|
,@zyh
|
|||
|
|
,@xm
|
|||
|
|
,@sfzh
|
|||
|
|
,@xb
|
|||
|
|
,@mz
|
|||
|
|
,@csrq
|
|||
|
|
,@nl
|
|||
|
|
,@hjd
|
|||
|
|
,@czd
|
|||
|
|
,@lxdh
|
|||
|
|
,@gzdw
|
|||
|
|
,@zd
|
|||
|
|
,@bl
|
|||
|
|
,@icd10
|
|||
|
|
,@icd10name
|
|||
|
|
,@bgys,@bgdw,@drr,@drsj,@hjzbm,@czzbm)
|
|||
|
|
";
|
|||
|
|
foreach (DataRow dr in dataTable.Rows)
|
|||
|
|
{
|
|||
|
|
string havesql = "select count(1) from old_zl where bm='" + dr["登记编码"].ToString() + "'";
|
|||
|
|
int c = conn.ExecuteScalar<int>(havesql);
|
|||
|
|
if (c > 0)
|
|||
|
|
continue;
|
|||
|
|
//医生填卡日期
|
|||
|
|
|
|||
|
|
var paras = new
|
|||
|
|
{
|
|||
|
|
bm = dr["登记编码"].ToString()
|
|||
|
|
,
|
|||
|
|
sbrq = dr["录入日期"].ToString()
|
|||
|
|
,
|
|||
|
|
mzh = dr["门诊号"].ToString()
|
|||
|
|
,
|
|||
|
|
zyh = dr["住院号"].ToString()
|
|||
|
|
,
|
|||
|
|
xm = dr["姓名"].ToString()
|
|||
|
|
,
|
|||
|
|
sfzh = dr["身份证号"].ToString()
|
|||
|
|
,
|
|||
|
|
xb = dr["性别"].ToString()
|
|||
|
|
,
|
|||
|
|
mz = dr["民族"].ToString()
|
|||
|
|
,
|
|||
|
|
csrq = dr["出生日期"].ToString()
|
|||
|
|
,
|
|||
|
|
nl = dr["年龄(周岁)"].ToString()
|
|||
|
|
,
|
|||
|
|
hjd = dr["户籍详细住址"].ToString()
|
|||
|
|
,
|
|||
|
|
czd = dr["常住详细地址"].ToString()
|
|||
|
|
,
|
|||
|
|
zd = dr["诊断(中文描述)"].ToString()
|
|||
|
|
,
|
|||
|
|
bl = dr["病理学类型描述"].ToString()
|
|||
|
|
,
|
|||
|
|
icd10 = dr["ICD-10编码"].ToString()
|
|||
|
|
,
|
|||
|
|
icd10name = dr["ICD-10名称"].ToString()
|
|||
|
|
,
|
|||
|
|
lxdh = dr["联系电话"].ToString()
|
|||
|
|
,
|
|||
|
|
gzdw = dr["工作单位"].ToString()
|
|||
|
|
,
|
|||
|
|
bgys = dr["填卡医师"].ToString()
|
|||
|
|
,
|
|||
|
|
bgdw = dr["报告单位"].ToString()
|
|||
|
|
,
|
|||
|
|
drr = drr
|
|||
|
|
,
|
|||
|
|
drsj = DateTime.Now
|
|||
|
|
,
|
|||
|
|
hjzbm = dr["户籍地区编码"].ToString()
|
|||
|
|
,
|
|||
|
|
czzbm = dr["常住地区编码"].ToString()
|
|||
|
|
};
|
|||
|
|
//DBUtility.DbHelperSQL.ExecuteSql(sql, paras);
|
|||
|
|
|
|||
|
|
conn.Execute(sql, paras);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object crbbzsbdwfx(string bdt, string bz)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
if (!(string.IsNullOrEmpty(bz) || bz == "全部"))
|
|||
|
|
{
|
|||
|
|
where += " and a.zd='" + bz + "'";
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select a.bgdw,count(1) fbrs from crbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + bdt + @"'" + where + @"
|
|||
|
|
group by a.bgdw order by count(1)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select a.bgdw,count(1) fbrs from crbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'" + where + @"
|
|||
|
|
group by a.bgdw";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.bgdw.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
|
|||
|
|
@"select a.bgdw,count(1) fbrs from crbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'" + where + @"
|
|||
|
|
group by a.bgdw";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.bgdw.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.bgdw;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getswlb(string org_code, string bt, string et, string jblx)
|
|||
|
|
{
|
|||
|
|
DateTime obt;
|
|||
|
|
DateTime oet;
|
|||
|
|
if (!DateTime.TryParse(bt, out obt))
|
|||
|
|
{
|
|||
|
|
obt = DateTime.Now.Date;
|
|||
|
|
}
|
|||
|
|
if (!DateTime.TryParse(et, out oet))
|
|||
|
|
{
|
|||
|
|
oet = DateTime.Now.Date;
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
|
|||
|
|
|
|||
|
|
string sql = @"select a.org_code,a.name,a.sex_code,a.birth_date,a.id_no ,
|
|||
|
|
b.in_dept_name,b.discharge_date,b.in_dtime,b.inpat_form_no ,c.death_cause from
|
|||
|
|
baseinfo a join inpatient b on a.org_code=b.org_code and a.patient_id=b.patient_id
|
|||
|
|
join inpatient_firstpage c on b.org_code=c.org_code and b.patient_id=c.patient_id and b.inpat_form_no=c.inpat_form_no
|
|||
|
|
where b.in_dtime>@bt and b.in_dtime<@et and a.org_code=@org_code
|
|||
|
|
|
|||
|
|
";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var data = conn.Query(sql, new { org_code, bt = obt, et = oet.AddDays(1).Date }, null, true, 180).ToList();
|
|||
|
|
List<dynamic> re = new List<dynamic>();
|
|||
|
|
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getmzlb(string org_code, string bt, string et, string jblx = "0")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DateTime obt;
|
|||
|
|
DateTime oet;
|
|||
|
|
if (!DateTime.TryParse(bt, out obt))
|
|||
|
|
{
|
|||
|
|
obt = DateTime.Now.Date;
|
|||
|
|
}
|
|||
|
|
if (!DateTime.TryParse(et, out oet))
|
|||
|
|
{
|
|||
|
|
oet = DateTime.Now.Date;
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string jbkey = "";
|
|||
|
|
List<dynamic> lssj = new List<dynamic>();
|
|||
|
|
if (jblx == "0") {
|
|||
|
|
jbkey = new Common().getParm_Value("crbkey", "传染病", "传染病关键词");
|
|||
|
|
lssj = crblssj;
|
|||
|
|
}
|
|||
|
|
else if (jblx == "1") {
|
|||
|
|
jbkey = new Common().getParm_Value("zlkey", "肿瘤", "肿瘤关键词");
|
|||
|
|
lssj = zlsj;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
else if (jblx == "2") {
|
|||
|
|
jbkey = new Common().getParm_Value("nczkey", "脑卒中", "脑卒中关键词");
|
|||
|
|
lssj = nczsj;
|
|||
|
|
}
|
|||
|
|
else if (jblx == "3") {
|
|||
|
|
jbkey = new Common().getParm_Value("gxbkey", "冠心病", "冠心病关键词");
|
|||
|
|
lssj = gxbsj;
|
|||
|
|
}
|
|||
|
|
string crbkey = jbkey;
|
|||
|
|
string sql = @"select distinct a.org_code,a.name,a.sex_code,a.birth_date,a.id_no ,
|
|||
|
|
b.visit_dept_name,b.visit_dtime,b.resp_doctor_name,b.outpat_form_no
|
|||
|
|
from
|
|||
|
|
baseinfo a join outpatient b on a.org_code = b.org_code and a.patient_id = b.patient_id
|
|||
|
|
join outpatient_diag c on c.org_code = b.org_code and c.outpat_form_no = b.outpat_form_no
|
|||
|
|
where b.visit_dtime > @bt and b.visit_dtime < @et
|
|||
|
|
and dbo.reglike(c.outpat_diag_name, @crbkey) = '1' and a.org_code=@org_code
|
|||
|
|
";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
var data = conn.Query(sql, new { org_code, bt = obt, et = oet.AddDays(1).Date, crbkey = crbkey },null,true,180).ToList();
|
|||
|
|
List<dynamic> re = new List<dynamic>();
|
|||
|
|
data.ForEach(t =>
|
|||
|
|
{
|
|||
|
|
if (!lssj.Where(hx => ((t.id_no ?? "") != "" && (hx.yxzjh ?? "").Contains(t.id_no))).Any())
|
|||
|
|
{
|
|||
|
|
re.Add(t);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return re;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public object getzylb(string org_code, string bt, string et,string jblx="0")
|
|||
|
|
{
|
|||
|
|
DateTime obt;
|
|||
|
|
DateTime oet;
|
|||
|
|
if (!DateTime.TryParse(bt, out obt))
|
|||
|
|
{
|
|||
|
|
obt = DateTime.Now.Date;
|
|||
|
|
}
|
|||
|
|
if (!DateTime.TryParse(et, out oet))
|
|||
|
|
{
|
|||
|
|
oet = DateTime.Now.Date;
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string jbkey = "";
|
|||
|
|
List<dynamic> lssj = new List<dynamic>();
|
|||
|
|
if (jblx == "0")
|
|||
|
|
{
|
|||
|
|
jbkey = new Common().getParm_Value("crbkey", "传染病", "传染病关键词");
|
|||
|
|
lssj = crblssj;
|
|||
|
|
}
|
|||
|
|
else if (jblx == "1")
|
|||
|
|
{
|
|||
|
|
jbkey = new Common().getParm_Value("zlkey", "肿瘤", "肿瘤关键词");
|
|||
|
|
lssj = zlsj;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
else if (jblx == "2")
|
|||
|
|
{
|
|||
|
|
jbkey = new Common().getParm_Value("nczkey", "脑卒中", "脑卒中关键词");
|
|||
|
|
lssj = nczsj;
|
|||
|
|
}
|
|||
|
|
else if (jblx == "3")
|
|||
|
|
{
|
|||
|
|
jbkey = new Common().getParm_Value("gxbkey", "冠心病", "冠心病关键词");
|
|||
|
|
lssj = gxbsj;
|
|||
|
|
}
|
|||
|
|
string crbkey = jbkey;
|
|||
|
|
string sql = @"select a.org_code,a.name,a.sex_code,a.birth_date,a.id_no ,
|
|||
|
|
b.in_dept_name,b.discharge_date,b.in_dtime,b.inpat_form_no from
|
|||
|
|
baseinfo a join inpatient b on a.org_code=b.org_code and a.patient_id=b.patient_id
|
|||
|
|
where b.in_dtime>@bt and b.in_dtime<@et and a.org_code=@org_code
|
|||
|
|
and(
|
|||
|
|
exists (select top 1 1 from inpatient_indiag id where id.org_code=b.org_code and id.inpat_form_no=b.inpat_form_no
|
|||
|
|
and dbo.reglike(id.in_diag_name,@crbkey)='1')
|
|||
|
|
or
|
|||
|
|
exists (select top 1 1 from inpatient_outdiag od where od.org_code=b.org_code and od.inpat_form_no=b.inpat_form_no
|
|||
|
|
and dbo.reglike(od.out_diag_name,@crbkey)='1'
|
|||
|
|
)
|
|||
|
|
)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var data = conn.Query(sql, new { org_code, bt = obt, et = oet.AddDays(1).Date, crbkey = crbkey }, null, true, 180).ToList();
|
|||
|
|
List<dynamic> re = new List<dynamic>();
|
|||
|
|
data.ForEach(t =>
|
|||
|
|
{
|
|||
|
|
if (!lssj.Where(hx => ((t.id_no ?? "") != "" && (hx.yxzjh ?? "").Contains(t.id_no))).Any())
|
|||
|
|
{
|
|||
|
|
re.Add(t);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getmzzd(string org_code, string outpat_form_no)
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = "select * from outpatient_diag where org_code=@org_code and outpat_form_no=@outpat_form_no";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql, new { org_code, outpat_form_no }).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getzyzd(string org_code, string inpat_form_no)
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = "select out_diag_name zd,out_diag_code bm from inpatient_outdiag where org_code=@org_code and inpat_form_no=@inpat_form_no union select in_diag_name zd,in_diag_code bm from inpatient_indiag where org_code=@org_code and inpat_form_no=@inpat_form_no";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql, new { org_code, inpat_form_no }).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getmbyddqfx(string bdt, string mb)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
string table = "";
|
|||
|
|
string sj = "bklrsj";
|
|||
|
|
string zbm = "zzbm";
|
|||
|
|
if (mb == "肿瘤")
|
|||
|
|
{
|
|||
|
|
table = "old_zl";
|
|||
|
|
sj = "sbrq";
|
|||
|
|
zbm = "czzbm";
|
|||
|
|
}
|
|||
|
|
else if (mb == "脑卒中")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
table = "nczsj";
|
|||
|
|
}
|
|||
|
|
else if (mb == "冠心病")
|
|||
|
|
{
|
|||
|
|
table = "gxbsj";
|
|||
|
|
}
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select s.townName dqname,count(1) fbrs
|
|||
|
|
from " + table + @" o join Sz_town s
|
|||
|
|
on o." + zbm + @" = SUBSTRING(s.townCode, 1, 8)
|
|||
|
|
where CONVERT(varchar(7),o." + sj + @",121)='" + bdt + @"' and s.countyCode='3714020000' " + where + @"
|
|||
|
|
group by s.townName order by count(1)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.dqname.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select s.townName dqname,count(1) fbrs
|
|||
|
|
from " + table + @" o join Sz_town s
|
|||
|
|
on o." + zbm + @" = SUBSTRING(s.townCode, 1, 8)
|
|||
|
|
where CONVERT(varchar(7),o." + sj + @",121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"' and s.countyCode='3714020000' " + where + @"
|
|||
|
|
group by s.townName order by count(1)";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.dqname.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.dqname.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select s.townName dqname,count(1) fbrs
|
|||
|
|
from " + table + @" o join Sz_town s
|
|||
|
|
on o." + zbm + @" = SUBSTRING(s.townCode, 1, 8)
|
|||
|
|
where CONVERT(varchar(7),o." + sj + @",121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"' and s.countyCode='3714020000' " + where + @"
|
|||
|
|
group by s.townName order by count(1)";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.dqname.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.dqname.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.bgdw;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getmbsbdwydfx(string bdt, string mb)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
string table = "";
|
|||
|
|
string sj = "bklrsj";
|
|||
|
|
if (mb == "肿瘤")
|
|||
|
|
{
|
|||
|
|
table = "old_zl";
|
|||
|
|
sj = "sbrq";
|
|||
|
|
}
|
|||
|
|
else if (mb == "脑卒中")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
table = "nczsj";
|
|||
|
|
}
|
|||
|
|
else if (mb == "冠心病")
|
|||
|
|
{
|
|||
|
|
table = "gxbsj";
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select a.bgdw,count(1) fbrs from " + table + @" a
|
|||
|
|
where CONVERT(varchar(7),a." + sj + @",121)='" + bdt + @"'" + where + @"
|
|||
|
|
group by a.bgdw order by count(1)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select a.bgdw,count(1) fbrs from " + table + @" a
|
|||
|
|
where CONVERT(varchar(7),a." + sj + @",121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'" + where + @"
|
|||
|
|
group by a.bgdw";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.bgdw.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
|
|||
|
|
@"select a.bgdw,count(1) fbrs from " + table + @" a
|
|||
|
|
where CONVERT(varchar(7),a." + sj + @",121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'" + where + @"
|
|||
|
|
group by a.bgdw";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.bgdw.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.fbrs;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getmbsjdfx(string bdt, string edt, string mb)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
string table = "";
|
|||
|
|
string sj = "bklrsj";
|
|||
|
|
if (mb == "肿瘤")
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),sbrq,121)>='" + bdt + "'";
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),sbrq,121)<='" + edt + "'";
|
|||
|
|
}
|
|||
|
|
table = "old_zl";
|
|||
|
|
sj = "sbrq";
|
|||
|
|
}
|
|||
|
|
else if (mb == "脑卒中")
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),bklrsj,121)>='" + bdt + "'";
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),bklrsj,121)<='" + edt + "'";
|
|||
|
|
}
|
|||
|
|
table = "nczsj";
|
|||
|
|
}
|
|||
|
|
else if (mb == "冠心病")
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),bklrsj,121)>='" + bdt + "'";
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),bklrsj,121)<='" + edt + "'";
|
|||
|
|
}
|
|||
|
|
table = "gxbsj";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = @"select CONVERT(varchar(7)," + sj + @",121) yf,count(1) rs
|
|||
|
|
from " + table + @"
|
|||
|
|
where 1=1 " + where + @"
|
|||
|
|
group by CONVERT(varchar(7)," + sj + @",121)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getmbysjfx(string bdt)
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select '肿瘤' bgdw,count(1) fbrs from old_zl a
|
|||
|
|
where CONVERT(varchar(7),a.sbrq,121)='" + bdt + @"'"
|
|||
|
|
+ @"union all
|
|||
|
|
select '冠心病' bgdw,count(1) fbrs from gxbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + bdt + @"'
|
|||
|
|
" + @"union all
|
|||
|
|
select '脑卒中' bgdw,count(1) fbrs from nczsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + bdt + @"'
|
|||
|
|
";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select '肿瘤' bgdw,count(1) fbrs from old_zl a
|
|||
|
|
where CONVERT(varchar(7),a.sbrq,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'"
|
|||
|
|
+ @"union all
|
|||
|
|
select '冠心病' bgdw,count(1) fbrs from gxbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
" + @"union all
|
|||
|
|
select '脑卒中' bgdw,count(1) fbrs from nczsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.bgdw.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql = @"select '肿瘤' bgdw,count(1) fbrs from old_zl a
|
|||
|
|
where CONVERT(varchar(7),a.sbrq,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'"
|
|||
|
|
+ @"union all
|
|||
|
|
select '冠心病' bgdw,count(1) fbrs from gxbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
" + @"union all
|
|||
|
|
select '脑卒中' bgdw,count(1) fbrs from nczsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.bgdw.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.bgdw.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.fbrs;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getcrbyfdqfbtj(string bdt, string bz)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
if (!(string.IsNullOrEmpty(bz) || bz == "全部"))
|
|||
|
|
{
|
|||
|
|
where += " and o.zd='" + bz + "'";
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select s.townName dqname,count(1) fbrs
|
|||
|
|
from crbsj o join Sz_town s
|
|||
|
|
on o.zzbm = SUBSTRING(s.townCode, 1, 8)
|
|||
|
|
where CONVERT(varchar(7),o.bklrsj,121)='" + bdt + @"' and s.countyCode='3714020000' " + where + @"
|
|||
|
|
group by s.townName order by count(1)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.dqname.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select s.townName dqname,count(1) fbrs
|
|||
|
|
from crbsj o join Sz_town s
|
|||
|
|
on o.zzbm = SUBSTRING(s.townCode, 1, 8)
|
|||
|
|
where CONVERT(varchar(7),o.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"' and s.countyCode='3714020000' " + where + @"
|
|||
|
|
group by s.townName order by count(1)";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.dqname.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.dqname.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select s.townName dqname,count(1) fbrs
|
|||
|
|
from crbsj o join Sz_town s
|
|||
|
|
on o.zzbm = SUBSTRING(s.townCode, 1, 8)
|
|||
|
|
where CONVERT(varchar(7),o.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"' and s.countyCode='3714020000' " + where + @"
|
|||
|
|
group by s.townName order by count(1)";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.dqname.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.dqname.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.fbrs;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getcrbbzydfx(string bdt)
|
|||
|
|
{
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select a.zd,count(1) fbrs from crbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + bdt + @"'
|
|||
|
|
group by a.zd order by count(1)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.zd.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
@"select a.zd,count(1) fbrs from crbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
group by a.zd";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.zd.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.zd.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql =
|
|||
|
|
|
|||
|
|
@"select a.zd,count(1) fbrs from crbsj a
|
|||
|
|
where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
group by a.zd";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.zd.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.zd.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.fbrs;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getbz()
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = @"
|
|||
|
|
select '全部' bzmc,0 infectiousDiseasecate,0 px union all
|
|||
|
|
select diseasename bzmc,infectiousDiseasecate,px from Sz_infectiousDisease_category
|
|||
|
|
order by infectiousDiseasecate,px";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getcrbdbzsjdfx(string bdt, string edt, string bz)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),bklrsj,121)>='" + bdt + "'";
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
where += " and CONVERT(varchar(7),bklrsj,121)<='" + edt + "'";
|
|||
|
|
}
|
|||
|
|
if (!(string.IsNullOrEmpty(bz) || bz == "全部"))
|
|||
|
|
{
|
|||
|
|
where += " and zd='" + bz + "'";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = @"select CONVERT(varchar(7),bklrsj,121) yf,count(1) rs
|
|||
|
|
from crbsj
|
|||
|
|
where 1=1 " + where + @"
|
|||
|
|
group by CONVERT(varchar(7),bklrsj,121)";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getydcrbfltj(string bdt)
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
dt.Columns.Add("fl");
|
|||
|
|
dt.Columns.Add("bq");
|
|||
|
|
dt.Columns.Add("nl");
|
|||
|
|
dt.Columns.Add("sy");
|
|||
|
|
string sql = @"select c.zdfl,count(1) fbrs from crbsj a
|
|||
|
|
join Sz_infectiousDisease_category b on a.zd=b.diseasename
|
|||
|
|
join sz_zdfl c on c.id=b.infectiousdiseasecate where CONVERT(varchar(7),a.bklrsj,121)='" + bdt + @"'
|
|||
|
|
group by c.zdfl";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
var listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.zdfl.ToString();
|
|||
|
|
dr["bq"] = bq.fbrs;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
sql = @"select c.zdfl,count(1) fbrs from crbsj a
|
|||
|
|
join Sz_infectiousDisease_category b on a.zd=b.diseasename
|
|||
|
|
join sz_zdfl c on c.id=b.infectiousdiseasecate where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddYears(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
group by c.zdfl";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.zdfl.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["nl"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.zdfl.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = bq.fbrs;
|
|||
|
|
dr["sy"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
sql = @"select c.zdfl,count(1) fbrs from crbsj a
|
|||
|
|
join Sz_infectiousDisease_category b on a.zd=b.diseasename
|
|||
|
|
join sz_zdfl c on c.id=b.infectiousdiseasecate where CONVERT(varchar(7),a.bklrsj,121)='" + DateTime.Parse(bdt + "-01").AddMonths(-1).ToString("yyyy-MM") + @"'
|
|||
|
|
group by c.zdfl";
|
|||
|
|
listd = conn.Query(sql).ToList();
|
|||
|
|
foreach (var bq in listd)
|
|||
|
|
{
|
|||
|
|
DataRow[] drs = dt.Select("fl='" + bq.zdfl.ToString() + "'");
|
|||
|
|
if (drs.Length > 0)
|
|||
|
|
{
|
|||
|
|
drs[0]["sy"] = bq.fbrs;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataRow dr = dt.NewRow();
|
|||
|
|
dr["fl"] = bq.zdfl.ToString();
|
|||
|
|
dr["bq"] = 0;
|
|||
|
|
dr["nl"] = 0;
|
|||
|
|
dr["sy"] = bq.fbrs;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getgxbdqfx(string bdt, string edt)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
|
|||
|
|
DateTime dt1 = DateTime.MinValue;
|
|||
|
|
DateTime dt2 = DateTime.MinValue;
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(bdt, out dt1))
|
|||
|
|
{
|
|||
|
|
where += " and bklrsj>@sbrq";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(edt, out dt2))
|
|||
|
|
{
|
|||
|
|
where += " and bklrsj<@sbrq1";
|
|||
|
|
dt2.AddDays(1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string sql = @"select s.townName dqname,count(1) fbrs
|
|||
|
|
from gxbsj o join Sz_town s
|
|||
|
|
on o.zzbm = SUBSTRING(s.townCode, 1, 8) where 1=1 and s.countyCode='3714020000' " + where
|
|||
|
|
+ " group by s.townName";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql, new { sbrq = dt1, sbrq1 = dt2 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getnczdqfx(string bdt, string edt)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
|
|||
|
|
DateTime dt1 = DateTime.MinValue;
|
|||
|
|
DateTime dt2 = DateTime.MinValue;
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(bdt, out dt1))
|
|||
|
|
{
|
|||
|
|
where += " and bklrsj>@sbrq";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(edt, out dt2))
|
|||
|
|
{
|
|||
|
|
where += " and bklrsj<@sbrq1";
|
|||
|
|
dt2.AddDays(1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string sql = @"select s.townName dqname,count(1) fbrs
|
|||
|
|
from nczsj o join Sz_town s
|
|||
|
|
on o.zzbm = SUBSTRING(s.townCode, 1, 8) where 1=1 and s.countyCode='3714020000' " + where
|
|||
|
|
+ " group by s.townName";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql, new { sbrq = dt1, sbrq1 = dt2 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getcrbdqfx(string bdt, string edt,string bz="全部")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string where = "";
|
|||
|
|
if (!(string.IsNullOrEmpty(bz) || bz == "全部"))
|
|||
|
|
{
|
|||
|
|
where += " and o.zd='" + bz + "'";
|
|||
|
|
}
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
|
|||
|
|
DateTime dt1 = DateTime.MinValue;
|
|||
|
|
DateTime dt2 = DateTime.MinValue;
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(bdt, out dt1))
|
|||
|
|
{
|
|||
|
|
where += " and bklrsj>@sbrq";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(edt, out dt2))
|
|||
|
|
{
|
|||
|
|
where += " and bklrsj<@sbrq1";
|
|||
|
|
dt2.AddDays(1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string sql = @"select s.townName dqname,count(1) fbrs
|
|||
|
|
from crbsj o join Sz_town s
|
|||
|
|
on o.zzbm = SUBSTRING(s.townCode, 1, 8) where 1=1 and s.countyCode='3714020000' " + where
|
|||
|
|
+ " group by s.townName";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql, new { sbrq = dt1, sbrq1 = dt2 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getzldqfx(string bdt, string edt)
|
|||
|
|
{
|
|||
|
|
string where = "";
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
|
|||
|
|
DateTime dt1 = DateTime.MinValue;
|
|||
|
|
DateTime dt2 = DateTime.MinValue;
|
|||
|
|
if (!string.IsNullOrEmpty(bdt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(bdt, out dt1))
|
|||
|
|
{
|
|||
|
|
where += " and sbrq>@sbrq";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(edt))
|
|||
|
|
{
|
|||
|
|
if (DateTime.TryParse(edt, out dt2))
|
|||
|
|
{
|
|||
|
|
where += " and sbrq<@sbrq1";
|
|||
|
|
dt2.AddDays(1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string sql = @"select s.townName dqname,count(1) fbrs
|
|||
|
|
from old_zl o join Sz_town s
|
|||
|
|
on o.czzbm = SUBSTRING(s.townCode, 1, 8) where 1=1 and s.countyCode='3714020000' " + where
|
|||
|
|
+ " group by s.townName";
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql, new { sbrq = dt1, sbrq1 = dt2 });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public object getzlListPage(int page, int pagesize, string key)
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string nsql = @"SELECT row_number() over(order by id) as rownum, *
|
|||
|
|
FROM [old_zl] where 1=1";
|
|||
|
|
if (!string.IsNullOrEmpty(key))
|
|||
|
|
{
|
|||
|
|
nsql += " and xm like '%" + key + "%'";
|
|||
|
|
}
|
|||
|
|
string sql = "select * from (" + nsql + ") a where rownum>(" + page + "-1)*" + pagesize + " and rownum<=" + page + "*" + pagesize;
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query(sql).ToList();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int getzlcount(string key)
|
|||
|
|
{
|
|||
|
|
//throw new NotImplementedException();
|
|||
|
|
string sql = "select count(1) from old_zl where 1=1";
|
|||
|
|
if (!string.IsNullOrEmpty(key))
|
|||
|
|
{
|
|||
|
|
sql += " and xm like @xm";
|
|||
|
|
}
|
|||
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.ExecuteScalar<int>(sql, new { xm = "%" + key + "%" });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|