public IActionResult DoctorPendingList(string doctorName)
        {
            var finds = _db.vwCHIS_Code_Doctor_Authenticate.AsNoTracking();

            if (doctorName.IsNotEmpty())
            {
                if (doctorName.GetStringType().IsMobile)
                {
                    finds = finds.Where(m => m.Mobile == doctorName);
                }
                else
                {
                    finds = finds.Where(m => m.DoctorName == doctorName);
                }
            }
            //只能搜索所在工作站及其下属的医生

            var stations = UserMgr.GetStations(UserSelf.StationId);

            finds = (from item in _db.CHIS_Sys_Rel_DoctorStations
                     join doctor in finds on item.DoctorId equals doctor.DoctorId into temp
                     from tt in temp.DefaultIfEmpty()
                     where (stations == null) ? (item.StationId == UserSelf.StationId) : (stations.Contains(item.StationId)) && tt != null
                     select tt).Distinct();


            return(FindPagedData_jqgrid(finds.OrderBy(m => m.DoctorId)));
        }
Exemplo n.º 2
0
 //员工档案记录查询
 public IActionResult SearchJson_CHIS_Code_Doctor(int?stationId = 0, string keyword = null, bool isOnlyThisStation = true, bool ignoreStation = false)
 {
     //筛选数据
     if (ignoreStation)
     {
         var findList = _db.vwCHIS_Code_Doctor.AsNoTracking().Select(tt => new
         {
             DoctorId   = tt.DoctorId,
             DoctorName = tt.DoctorName,
             Gender     = tt.Gender,
             Birthday   = tt.Birthday,
             IDcard     = tt.IDcard,
             Telephone  = tt.Telephone,
             Mobile     = tt.CustomerMobile,
             Email      = tt.Email,
             CreatDate  = Convert.ToDateTime(tt.DoctorCreateTime).ToString("yyyy-MM-dd")
         });
         if (!string.IsNullOrEmpty(keyword))
         {
             findList = findList.Where(m => m.Telephone == keyword || m.IDcard == keyword || m.Email == keyword || m.DoctorName == keyword);
         }
         return(FindPagedData_jqgrid(findList.OrderBy(m => m.DoctorId)));
     }
     else
     {
         var stations = isOnlyThisStation ? null : UserMgr.GetStations(stationId.Value);
         var findList = (from item in _db.CHIS_Sys_Rel_DoctorStations
                         join doctor in _db.vwCHIS_Code_Doctor on item.DoctorId equals doctor.DoctorId into temp
                         from tt in temp.DefaultIfEmpty()
                         where (stations == null) ? (item.StationId == stationId) : (stations.Contains(item.StationId)) && tt != null
                         select new
         {
             DoctorId = tt.DoctorId,
             DoctorName = tt.DoctorName,
             Gender = tt.Gender,
             Birthday = tt.Birthday,
             IDcard = tt.IDcard,
             Telephone = tt.Telephone,
             Mobile = tt.CustomerMobile,
             Email = tt.Email,
             CreatDate = Convert.ToDateTime(tt.DoctorCreateTime).ToString("yyyy-MM-dd")
         }).Distinct();
         if (!string.IsNullOrEmpty(keyword))
         {
             findList = findList.Where(m => m.Telephone == keyword || m.IDcard == keyword || m.Email == keyword || m.DoctorName == keyword);
         }
         return(FindPagedData_jqgrid(findList.OrderByDescending(m => m.CreatDate))); //分页返回
     }
 }