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 { /// /// 获取所有科室 /// /// public List 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(); } } /// /// 根据科室编码和是否注销的标识 查询检查项目 /// /// 科室编码 /// 是否注销标识 /// public List 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 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 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); } } } }