Ejemplo n.º 1
0
 public IActionResult GetNeedDispensingList(string searchText, int stationId,
                                            string timeRange = "Today", int dispensingStatus = 0,
                                            int?pageIndex    = 1, int?pageSize = 20)
 {
     try
     {
         if (UserSelf == null && stationId == null)
         {
             throw new ComException(ExceptionTypes.Error_Unauthorized, "未登录的用户,需要输入参数:stationId");
         }
         var dtt        = timeRange.ahDtUtil().TimeRange();
         int?registOpId = null;
         if (UserSelf.MyRoleNames.Contains("drugstore_nurse"))
         {
             registOpId = UserSelf.OpId;
         }
         var dd  = _dispSvr.GetDispenseList(searchText, stationId, dtt.Item1, dtt.Item2, dispensingStatus, pageIndex.Value, pageSize.Value, registOpId);
         var mdd = new Ass.Mvc.PageListInfo <Models.ViewModel.DispensingItem>
         {
             DataList    = _mapper.Map <IEnumerable <DispensingItemViewModel>, IEnumerable <DispensingItem> >(dd.DataList),
             PageIndex   = dd.PageIndex,
             PageSize    = dd.PageSize,
             RecordTotal = dd.RecordTotal
         };
         var rlt = MyDynamicResult(mdd);
         return(Ok(rlt));
     }
     catch (Exception ex) { return(Ok(MyDynamicResult(ex))); }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="pageIndex"></param>
        /// <param name="dispensingStatus">发送状态 0 未发 1 已发 2 其他</param>
        /// <param name="tstart"></param>
        /// <param name="tend"></param>
        /// <returns></returns>
        public Ass.Mvc.PageListInfo <Models.ViewModel.DispensingItemViewModel> GetDispenseList(
            string searchText, int stationId, DateTime dt0, DateTime dt1, int dispensingStatus = 0,
            int pageIndex = 1, int pageSize = 20, int?opId = null)
        {
            var finds = _db.SqlQuery <DispensingItemViewModel>(string.Format("exec sp_Dispensing_TreatList {0},{1},'{2:yyyy-MM-dd}','{3:yyyy-MM-dd}'", dispensingStatus, stationId, dt0, dt1));


            if (opId.HasValue)
            {
                finds = finds.Where(m => m.RegistOpId == opId).ToList();
            }
            else if (searchText.IsNotEmpty())
            {
                finds = finds.Where(m => m.CustomerName.Contains(searchText) || m.CustomerMobile == searchText).ToList();
            }
            //分页
            var list  = finds.OrderBy(m => m.TreatTime).Skip((pageIndex - 1) * pageSize).Take(pageSize);
            var model = new Ass.Mvc.PageListInfo <Models.ViewModel.DispensingItemViewModel>
            {
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = finds.Count(),
                DataList    = list
            };

            return(model);
        }
Ejemplo n.º 3
0
        public IActionResult LoadCustomerList(string searchText, string timeRange = "Today", bool?isVIP = null, int pageIndex = 1, int pageSize = 20)
        {
            base.initialData_Page(ref pageIndex, ref pageSize);
            DateTime?dt0 = null, dt1 = null;

            base.initialData_TimeRange(ref dt0, ref dt1, timeRange);
            //筛选数据
            var findList = _db.vwCHIS_Code_Customer.AsNoTracking();

            if (timeRange != "All")
            {
                findList = findList.Where(m => m.CustomerCreateDate >= dt0 && m.CustomerCreateDate < dt1);
            }

            if (!string.IsNullOrEmpty(searchText))
            {
                var t = searchText.GetStringType();
                if (t.IsEmail)
                {
                    findList = findList.Where(m => m.Email == t.String);
                }
                else if (t.IsMobile)
                {
                    findList = findList.Where(m => m.CustomerMobile == t.String);
                }
                else if (t.IsIdCardNumber)
                {
                    findList = findList.Where(m => m.IDcard == t.String);
                }
                else if (t.IsLoginNameLegal)
                {
                    findList = findList.Where(m => m.LoginName == t.String);
                }
                else
                {
                    findList = findList.Where(m => m.CustomerName == searchText);
                }
            }


            if (isVIP.HasValue)
            {
                findList = findList.Where(m => m.IsVIP == isVIP.Value);
            }


            var total = findList.Count();
            var find  = findList.OrderByDescending(m => m.CustomerCreateDate).Skip(pageSize * (pageIndex - 1)).Take(pageSize);

            var model = new Ass.Mvc.PageListInfo <vwCHIS_Code_Customer>
            {
                DataList    = find,
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = total
            };

            return(PartialView("_pvCustomerList", model));
        }
Ejemplo n.º 4
0
 public Ass.Mvc.PageListInfo <dynamic> NewPagedModel <T>(Func <T, dynamic> p) where T : class
 {
     Ass.Mvc.PageListInfo <T> m = (Ass.Mvc.PageListInfo <T>)orig;
     return(new Ass.Mvc.PageListInfo <dynamic>
     {
         DataList = m.DataList.Select(p),
         PageIndex = m.PageIndex,
         PageSize = m.PageSize,
         RecordTotal = m.RecordTotal
     });
 }
Ejemplo n.º 5
0
        public IActionResult Customers(string searchText, int pageIndex = 1)
        {
            var finds = MainDbContext.vwCHIS_Code_Customer.AsNoTracking();

            if (!string.IsNullOrWhiteSpace(searchText))
            {
                searchText = searchText.Trim();
                finds      = finds.Where(m => m.Telephone == searchText || m.CustomerMobile == searchText || m.Email == searchText || m.IDcard == searchText);
            }

            Ass.Mvc.PageListInfo <ah.Models.vwCHIS_Code_Customer> model = PagedList(finds.OrderByDescending(m => m.CustomerCreateDate), pageIndex, 20);
            return(View(nameof(Customers), model));
        }
Ejemplo n.º 6
0
        public IActionResult CustomerDaily(string searchText, int pageIndex = 1)
        {
            var finds = MainDbContext.vwAHMS_Daily_Member.AsNoTracking();

            if (!string.IsNullOrWhiteSpace(searchText))
            {
                searchText = searchText.Trim();
                finds      = finds.Where(m => m.Mobile == searchText || m.Email == searchText || m.MemberName.Contains(searchText));
            }

            Ass.Mvc.PageListInfo <ah.Models.vwAHMS_Daily_Member> model = PagedList(finds.OrderBy(m => m.CreateTime), pageIndex, 20);
            return(View(nameof(CustomerDaily), model));
        }
Ejemplo n.º 7
0
        public IActionResult QuestionList(string searchText, int pageIndex = 1)
        {
            var finds = MainDbContext.vwAHMS_QAFlow_Main.AsNoTracking();

            if (!string.IsNullOrWhiteSpace(searchText))
            {
                searchText = searchText.Trim();
                finds      = finds.Where(m => m.Mobile == searchText || m.Email == searchText || m.Name.Contains(searchText));
            }

            Ass.Mvc.PageListInfo <ah.Models.vwAHMS_QAFlow_Main> model = PagedList(finds.OrderBy(m => m.QATime), pageIndex, 20);
            Response.Cookies.Append("searchText", Ass.P.PStr(searchText));
            Response.Cookies.Append("pageIndex", Ass.P.PStr(pageIndex));
            return(View(nameof(QuestionList), model));
        }
Ejemplo n.º 8
0
        //基本明细
        public IActionResult LoadMyChargeList(string searchText, string TimeRange = "Today", int?stationId = null, int?opCustomerId = null, string customerName = null, int pageIndex = 1, int pageSize = 25)
        {
            var      dt = DateTime.Now;
            DateTime?dt0 = null; DateTime?dt1 = null;

            base.initialData_Page(ref pageIndex, ref pageSize);
            base.initialData_TimeRange(ref dt0, ref dt1, 1, timeRange: TimeRange);

            stationId    = stationId ?? UserSelf.StationId;
            opCustomerId = opCustomerId ?? UserSelf.CustomerId;
            var finds = db.vwCHIS_Charge_Pay.AsNoTracking().Where(m => m.StationId == stationId && (m.sysOpId == opCustomerId || m.sysOpId == 0));

            if (searchText.IsNotEmpty())
            {
                if (searchText.IsMobileNumber())
                {
                    finds = finds.Where(m => m.CustomerMobile == searchText);
                }
                else
                {
                    finds = finds.Where(m => m.PayOrderId == searchText);
                }
            }
            else
            {
                finds = finds.Where(m => m.PayedTime > dt0 && m.PayedTime < dt1);
            }
            if (customerName.IsNotEmpty())
            {
                finds = finds.Where(m => m.CustomerName.StartsWith(customerName));
            }
            var count = finds.Count();
            var items = finds.OrderByDescending(m => m.PayId).Skip(pageSize * (pageIndex - 1)).Take(pageSize);

            var model = new Ass.Mvc.PageListInfo <vwCHIS_Charge_Pay>
            {
                DataList    = items.ToList(),
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = count
            };

            _setDebugText(dt);
            return(PartialView("_pvChargeList", model));
        }
Ejemplo n.º 9
0
 public dynamic SearchTreatDoctors(string searchText, int?pageIndex = 1, int?pageSize = 20)
 {
     try
     {
         var finds = _docrSvr.SearchTreatDoctors(searchText, null, pageIndex.Value, pageSize.Value);
         var rlt   = new Ass.Mvc.PageListInfo
         {
             PageIndex   = pageIndex.Value,
             PageSize    = pageSize.Value,
             RecordTotal = finds.Item1
         };
         var d = MyDynamicResult(true, "");
         d.totalPages = rlt.PageTotal;
         d.items      = finds.Item2;
         d.pageIndex  = pageIndex;
         d.pageSize   = pageSize;
         return(d);
     }
     catch (Exception ex) { return(MyDynamicResult(ex)); }
 }
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="pageIndex"></param>
        /// <param name="dispensingStatus">发送状态 0 未发 1 已发 2 其他</param>
        /// <param name="tstart"></param>
        /// <param name="tend"></param>
        /// <returns></returns>
        public IActionResult GetSendList(string searchText, string TimeRange = "Today", int dispensingStatus = 0, int pageIndex = 1, int pageSize = 20)
        {
            int days = 1;

#if DEBUG
            days = 100;
#endif
            DateTime?dt0 = null; DateTime?dt1 = null;

            initialData_TimeRange(ref dt0, ref dt1, days, timeRange: TimeRange);


            var finds = _db.SqlQuery <DispensingItemViewModel>(string.Format("exec sp_Dispensing_TreatList {0},{1},'{2:yyyy-MM-dd}','{3:yyyy-MM-dd}'", dispensingStatus, UserSelf.StationId, dt0, dt1));

            //如果角色是药店护士
            int?registOpId = null;
            if (UserSelf.MyRoleNames.Contains("drugstore_nurse"))
            {
                registOpId = UserSelf.OpId;
            }
            if (registOpId.HasValue)
            {
                finds = finds.Where(m => m.RegistOpId == registOpId).ToList();
            }
            else if (searchText.IsNotEmpty())
            {
                finds = finds.Where(m => m.CustomerName.Contains(searchText) || m.CustomerMobile == searchText).ToList();
            }
            //分页
            var list  = finds.OrderBy(m => m.TreatTime).Skip((pageIndex - 1) * pageSize).Take(pageSize);
            var model = new Ass.Mvc.PageListInfo <DispensingItemViewModel>
            {
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = finds.Count(),
                DataList    = list
            };

            ViewBag.SendStatus = dispensingStatus;
            return(PartialView("_pvNeedSendList", model));
        }
Ejemplo n.º 11
0
        public IActionResult GetDoctorPendingList(string searchText, string timeRange = "Today", bool?isNeedCheck = null, int?rootStationId = null, int pageIndex = 1, int pageSize = 20)
        {
            DateTime dt = DateTime.Now;
            DateTime?dt0 = null, dt1 = null;

            base.initialData_TimeRange(ref dt0, ref dt1, timeRange);
            rootStationId = rootStationId ?? UserSelf.StationId;
            var finds = new BllCaller.DoctorMgrBllCaller().GetDoctorPendingList(searchText, dt0, dt1, isNeedCheck, rootStationId);
            var total = finds.Count();

            finds = finds.OrderBy(m => m.DoctorId).Skip((pageIndex - 1) * pageSize).Take(pageSize);
            var model = new Ass.Mvc.PageListInfo <vwCHIS_Code_Doctor_Authenticate>
            {
                DataList    = finds,
                RecordTotal = total,
                PageIndex   = pageIndex,
                PageSize    = pageSize
            };

            base._setDebugText(dt);
            return(PartialView("_pvDoctorsPendingList", model));
        }
Ejemplo n.º 12
0
        public IActionResult pvLoadJKDrugList(string searchText, int pageIndex = 1, int pageSize = 20)
        {
            searchText = Ass.P.PStr(searchText);
            var dt    = DateTime.Now;
            var finds = _db.vwCHIS_DrugStock_Monitor.Where(m => m.SupplierId == MPS.SupplierId_JK && m.StationId == -1);

            if (searchText.IsNotEmpty())
            {
                var drug3id = 0;
                if (int.TryParse(searchText, out drug3id))
                {
                    finds = finds.Where(m => m.ThreePartDrugId == drug3id);
                }
                else
                {
                    finds = finds.Where(m => m.CodeDock.Contains(searchText));
                }
            }
            else
            {
                finds = finds.Where(m => false);
            }

            base.initialData_Page(ref pageIndex, ref pageSize);
            var list  = finds.OrderBy(m => m.DrugId).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            var dt1   = DateTime.Now;
            var model = new Ass.Mvc.PageListInfo <vwCHIS_DrugStock_Monitor>
            {
                DataList    = list,
                RecordTotal = finds.Count(),
                PageIndex   = pageIndex,
                PageSize    = pageSize
            };

            base._setDebugText(dt);
            return(PartialView("_pvJKDrugList", model));
        }
Ejemplo n.º 13
0
        public Ass.Mvc.PageListInfo <MyMedicalHistoryRecordItemModel> GetListOfMyMedicalRecord(int customerId, int pageIndex = 1, int pageSize = 10)
        {
            var finds = _db.vwCHIS_DoctorTreat.AsNoTracking().Where(m => m.CustomerId == customerId && m.TreatStatus == 2).Select(m => new MyMedicalHistoryRecordItemModel
            {
                TreatId        = m.TreatId,
                FirstTreatTime = m.FirstTreatTime.Value,
                TreatTime      = m.TreatTime,
                DoctorId       = m.DoctorId,
                DoctorName     = m.DoctorName,
                Diagnosis1Name = m.Diagnosis1,
                Diagnosis2Name = m.Diagnosis2
            });
            var count = finds.Count();
            var items = finds.OrderByDescending(m => m.FirstTreatTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize);
            var model = new Ass.Mvc.PageListInfo <MyMedicalHistoryRecordItemModel>
            {
                DataList    = items,
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = count
            };

            return(model);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 载入接诊清单
        /// </summary>
        /// <param name="searchText"></param>
        /// <param name="stationId"></param>
        /// <param name="doctorId">如果DoctorId=0则表示所有,null默认本医生</param>
        /// <param name="TimeRange"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IActionResult LoadTreatList(string searchText, string treatStatus = "All", int?stationId = null, int?doctorId = null, string TimeRange = "Today", int pageIndex = 1, int pageSize = 20)
        {
            DateTime dt = DateTime.Now;
            DateTime?dt0 = null; DateTime?dt1 = null;

            base.initialData_TimeRange(ref dt0, ref dt1, 1, timeRange: TimeRange);

            if (stationId <= 0 || stationId == null)
            {
                stationId = UserSelf.StationId;
            }


            bool bmgr = _db.CHIS_Code_WorkStation.FirstOrDefault(m => m.StationID == stationId).IsManageUnit;

            var finds = _db.vwCHIS_DoctorTreat.AsNoTracking();

            if (bmgr)
            {
                finds = finds.InStation(stationId.Value);
            }
            else
            {
                finds = finds.Where(m => m.StationId == stationId.Value);
            }



            if (doctorId >= 0)
            {
                finds = finds.Where(m => m.DoctorId == doctorId);
            }

            finds = finds.Where(m => (m.FirstTreatTime >= dt0 || m.TreatTime >= dt0) && (m.FirstTreatTime < dt1 || m.TreatTime < dt1));
            if (treatStatus == "treating")
            {
                finds = finds.Where(m => m.TreatStatus == 1);
            }
            else if (treatStatus == "treated")
            {
                finds = finds.Where(m => m.TreatStatus == 2);
            }

            if (searchText.IsNotEmpty())
            {
                finds = finds.Where(m => m.CustomerMobile == searchText || m.CustomerName == searchText);
            }

            base.initialData_Page(ref pageIndex, ref pageSize);
            var item = finds.OrderByDescending(m => m.TreatId).Skip((pageIndex - 1) * pageSize).Take(pageSize);

            var model = new Ass.Mvc.PageListInfo <vwCHIS_DoctorTreat>
            {
                DataList    = item.ToList(),
                RecordTotal = finds.Count(),
                PageIndex   = pageIndex,
                PageSize    = pageSize
            };

            _setDebugText(dt);
            return(PartialView("_pvTreatList", model));
        }
Ejemplo n.º 15
0
        public async Task <IActionResult> LoadDoctorsOfMyStation(string searchText, int?stationId, string timeRange = "All", bool?isVed = null, int pageIndex = 1, int pageSize = 20)
        {
            initialData_Page(ref pageIndex, ref pageSize);
            DateTime?dt0 = null, dt1 = null;

            initialData_TimeRange(ref dt0, ref dt1, timeRange);
            if (!stationId.HasValue)
            {
                stationId = UserSelf.StationId;
            }

            //bool btimeRange = timeRange != "All";
            //var ds = await new CHIS.DAL.Doctor().LoadDoctorListAsync(searchText, stationId, dt0.Value, dt1.Value, isVed,btimeRange, pageIndex, pageSize);
            //return PartialView("_pvDoctorsOfMyStationList2", new Ass.Mvc.PageListInfoDs(ds));

            var find = new DoctorCBL(this).queryDoctorsOfMyStation(stationId.Value);

            if (timeRange != "All")
            {
                find = find.Where(m => m.DoctorCreateTime >= dt0 && m.DoctorCreateTime < dt1);
            }
            if (isVed.HasValue)
            {
                find = find.Where(m => m.DoctorIsAuthenticated == isVed.Value);
            }
            if (searchText.IsNotEmpty())
            {
                var t = searchText.GetStringType();
                if (t.IsMobile)
                {
                    find = find.Where(m => m.CustomerMobile == t.String);
                }
                else if (t.IsEmail)
                {
                    find = find.Where(m => m.Email == t.String);
                }
                else if (t.IsIdCardNumber)
                {
                    find = find.Where(m => m.IDcard == t.String);
                }
                else if (t.IsLoginNameLegal)
                {
                    find = find.Where(m => m.LoginName == t.String);
                }
                else
                {
                    find = find.Where(m => m.DoctorName == t.String);
                }
            }
            var total = find.Count();

            find = find.OrderBy(m => m.DoctorId).Skip((pageIndex - 1) * pageSize).Take(pageSize);

            var list = await find.ToListAsync();

            var model = new Ass.Mvc.PageListInfo <Models.vwCHIS_Code_Doctor>
            {
                DataList    = list,
                RecordTotal = total,
                PageIndex   = pageIndex,
                PageSize    = pageSize
            };

            return(PartialView("_pvDoctorsOfMyStationList", model));
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> LoadNetOrderList(string searchText, string TimeRange = "Today", string contactName = null, int supplierId = 3, int pageIndex = 1, int pageSize = 20)
        {
            DateTime?dt0 = null; DateTime?dt1 = null;

            base.initialData_TimeRange(ref dt0, ref dt1, 1, timeRange: TimeRange);
            //采用ado.net获取数据

            var ds = await new CHIS.DAL.Dispensing().LoadNetOrderList(searchText, dt0.Value, dt1.Value, contactName, supplierId, 1, UserSelf.StationId, pageIndex, pageSize);

            return(PartialView("_pvNetOrderList2", new Ass.Mvc.PageListInfoDs(ds)));

            var finda = _db.vwCHIS_Shipping_NetOrder.AsNoTracking().Where(m => m.SupplierId == 3);

            var find2 = _db.vwCHIS_Shipping_NetOrder.AsNoTracking().Where(m => m.SupplierId == 3).OrderByDescending(m => m.SendTime)
                        .Skip((pageIndex - 1) * pageSize).Take(pageSize);
            var model2 = new Ass.Mvc.PageListInfo <vwCHIS_Shipping_NetOrder>
            {
                DataList    = find2,
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = finda.Count()
            };

            return(PartialView("_pvNetOrderList", model2));



            var find = _db.vwCHIS_Shipping_NetOrder.AsNoTracking().Where(m => m.SendTime >= dt0 && m.SendTime < dt1 && m.TotalAmount > 0 && m.SendedStatus == 1);

            //搜索本诊所内的订单
            var station = base.UserMgr.GetAllowedStationsAndSubStationsQuery(_db, UserSelf.DoctorId, UserSelf.StationId).ToList();

            find = find.Where(m => station.Contains(m.StationId));

            if (searchText.IsNotEmpty())
            {
                if (searchText.GetStringType().IsMobile)
                {
                    find = find.Where(m => m.CustomerMobile == searchText);
                }
                else
                {
                    find = find.Where(m => m.CustomerName == searchText || m.NetOrderNO == searchText);
                }
            }
            if (contactName.IsNotEmpty())
            {
                if (contactName.GetStringType().IsMobile)
                {
                    find = find.Where(m => m.Mobile == contactName);
                }
                else
                {
                    find = find.Where(m => m.ContactName.Contains(contactName));
                }
            }

            var total       = find.Count();
            var amountPrice = await find.SumAsync(m => m.TotalAmount);

            find = find.OrderByDescending(m => m.SendTime).Skip((pageIndex - 1) * pageSize).Take(pageSize);
            var model = new Ass.Mvc.PageListInfo <vwCHIS_Shipping_NetOrder>
            {
                DataList    = find,
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = total
            };

            base._setDebugText(string.Join(",", station));
            ViewBag.AmountPrice = amountPrice;
            return(PartialView("_pvNetOrderList", model));
        }
Ejemplo n.º 17
0
        public IActionResult LoadDrugOutList(string searchText, string TimeRange = "Today", string customerName = null, string medialMainKindCode = null, int pageIndex = 1, int pageSize = 20)
        {
            DateTime?dt0 = null; DateTime?dt1 = null;

            base.initialData_TimeRange(ref dt0, ref dt1, 1, timeRange: TimeRange);

            //如果角色是药店护士
            int?registOpId = null;

            if (UserSelf.MyRoleNames.Contains("drugstore_nurse"))
            {
                registOpId = UserSelf.OpId;
            }


            var find = _db.vwCHIS_DrugStock_Out.AsNoTracking().Where(m => m.OutTime >= dt0 && m.OutTime < dt1 && m.StationId == UserSelf.StationId);

            if (registOpId.HasValue)
            {
                find = find.Where(m => m.RegistOpId == registOpId);
            }
            if (searchText.IsNotEmpty())
            {
                var drugids = base.SearchDrugIds(searchText);
                find = find.Where(m => drugids.Contains(m.DrugId));
            }
            if (customerName.IsNotEmpty())
            {
                find = find.Where(m => m.CustomerName.StartsWith(customerName));
            }
            if (medialMainKindCode.IsNotEmpty())
            {
                find = find.Where(m => m.MedialMainKindCode == medialMainKindCode);
            }

            //分页取数据
            var total = find.Count();

            find = find.OrderBy(m => m.OutTime).Skip((pageIndex - 1) * pageSize).Take(pageSize);

            //获取该出库条目的支付订单号
            var treatids = find.Select(m => m.TreatId.Value).ToList();
            var findpay  = (from item in _db.CHIS_Charge_Pay_Detail_Formed.AsNoTracking()
                            where treatids.Contains(item.TreatId)
                            select new
            {
                item.PrescriptionNo,
                item.PayId,
                item.DoctorAdviceId,
                Type = "FORMED",
            }).Concat(
                from item in _db.CHIS_Charge_Pay_Detail_Herb.AsNoTracking()
                where treatids.Contains(item.TreatId)
                select new
            {
                item.PrescriptionNo,
                item.PayId,
                item.DoctorAdviceId,
                Type = "HERB"
            }).Join(_db.CHIS_Charge_Pay.AsNoTracking(), a => a.PayId, g => g.PayId, (a, g) => new
            {
                a.PrescriptionNo,
                a.PayId,
                g.PayOrderId,
                g.PayedTime,
                a.DoctorAdviceId,
                a.Type
            }).ToList();

            var items = find.ToList();

            foreach (var item in items)
            {
                var mm = findpay.FirstOrDefault(m => (m.DoctorAdviceId == item.DoctorAdviceId && m.Type == item.DoctorAdviceType));
                item.PayOrderId = mm?.PayOrderId;
            }


            var model = new Ass.Mvc.PageListInfo <vwCHIS_DrugStock_Out>
            {
                DataList    = items,
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                RecordTotal = total
            };

            return(PartialView(GetViewPath(nameof(DrugOutList), "_pvDrugOutList"), model));
        }