コード例 #1
0
ファイル: NoticeList.cs プロジェクト: bertyang/Mobile
        public static List <TAmbulance> GetAmbulanceByStationID(string id, Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
        {
            using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
            {
                if (string.IsNullOrEmpty(id) || id == "--请选择--")
                {
                    switch (bp.GetGroupRangePower("searchBound"))
                    {
                    case "SearchAll":
                        return(dbContext.TAmbulance.Where(t => t.是否有效 == true).ToList());

                    case "SearchCenter":   //查找所属分中心
                        return((from p in dbContext.TAmbulance
                                join s in dbContext.TStation on p.分站编码 equals s.编码
                                where p.是否有效 == true && s.中心编码 == UserInfo.CenterCode
                                select p).ToList());

                    case "SearchOrganization":   //查找分站
                        return(dbContext.TAmbulance.Where(t => t.是否有效 == true && UserInfo.Sta.Contains(t.分站编码)).ToList());

                    default:   //没有设置查询权限
                        return(null);
                        //break;
                    }
                }
                return(dbContext.TAmbulance.Where(t => t.分站编码 == id && t.是否有效 == true).ToList());
            }
        }
コード例 #2
0
        public static List <TStation> LoadAllStations(Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
        {
            using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
            {
                var list = dbContext.TStation.Where(s => s.是否有效 == true).OrderBy(s => s.顺序号).ToList();

                string Search = bp.GetGroupRangePower("searchBound");

                switch (bp.GetGroupRangePower("searchBound"))
                {
                case "SearchAll":
                    break;

                case "SearchCenter":    //查找所属分中心
                    list = list.Where(p => UserInfo.CenterCode == p.中心编码).ToList();
                    break;

                case "SearchOrganization":    //查找所属分站
                    list = list.Where(p => UserInfo.Sta.Contains(p.编码)).ToList();
                    break;

                default:    //没有设置查询权限
                    return(null);
                    //break;
                }

                return(list);
            }
        }
コード例 #3
0
ファイル: NoticeList.cs プロジェクト: bertyang/Mobile
        public static List <TDesk> GetAllDesk(Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
        {
            using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
            {
                switch (bp.GetGroupRangePower("searchBound"))
                {
                case "SearchAll":
                    return(dbContext.TDesk.Where(t => t.受理台类型编码 == 4 || t.受理台类型编码 == 17).ToList());

                case "SearchCenter":   //查找所属分中心
                    return(dbContext.TDesk.Where(t => (t.受理台类型编码 == 4 || t.受理台类型编码 == 17) && t.中心编码 == UserInfo.CenterCode).ToList());

                default:   //没有设置查询权限
                    return(null);
                    //break;
                }
            }
        }
コード例 #4
0
ファイル: Accident.cs プロジェクト: bertyang/Mobile
        /// <summary>
        /// 获取所有满足条件的重大事故
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="rows">行数</param>
        /// <param name="order">排序顺序</param>
        /// <param name="sort">排序字段</param>
        /// <param name="startTime">起始时刻</param>
        /// <param name="endTime">中止时刻</param>
        /// <param name="accidentName">事故名称</param>
        /// <param name="place">区域</param>
        /// <param name="type">事故类型</param>
        /// <param name="level">事故等级</param>
        /// <returns></returns>
        public static object GetAccident(int page, int rows, string order, string sort,
                                         DateTime startTime, DateTime endTime,
                                         string accidentName, string place, int?type, int?level,
                                         Anchor.FA.Utility.ButtonPower b, C_WorkerDetail userDetail)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                //高级版病例
                if (AppConfig.GetStringConfigValue("PatientRecordTable") == "M_PatientRecord")
                {
                    var list = from tae in dbContext.TAlarmEvent
                               join tzt in dbContext.TZAccidentType on tae.事故类型编码 equals tzt.编码 into left_tzt
                               from tzt in left_tzt.DefaultIfEmpty()
                               join tzl in dbContext.TZAccidentLevel on tae.事故等级编码 equals tzl.编码 into left_tzl
                               from tzl in left_tzl.DefaultIfEmpty()
                               join tp in dbContext.TPerson on tae.首次调度员编码 equals tp.编码 into left_tp
                               from tp in left_tp.DefaultIfEmpty()
                               where tae.首次受理时刻 >= startTime && tae.首次受理时刻 <= endTime &&
                               tae.事件编码 == tae.所属事故编码 && tae.事故类型编码 != -1
                               select new
                    {
                        关联事件数  = (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t).Count(),
                        事故编码   = tae.事件编码,
                        事故名称   = tae.事件名称,
                        调度员    = tp.姓名,
                        事发时间   = tae.首次受理时刻,
                        事发区域   = tae.区域,
                        事故类型   = tzt.称 == null ? "未找到" : tzt.称,
                        事故等级   = tzl.称 == null ? "未找到" : tzl.称,
                        伤亡总人数一 = (from p in dbContext.TAccidentPatient
                                  where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(p.事故编码)
                                  select p).Count(),
                        伤亡总人数二 = (from tpr in dbContext.M_PatientRecord
                                  where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(tpr.TaskCode.Substring(1, 16))
                                  select tpr).Count(),
                        伤亡总人数三 = (from tar in dbContext.TAccidentReport
                                  where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(tar.事故编码)
                                  select tar.受伤人数).Count()
                                 + (from tar in dbContext.TAccidentReport
                                    where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(tar.事故编码)
                                    select tar.死亡人数).Count(),
                        事故类型编码 = tae.事故类型编码,
                        事故等级编码 = tae.事故等级编码,
                        中心编码   = tae.中心编码
                    };
                    //动态Where
                    if (!string.IsNullOrEmpty(accidentName))
                    {
                        list = list.Where(t => t.事故名称.Contains(accidentName));
                    }
                    if (!string.IsNullOrEmpty(place) && place != "--请选择--")
                    {
                        list = list.Where(t => t.事发区域.Contains(place));
                    }

                    if (type != null)
                    {
                        list = list.Where(t => t.事故类型编码 == type);
                    }

                    if (level != null)
                    {
                        list = list.Where(t => t.事故等级编码 == level);
                    }

                    switch (b.GetGroupRangePower("searchBound"))
                    {
                    case "SearchAll":    //查找所有
                        break;

                    case "SearchCenter":    //查找所属分中心
                        list = list.Where(t => t.中心编码 == userDetail.CenterCode);
                        break;

                    default:    //没有设置查询权限
                        return(null);
                    }

                    long total = list.LongCount();
                    list = list.OrderByDescending(t => t.事发时间);
                    list = list.Skip((page - 1) * rows).Take(rows);

                    if (Config.GetKeyValue("WoundedMode") == "0")
                    {
                        var listAccident = list.ToList().Select(o => new
                        {
                            关联事件数 = o.关联事件数,
                            事故编码  = o.事故编码,
                            关联    = o.事故编码,
                            打印    = o.事故编码,
                            事故名称  = o.事故名称,
                            调度员   = o.调度员,
                            事发时间  = o.事发时间.ToString("yyyy-MM-dd HH:mm:ss"),
                            事发区域  = o.事发区域,
                            事故类型  = o.事故类型,
                            事故等级  = o.事故等级,
                            伤亡总人数 = o.伤亡总人数一,
                        });
                        var result = new { total = total, rows = listAccident.ToList() };
                        return(result);
                    }
                    else if (Config.GetKeyValue("WoundedMode") == "1")
                    {
                        var listAccident = list.ToList().Select(o => new
                        {
                            关联事件数 = o.关联事件数,
                            事故编码  = o.事故编码,
                            关联    = o.事故编码,
                            打印    = o.事故编码,
                            事故名称  = o.事故名称,
                            调度员   = o.调度员,
                            事发时间  = o.事发时间.ToString("yyyy-MM-dd HH:mm:ss"),
                            事发区域  = o.事发区域,
                            事故类型  = o.事故类型,
                            事故等级  = o.事故等级,
                            伤亡总人数 = o.伤亡总人数二,
                        });
                        var result = new { total = total, rows = listAccident.ToList() };
                        return(result);
                    }
                    else if (Config.GetKeyValue("WoundedMode") == "2")
                    {
                        var listAccident = list.ToList().Select(o => new
                        {
                            关联事件数 = o.关联事件数,
                            事故编码  = o.事故编码,
                            关联    = o.事故编码,
                            打印    = o.事故编码,
                            事故名称  = o.事故名称,
                            调度员   = o.调度员,
                            事发时间  = o.事发时间.ToString("yyyy-MM-dd HH:mm:ss"),
                            事发区域  = o.事发区域,
                            事故类型  = o.事故类型,
                            事故等级  = o.事故等级,
                            伤亡总人数 = o.伤亡总人数三,
                        });
                        var result = new { total = total, rows = listAccident.ToList() };
                        return(result);
                    }
                    return(null);
                }
                else //标准版病例
                {
                    var list = from tae in dbContext.TAlarmEvent
                               join tzt in dbContext.TZAccidentType on tae.事故类型编码 equals tzt.编码 into left_tzt
                               from tzt in left_tzt.DefaultIfEmpty()
                               join tzl in dbContext.TZAccidentLevel on tae.事故等级编码 equals tzl.编码 into left_tzl
                               from tzl in left_tzl.DefaultIfEmpty()
                               join tp in dbContext.TPerson on tae.首次调度员编码 equals tp.编码 into left_tp
                               from tp in left_tp.DefaultIfEmpty()
                               where tae.首次受理时刻 >= startTime && tae.首次受理时刻 <= endTime &&
                               tae.事件编码 == tae.所属事故编码 && tae.事故类型编码 != -1
                               select new
                    {
                        关联事件数  = (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t).Count(),
                        事故编码   = tae.事件编码,
                        事故名称   = tae.事件名称,
                        调度员    = tp.姓名,
                        事发时间   = tae.首次受理时刻,
                        事发区域   = tae.区域,
                        事故类型   = tzt.称 == null ? "未找到" : tzt.称,
                        事故等级   = tzl.称 == null ? "未找到" : tzl.称,
                        伤亡总人数一 = (from p in dbContext.TAccidentPatient
                                  where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(p.事故编码)
                                  select p).Count(),
                        伤亡总人数二 = (from tpr in dbContext.TPatientRecord
                                  where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(tpr.任务编码.Substring(1, 16))
                                  select tpr).Count(),
                        伤亡总人数三 = (from tar in dbContext.TAccidentReport
                                  where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(tar.事故编码)
                                  select tar.受伤人数).Count()
                                 + (from tar in dbContext.TAccidentReport
                                    where (from t in dbContext.TAlarmEvent where t.所属事故编码 == tae.事件编码 select t.事件编码).Contains(tar.事故编码)
                                    select tar.死亡人数).Count(),
                        事故类型编码 = tae.事故类型编码,
                        事故等级编码 = tae.事故等级编码,
                        中心编码   = tae.中心编码
                    };
                    //动态Where
                    if (!string.IsNullOrEmpty(accidentName))
                    {
                        list = list.Where(t => t.事故名称.Contains(accidentName));
                    }
                    if (!string.IsNullOrEmpty(place) && place != "--请选择--")
                    {
                        list = list.Where(t => t.事发区域.Contains(place));
                    }

                    if (type != null)
                    {
                        list = list.Where(t => t.事故类型编码 == type);
                    }

                    if (level != null)
                    {
                        list = list.Where(t => t.事故等级编码 == level);
                    }

                    switch (b.GetGroupRangePower("searchBound"))
                    {
                    case "SearchAll":    //查找所有
                        break;

                    case "SearchCenter":    //查找所属分中心
                        list = list.Where(t => t.中心编码 == userDetail.CenterCode);
                        break;

                    default:    //没有设置查询权限
                        return(null);
                    }

                    long total = list.LongCount();
                    list = list.OrderByDescending(t => t.事发时间);
                    list = list.Skip((page - 1) * rows).Take(rows);

                    if (Config.GetKeyValue("WoundedMode") == "0")
                    {
                        var listAccident = list.ToList().Select(o => new
                        {
                            关联事件数 = o.关联事件数,
                            事故编码  = o.事故编码,
                            关联    = o.事故编码,
                            打印    = o.事故编码,
                            事故名称  = o.事故名称,
                            调度员   = o.调度员,
                            事发时间  = o.事发时间.ToString("yyyy-MM-dd HH:mm:ss"),
                            事发区域  = o.事发区域,
                            事故类型  = o.事故类型,
                            事故等级  = o.事故等级,
                            伤亡总人数 = o.伤亡总人数一,
                        });
                        var result = new { total = total, rows = listAccident.ToList() };
                        return(result);
                    }
                    else if (Config.GetKeyValue("WoundedMode") == "1")
                    {
                        var listAccident = list.ToList().Select(o => new
                        {
                            关联事件数 = o.关联事件数,
                            事故编码  = o.事故编码,
                            关联    = o.事故编码,
                            打印    = o.事故编码,
                            事故名称  = o.事故名称,
                            调度员   = o.调度员,
                            事发时间  = o.事发时间.ToString("yyyy-MM-dd HH:mm:ss"),
                            事发区域  = o.事发区域,
                            事故类型  = o.事故类型,
                            事故等级  = o.事故等级,
                            伤亡总人数 = o.伤亡总人数二,
                        });
                        var result = new { total = total, rows = listAccident.ToList() };
                        return(result);
                    }
                    else if (Config.GetKeyValue("WoundedMode") == "2")
                    {
                        var listAccident = list.ToList().Select(o => new
                        {
                            关联事件数 = o.关联事件数,
                            事故编码  = o.事故编码,
                            关联    = o.事故编码,
                            打印    = o.事故编码,
                            事故名称  = o.事故名称,
                            调度员   = o.调度员,
                            事发时间  = o.事发时间.ToString("yyyy-MM-dd HH:mm:ss"),
                            事发区域  = o.事发区域,
                            事故类型  = o.事故类型,
                            事故等级  = o.事故等级,
                            伤亡总人数 = o.伤亡总人数三,
                        });
                        var result = new { total = total, rows = listAccident.ToList() };
                        return(result);
                    }
                    return(null);
                }
            }
        }
コード例 #5
0
 public List <TStation> LoadAllStations(Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
 {
     return(DAL.BasicInfo.Ambulance.LoadAllStations(bp, UserInfo));
 }
コード例 #6
0
 public object AmbulanceListSearch(string RealCode, string AmbNum, string Station, string AmbType, string AmbGroup
                                   , int page, int rows, string order, string sort, bool?IsActive, Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
 {
     return(DAL.BasicInfo.Ambulance.AmbulanceListSearch(RealCode, AmbNum, Station, AmbType, AmbGroup
                                                        , page, rows, order, sort, IsActive, bp, UserInfo));
 }
コード例 #7
0
ファイル: NoticeList.cs プロジェクト: bertyang/Mobile
        public static object GetNoticeList(int page, int rows, string order, string sort, DateTime startTime, DateTime endTime,
                                           int sendType, string station, string vehicle, Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("SELECT distinct ID=A.编码,Num=A.编码,content=A.内容,sendTime=A.发送时刻,A.操作员编码,worker=P.姓名,sendList=dbo.GetStrRecAmb(A.编码),typeName=tznt.名称,typeCode=A.类型编码 ");
                strSQL.Append(@",backCount=(select COUNT(*) from MobileGet 
                    where Mobile in (select 目的地编码 from TNoticeLog where 通知单编码=A.编码)
                    and [GetDate] > (select 发送时刻 from TNotice where 编码=A.编码)
                    and [GetDate] < (select dateadd(n,30,发送时刻) from TNotice where 编码=A.编码)) ");
                strSQL.Append("from TNotice A  ");
                //strSQL.Append("left join B_WORKER_ROLE B on rtrim(A.操作员编码)=rtrim(B.TPerson编码) and rtrim(B.TPerson编码) !='' ");
                //strSQL.Append("left join B_WORKER W on B.WorkerID=W.ID ");
                strSQL.Append("inner join TPerson P on A.操作员编码=P.编码 ");
                strSQL.Append("inner join TStation S on P.分站编码=S.编码 ");
                strSQL.Append("left join TZNoticeType tznt on A.类型编码=tznt.编码 ");

                StringBuilder sbWhereClause = new StringBuilder();
                //车辆通知0、台通知1、短信通知2、分中心通知3、分站通知4、收到短信5
                switch (sendType)
                {
                case 0:                  //车辆通知
                    if (vehicle != "-1") //选择了车:只查询车辆通知
                    {
                        strSQL.Append(" inner join TNoticeLog L on A.编码=L.通知单编码 and L.目的地编码 = '" + vehicle + "' and A.类型编码=0 ");
                    }
                    else if (station.Trim() != "-1")                                                                                                                         //没选车,选了分站
                    {
                        strSQL.Append(" inner join TNoticeLog L on A.编码=L.通知单编码 and (L.目的地编码 in( select 车辆编码 from TAmbulance where 分站编码='" + station + "') and A.类型编码=0) "); //车辆通知
                    }
                    WhereClauseUtility.AddIntEqual("A.类型编码", sendType, sbWhereClause);
                    break;

                case 1:   //台通知
                    WhereClauseUtility.AddIntEqual("A.类型编码", sendType, sbWhereClause);
                    break;

                case 2:                         //短信通知
                    if (station.Trim() != "-1") //选了分站
                    {
                        strSQL.Append(" inner join TNoticeLog L on A.编码=L.通知单编码 and ( L.目的地编码 in(select EmpNo from B_WORKER_ROLE");

                        strSQL.Append(" where WorkerID in (select wo.WorkerID from B_WORKER_ORGANIZATION wo left join B_ORGANIZATION b on wo.OrgID = b.ID where b.编码='" + station + "')) and A.类型编码=2) ");   //短信通知2
                    }
                    WhereClauseUtility.AddIntEqual("A.类型编码", sendType, sbWhereClause);
                    break;

                case 4:                                                                                                           //分站通知
                    if (station.Trim() != "-1")                                                                                   //选了分站
                    {
                        strSQL.Append(" inner join TNoticeLog L on A.编码=L.通知单编码 and ( L.目的地编码 ='" + station + "' and A.类型编码=4)"); //分站通知4
                    }
                    WhereClauseUtility.AddIntEqual("A.类型编码", sendType, sbWhereClause);
                    break;

                default:                 //没有选择发送类型
                    if (vehicle != "-1") //选择了车:只查询车辆通知
                    {
                        strSQL.Append(" inner join TNoticeLog L on A.编码=L.通知单编码 and L.目的地编码 = '" + vehicle + "' and A.类型编码=0 ");
                        sbWhereClause.Append(" where A.类型编码=0 ");
                    }
                    else if (station.Trim() != "-1")   //没选车,选了分站
                    {
                        strSQL.Append(" inner join TNoticeLog L on A.编码=L.通知单编码 ");
                        strSQL.Append(" and (L.目的地编码 in( select 车辆编码 from TAmbulance where 分站编码='" + station + "') and A.类型编码=0 ");                                                                       //车辆通知
                        strSQL.Append(" or L.目的地编码 in(select EmpNo from B_WORKER_ROLE");                                                                                                                  //短信通知2
                        strSQL.Append(" where WorkerID in (select wo.WorkerID from B_WORKER_ORGANIZATION wo left join B_ORGANIZATION b on wo.OrgID = b.ID where b.编码='" + station + "')) and A.类型编码=2 "); //短信通知2
                        strSQL.Append(" or L.目的地编码 ='" + station + "' and A.类型编码=4)");                                                                                                                    //分站通知4
                        sbWhereClause.Append(" where A.类型编码 in(0,2,4) ");
                    }
                    break;
                }
                WhereClauseUtility.AddDateTimeGreaterThan("A.发送时刻", startTime, sbWhereClause);
                WhereClauseUtility.AddDateTimeLessThan("A.发送时刻", endTime, sbWhereClause);

                switch (bp.GetGroupRangePower("searchBound"))
                {
                case "SearchAll":
                    break;

                case "SearchCenter":   //查找所属分中心
                    WhereClauseUtility.AddIntEqual("S.中心编码", UserInfo.CenterCode, sbWhereClause);
                    break;

                default:   //没有设置查询权限
                    return(null);
                    //break;
                }

                strSQL.Append(sbWhereClause);

                strSQL.Append(" order by A.发送时刻 desc");
                string sql   = strSQL.ToString();
                var    list1 = dbContext.ExecuteQuery <C_Notice>(sql);
                var    list2 = dbContext.ExecuteQuery <C_Notice>(sql);

                long total = list1.LongCount();
                list2 = list2.OrderByDescending(t => t.sendTime);
                list2 = list2.Skip((page - 1) * rows).Take(rows);

                return(new { total = total, rows = list2.ToList() });
            }
        }
コード例 #8
0
ファイル: TelLog.cs プロジェクト: bertyang/Mobile
        //public static object LoadAllTelLogByPage(DateTime begin, DateTime end, int page, int rows, string order, string sort)
        //{
        //    using (MainDataContext dbContext = new MainDataContext())
        //    {
        //        var list = (from p in dbContext.TTelLog
        //                    join o in dbContext.TZTelLogRecordType on p.记录类型编码 equals o.编码
        //                    join o1 in dbContext.TDesk on p.台号 equals o1.台号
        //                    join o2 in dbContext.TPerson  on p.调度员工号 equals o2.编码
        //                    join o3 in dbContext.TZTelLogResult on p.结果编码 equals o3.编码
        //                    where p.产生时刻 > begin && p.产生时刻 < end
        //                    select new
        //                    {
        //                        ID = p.编码,
        //                        RecordStyle=o.名称,
        //                        Tel=p.对方电话,
        //                        RecordTime = p.产生时刻,
        //                        CallTime = p.通话时刻,
        //                        Desk=o1.显示名称,
        //                        Dispatcher=o2.姓名,
        //                        RecordCode=p.录音号,
        //                        Result=o3.名称,
        //                    }).Take(100);
        //        long total = list.LongCount();
        //        list = list.OrderByDescending(p => p.RecordTime);
        //        list = list.Skip((page - 1) * rows).Take(rows);
        //        var list2 = list.ToList().Select(o => new
        //        {
        //            ID = o.ID,
        //            RecordStyle = o.RecordStyle,
        //            Tel = o.Tel,
        //            RecordTime = o.RecordTime.ToString(),
        //            Desk = o.Desk,
        //            Dispatcher = o.Dispatcher,
        //            RecordCode = o.RecordCode,
        //            Result = o.Result,
        //            CallTime = o.CallTime.ToString()
        //        });
        //        var result = new { total = total, rows = list2.ToList() };

        //        return result;
        //    }

        //}
        public static object Search(DateTime begin, DateTime end, string tel, string rec, string op, string res, string des,
                                    int page, int rows, string order, string sort, Anchor.FA.Utility.ButtonPower b, C_WorkerDetail userDetail)
        {
            using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
            {
                var list = (from p in dbContext.TTelLog
                            join o in dbContext.TZTelLogRecordType on p.记录类型编码 equals o.编码 into temp
                            from o in temp.DefaultIfEmpty()
                            join o1 in dbContext.TDesk on p.台号 equals o1.台号 into temp1
                            from o1 in temp1.DefaultIfEmpty()
                            join o2 in dbContext.TPerson on p.调度员工号 equals o2.编码 into temp2
                            from o2 in temp2.DefaultIfEmpty()
                            join o3 in dbContext.TZTelLogResult on p.结果编码 equals o3.编码 into temp3
                            from o3 in temp3.DefaultIfEmpty()
                            join o4 in dbContext.TZTelLogOperator on p.操作说明编码 equals o4.编码 into temp4
                            from o4 in temp4.DefaultIfEmpty()

                            where p.产生时刻 > begin && p.产生时刻 <end
                                                            orderby p.产生时刻 descending
                                                            where p.产生时刻> begin && p.产生时刻 < end
                            orderby p.产生时刻 descending
                            select new
                {
                    ID = p.编码,
                    RecordStyle = o.称,
                    Tel = p.对方电话,
                    RecordTime = p.产生时刻,
                    InhaleTime = p.呼入时刻,
                    FellInTime = p.排队时刻,
                    ShakeBellTime = p.震铃时刻,
                    CallTime = p.通话时刻,
                    MiddleHandleTime = p.中间操作时刻,
                    FinishTime = p.结束时刻,
                    Desk = o1.显示名称,
                    Dispatcher = o2.姓名,
                    RecordCode = p.录音号,
                    Result = o3.称,
                    OP = o4.称,
                    CenterCode = p.中心编码,
                });

                if (!string.IsNullOrEmpty(tel))
                {
                    list = list.Where(o => o.Tel.Contains(tel));
                }
                if (!string.IsNullOrEmpty(rec) && rec != "请选择")
                {
                    list = list.Where(o => o.RecordStyle == rec);
                }
                if (!string.IsNullOrEmpty(op) && op != "请选择")
                {
                    list = list.Where(o => o.OP == op);
                }
                if (!string.IsNullOrEmpty(res) && res != "请选择")
                {
                    list = list.Where(o => o.Result == res);
                }
                if (!string.IsNullOrEmpty(des) && des != "请选择")
                {
                    list = list.Where(o => o.Desk == des);
                }

                switch (b.GetGroupRangePower("searchBound"))
                {
                case "SearchAll":    //查找所属分中心
                    break;

                case "SearchCenter":    //查找所属分中心
                    list = list.Where(t => t.CenterCode == userDetail.CenterCode);
                    break;

                default:    //没有设置查询权限
                    return(null);
                }

                long total = list.LongCount();
                //list = list.OrderBy(p => p.ID);
                list = list.Skip((page - 1) * rows).Take(rows);
                var list2 = list.ToList().Select(o => new
                {
                    ID               = o.ID,
                    Num              = o.ID,
                    RecordStyle      = o.RecordStyle,                 //记录类型
                    Tel              = o.Tel,                         //对方编码
                    RecordTime       = o.RecordTime.ToString(),       //产生时刻
                    InhaleTime       = o.InhaleTime.ToString(),       //呼入时刻
                    FellInTime       = o.FellInTime.ToString(),       //排队时刻
                    ShakeBellTime    = o.ShakeBellTime.ToString(),    //振铃时刻
                    CallTime         = o.CallTime.ToString(),         //通话时刻
                    MiddleHandleTime = o.MiddleHandleTime.ToString(), //中间操作时刻
                    FinishTime       = o.FinishTime.ToString(),       //完成时刻
                    Desk             = o.Desk,                        //台号
                    Dispatcher       = o.Dispatcher,                  //调度员
                    RecordCode       = o.RecordCode,                  //录音号
                    Result           = o.Result,                      //结果
                    OP               = o.OP                           //操作说明
                });
                //var   list2  =(from p in list
                //               join o5 in dbContext.TAlarmCall on p.RecordCode equals o5.录音号 into temp5
                //                from o5 in temp5.DefaultIfEmpty()
                //               select new
                //                {
                //                    ID = p.ID,
                //                    RecordStyle = p.RecordStyle,
                //                    Tel = p.Tel,
                //                    RecordTime = p.RecordTime.ToString(),
                //                    Desk = p.Desk,
                //                    Dispatcher = p.Dispatcher,
                //                    RecordCode = p.RecordCode,
                //                    Result = p.Result,
                //                    CallTime = p.CallTime.ToString(),
                //                    AlarmEventCode = o5.事件编码,
                //                });
                var result = new { total = total, rows = list2.ToList() };

                return(result);
            }
        }
コード例 #9
0
        public static object AmbulanceListSearch(string RealCode, string AmbNum, string Station, string AmbType, string AmbGroup
                                                 , int page, int rows, string order, string sort, bool?IsActive, Anchor.FA.Utility.ButtonPower bp, C_WorkerDetail UserInfo)
        {
            using (MainDataContext dbContext = new MainDataContext(AppConfig.ConnectionStringDispatch))
            {
                var list = (from p in dbContext.TAmbulance

                            join o in dbContext.TZAmbulanceLevel on p.车辆等级编码 equals o.编码 into o_join
                            from o in o_join.DefaultIfEmpty()

                            join o1 in dbContext.TZAmbulanceState on p.工作状态编码 equals o1.编码 into o1_join
                            from o1 in o1_join.DefaultIfEmpty()

                            join o2 in dbContext.TZAmbulanceType on p.车辆类型编码 equals o2.编码 into o2_join
                            from o2 in o2_join.DefaultIfEmpty()

                            join o3 in dbContext.TStation on p.分站编码 equals o3.编码 into o3_join
                            from o3 in o3_join.DefaultIfEmpty()

                            join o4 in dbContext.TTask on p.任务编码 equals o4.任务编码 into o4_join
                            from o4 in o4_join.DefaultIfEmpty()

                            select new
                {
                    ID = p.车辆编码,
                    StationCode = p.分站编码,
                    CenterCode = o3.中心编码,
                    AmbTypeCode = p.车辆类型编码,
                    CardNum = p.车牌号码,
                    RealSign = p.实际标识,
                    CommandAspectId = p.命令单发送去向编码,

                    TaskCode = p.任务编码,
                    UserOrder = p.用户流水号,
                    WorkStateId = p.工作状态编码,
                    OndutyTaskCount = p.当班执行任务数,
                    Driver = p.司机,
                    Doctor = p.医生,
                    Nurse = p.护士,
                    Litter = p.担架工,
                    Salver = p.抢救员,
                    KeyPressTime = p.键时刻,
                    FollowTel = p.随车电话,
                    GroupNumber = p.分组编码,
                    LevelId = p.车辆等级编码,
                    IsOnline = p.是否在线,
                    IsActive = p.是否有效,

                    //Station = o3 == null ? null : o3.名称,
                    //Type = o2 == null ? null : o2.名称,
                    //Level = o == null ? null : o.名称,
                    //State = o1 == null ? null : o1.名称,
                    //Color = o1 == null ? (Nullable<int>)null : o1.颜色,
                    Station = o3.称,
                    Type = o2.称,
                    Level = o.称,
                    State = o1.称,
                    Color = (Nullable <int>)o1.颜色,
                    Tel = p.随车电话,
                    AlarmEventCode = o4.事件编码,
                });
                if (!string.IsNullOrEmpty(RealCode))//实际标识
                {
                    list = list.Where(p => p.RealSign.Contains(RealCode));
                }
                if (!string.IsNullOrEmpty(AmbNum))//车牌号码
                {
                    list = list.Where(p => p.CardNum.Contains(AmbNum));
                }
                if (!string.IsNullOrEmpty(AmbType))//车辆类型编码
                {
                    list = list.Where(p => p.AmbTypeCode == Convert.ToInt32(AmbType));
                }
                if (!string.IsNullOrEmpty(AmbGroup))//分组编码
                {
                    list = list.Where(p => p.GroupNumber == Convert.ToInt32(AmbGroup));
                }

                if (!string.IsNullOrEmpty(Station))//分站编码
                {
                    list = list.Where(p => p.StationCode == Station);
                }
                if (IsActive.HasValue)//是否有效
                {
                    list = list.Where(p => p.IsActive == IsActive);
                }
                string Search = bp.GetGroupRangePower("searchBound");

                switch (bp.GetGroupRangePower("searchBound"))
                {
                case "SearchAll":
                    break;

                case "SearchCenter":    //查找分站
                    list = list.Where(p => UserInfo.CenterCode == p.CenterCode);
                    break;

                case "SearchOrganization":    //查找分站
                    list = list.Where(p => UserInfo.Sta.Contains(p.StationCode));
                    break;

                case "SearchMe":    //查询车辆本人
                    list = list.Where(p => UserInfo.W.Name.Contains(p.Driver) ||
                                      UserInfo.W.Name.Contains(p.Doctor) ||
                                      UserInfo.W.Name.Contains(p.Nurse) ||
                                      UserInfo.W.Name.Contains(p.Litter) ||
                                      UserInfo.W.Name.Contains(p.Salver)
                                      );
                    break;

                default:    //没有设置查询权限
                    return(null);
                    //break;
                }



                long total = list.LongCount();
                list = list.Skip((page - 1) * rows).Take(rows);

                var result = new { total = total, rows = list.ToList() };

                return(result);
            }
        }