155 lines
4.6 KiB
C#
155 lines
4.6 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_jcxm))]
|
|
public class t_jcxmBll : It_jcxm
|
|
{
|
|
/// <summary>
|
|
/// 获取所有科室
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<Entities.t_jcxm> getAllJcxm(int ksbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
//select a,b,c from t_jcxms
|
|
var data = from db1 in db.t_jcxms where db1.ksbm == ksbm select db1;
|
|
return data.OrderBy(y => y.xssx).ToList();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 根据科室编码和是否注销的标识 查询检查项目
|
|
/// </summary>
|
|
/// <param name="ksbm">科室编码</param>
|
|
/// <param name="ifZhuxiao">是否注销标识</param>
|
|
/// <returns></returns>
|
|
public List<Entities.t_jcxm> GetAllJcxm(int ksbm, short zx)
|
|
{
|
|
using (DbEntities db=new DbEntities())
|
|
{
|
|
var data = from t in db.t_jcxms where t.zhuxiao == zx && t.ksbm == ksbm select t;
|
|
if (data.Any())
|
|
{
|
|
return data.ToList();
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
}
|
|
public OperationResult Update(t_jcxm jcxm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
db.t_jcxms.OrmAccessor.Update(jcxm);
|
|
}
|
|
OperationResult or = new OperationResult();
|
|
or.State = 1;
|
|
or.Message = "修改成功";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(jcxm);
|
|
return or;
|
|
}
|
|
public OperationResult Insert(t_jcxm jcxm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
db.t_jcxms.OrmAccessor.Insert(jcxm);
|
|
}
|
|
OperationResult or = new OperationResult();
|
|
or.State = 1;
|
|
or.Message = "添加成功";
|
|
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(jcxm);
|
|
return or;
|
|
}
|
|
public List<t_jcxm> getJcxmByjcxmbm(int jcxmbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from db1 in db.t_jcxms
|
|
join xs in db.t_zhxmmxs on db1.jcxmbm equals xs.xmbm
|
|
where xs.zhbm == jcxmbm
|
|
select new
|
|
{
|
|
db1
|
|
}.db1;
|
|
return data.OrderBy(t => t.xssx).ToList();
|
|
}
|
|
}
|
|
|
|
public List<t_jcxm> getJcxmByjcxmmc(string jcxmmc)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from db1 in db.t_jcxms
|
|
join xs in db.t_zhxmmxs on db1.jcxmbm equals xs.xmbm
|
|
where (db1.jcxmmc.Contains(jcxmmc))
|
|
select new
|
|
{
|
|
db1
|
|
}.db1;
|
|
return data.OrderBy(t => t.xssx).ToList();
|
|
}
|
|
}
|
|
|
|
public t_jcxm getJcxm(int jcxmbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = db.t_jcxms.Where(t => t.jcxmbm == jcxmbm);
|
|
if (data.Count() != 0)
|
|
{
|
|
return data.First();
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public t_ks getKs(int ksbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = db.t_kss.Where(t => t.ksbm == ksbm);
|
|
if (data.Count() != 0)
|
|
{
|
|
return data.First();
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public String getAllJcxmStr(int ksbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
//select a,b,c from t_jcxms
|
|
var data = db.t_jcxms.Where(t => t.ksbm == ksbm && t.zhuxiao == 0 ).OrderBy(t=>t.xssx).Select(t => new
|
|
{
|
|
zdjg = t.jcxmmc,
|
|
zdxh = t.jcxmbm
|
|
});
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|