tijian_jichuang/Code/SOH.BLL.Host/t_zdyxsfBll.cs
2025-02-20 11:54:48 +08:00

109 lines
3.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EAS.Services;
using SOH.Entities;
using SOH.Data;
namespace SOH.BLL
{
[ServiceObject("重大阳性随访表")]
[ServiceBind(typeof(It_zdyxsf))]
public class t_zdyxsfBll : It_zdyxsf
{
public Data.OperationResult Update(t_zdyxsf zdyxsf)
{
OperationResult or = new OperationResult();
using (DbEntities db = new DbEntities())
{
t_zdyxsf z = db.t_zdyxsfs.Where(t => t.tm == zdyxsf.tm && t.ksmc == zdyxsf.ksmc && t.jcxm== zdyxsf.jcxm).FirstOrDefault();
if (z == null)
{
db.t_zdyxsfs.OrmAccessor.Insert(zdyxsf);
}
else
{
db.t_zdyxsfs.OrmAccessor.Update(zdyxsf);
}
}
or.State = 1;
or.Message = "临时保存成功";
return or;
}
public string GetAllZdyxList()
{
using (DbEntities db = new DbEntities())
{
var data = from t in db.t_zdyxsfs
select t;
return Newtonsoft.Json.JsonConvert.SerializeObject(data.ToList());
}
}
public string GetTjZdyxList(short yydm)
{
using (DbEntities db = new DbEntities())
{
var data = from t in db.t_zdyxsfs
join j in db.t_ttgzbs on t.tm equals j.tm
join h in db.t_hts on j.htbm equals h.htbm
join k in db.t_khs on h.khbm equals k.khbm
where j.fddm == yydm
select new
{
t.tm,
j.hyh,
t.xm,
t.xb,
xb2 = (j.xb == 0) ? "男" : "女",
t.nl,
j.hyzk,
hyzk2 = j.hyzk == 0 ? "未婚" : (j.hyzk == 1 ? "已婚" : "未知 "),
t.tjrq,
j.tmztz,
bj = "团检报告",
dwmc = k.khmc,
tjxm=t.jcxm,
lxdh=t.tel,
tjlx= "团检",
sbys=t.sbys,
sbrq=t.sbrq,
};
return Newtonsoft.Json.JsonConvert.SerializeObject(data.ToList());
}
}
public string GetGjZdyxList(short yydm)
{
using (DbEntities db = new DbEntities())
{
var data = from t in db.t_zdyxsfs
join g in db.t_grgzbs on t.tm equals g.tm
where g.fddm == yydm
select new
{
g.tm,
g.hyh,
g.xm,
g.xb,
xb2 = (g.xb == 0) ? "男" : "女",
g.nl,
g.hyzk,
hyzk2 = g.hyzk == 0 ? "未婚" : (g.hyzk == 1 ? "已婚" : "未知 "),
g.tjrq,
g.tmztz,
bj = "个检报告",
dwmc = "散客",
tjxm = t.jcxm,
lxdh = t.tel,
tjlx = "个检",
sbys = t.sbys,
sbrq = t.sbrq,
};
return Newtonsoft.Json.JsonConvert.SerializeObject(data.ToList());
}
}
}
}