public List <HealthCheckDocument> SearchPagedHealthCheckDocumentByAllStrings(string keys, int index, int size, out PagerInfo pager) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <HealthCheckDocument> records = new List <HealthCheckDocument>(); var queryBuilder = QueryBuilder.Create <HealthCheckDocument>(); //Expression<Func<DrugInventoryRecord, bool>> expression = dir => true; //处理排序 var query = this.Queryable; query = query.Where(PreparePredicate(queryBuilder.Expression));//过滤一下 if (!string.IsNullOrWhiteSpace(keys)) { query = query.Where(d => false || (d.DocumentName != null && d.DocumentName.Contains(keys)) || (d.DocumentNumber != null && d.DocumentNumber.Contains(keys)) || (d.CheckOrganize != null && d.CheckOrganize.Contains(keys)) ); } pager.RecordCount = query.Count(); //处理总录条数 query = query.OrderBy(d => d.DocumentNumber); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <HealthCheckDocument> >("根据字符串查询基础信息失败", ex)); } }
public List <EduDetails> SearchPagedEduDetailsByAllStrings(string keys, int index, int size, out PagerInfo pager) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <EduDetails> records = new List <EduDetails>(); var queryBuilder = QueryBuilder.Create <EduDetails>(); Expression <Func <EduDetails, bool> > expression = dir => true; //处理排序 var query = this.Queryable; query = query.Where(PreparePredicate(queryBuilder.Expression));//过滤一下 if (!string.IsNullOrWhiteSpace(keys)) { query = query.Where(d => false || (d.Employee.Name != null && d.Employee.Name.Contains(keys)) ); } pager.RecordCount = query.Count(); //处理总录条数 query = query.OrderBy(d => d.Employee.Name); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <EduDetails> >("根据字符串查询基础信息失败", ex)); } }
public List <DrugInfo> SearchPagedDrugInfosByAllStrings(string keys, int index, int size, out PagerInfo pager) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <DrugInfo> records = new List <DrugInfo>(); var queryBuilder = QueryBuilder.Create <DrugInfo>(); Expression <Func <DrugInventoryRecord, bool> > expression = dir => true; var query = this.Queryable; query = query.Where(PreparePredicate(queryBuilder.Expression)); if (!string.IsNullOrWhiteSpace(keys)) { query = query.Where(d => false //编码 || (d.Code != null && d.Code.Contains(keys)) //商品名称 || (d.ProductName != null && d.ProductName.Contains(keys)) //拼音码 || (d.Pinyin != null && d.Pinyin.Contains(keys)) //条形码 || (d.BarCode != null && d.BarCode.Contains(keys)) //规格 || (d.DictionarySpecificationCode != null && d.DictionarySpecificationCode.Contains(keys)) //剂型 || (d.DictionaryDosageCode != null && d.DictionaryDosageCode.Contains(keys)) //计量单位 || (d.DictionaryMeasurementUnitCode != null && d.DictionaryMeasurementUnitCode.Contains(keys)) //厂家 || (d.FactoryName != null && d.FactoryName.Contains(keys)) //特殊药物 || (d.SpecialDrugCategoryCode != null && d.SpecialDrugCategoryCode.Contains(keys)) //经营范围 || (d.BusinessScopeCode != null && d.BusinessScopeCode.Contains(keys)) ); } pager.RecordCount = query.Count(); //处理总录条数 query = query.OrderBy(d => d.BarCode) .OrderBy(d => d.ProductName); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <DrugInfo> >("根据字符串查询药物基础信息失败", ex)); } }
public List <DrugInfo> SearchPagedDrugInfosByAllStrings(string keys, int index, int size, out PagerInfo pager) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <DrugInfo> records = new List <DrugInfo>(); var queryBuilder = QueryBuilder.Create <DrugInfo>(); var query = this.Queryable.Where(r => r.Deleted == false && r.BusinessScopeCode == "医疗器械"); query = query.Where(PreparePredicate(queryBuilder.Expression)); if (!string.IsNullOrWhiteSpace(keys)) { query = query.Where(d => //编码 (d.Code != null && d.Code.Contains(keys)) //商品名称 || (d.ProductGeneralName.Contains(keys)) //拼音码 || (d.Pinyin != null && d.Pinyin.Contains(keys)) //规格 || (d.DictionarySpecificationCode != null && d.DictionarySpecificationCode.Contains(keys)) //剂型 || (d.DictionaryDosageCode != null && d.DictionaryDosageCode.Contains(keys)) //厂家 || (d.FactoryName != null && d.FactoryName.Contains(keys)) //经营范围 || (d.BusinessScopeCode != null && d.BusinessScopeCode.Contains(keys)) //医疗器械分类代码 || (d.StandardCode != null && d.StandardCode.Contains(keys)) //器械注册证号 || (d.LicensePermissionNumber != null && d.LicensePermissionNumber.Contains(keys)) ); } pager.RecordCount = query.Count(); //处理总录条数 query = query.OrderBy(d => d.BarCode) .OrderBy(d => d.ProductName); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <DrugInfo> >("根据字符串查询药物基础信息失败", ex)); } }
/// <summary> /// 分页查询所有的药物库存为选择窗口 /// </summary> /// <returns></returns> public List <DrugInventoryRecord> QueryPagedAllDrugInventoryRecordSelector ( QueryDrugInventoryRecordBusinessModel queryModel, int index, int size, out PagerInfo pager ) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <DrugInventoryRecord> records = new List <DrugInventoryRecord>(); var queryBuilder = QueryBuilder.Create <DrugInventoryRecord>(); Expression <Func <DrugInventoryRecord, bool> > expression = dir => true; //处理排序 var query = this.Queryable; query = query.Where(PreparePredicate(queryBuilder.Expression)); //过滤一下 pager.RecordCount = query.Count(); //处理总录条数 query = query.OrderBy(dir => dir.PruductDate) .OrderBy(dir => dir.OutValidDate) .OrderBy(dir => dir.InInventoryCount) .OrderBy(dir => dir.SalesCount) .OrderBy(dir => dir.RetailCount); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <DrugInventoryRecord> >("分页查询所有的药物库存失败", ex)); } finally { this.Dispose(); } }
/// <summary> /// 分页查询疑问记录为疑问管理 /// </summary> /// <param name="drugInfoName"></param> /// <param name="batchNumber"></param> /// <param name="inInventoryDateRange"></param> /// <param name="productDateRange"></param> /// <param name="outDataRange"></param> /// <returns></returns> public List <DoubtDrug> QueryPagedDoubtDrugsForManage(string drugInfoName , string batchNumber , DateTimeRange inInventoryDateRange , DateTimeRange productDateRange , DateTimeRange outDataRange , int index, int size, out PagerInfo pager ) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { List <DoubtDrug> records = new List <DoubtDrug>(); var queryBuilder = QueryBuilder.Create <DoubtDrug>(); var query = this.Queryable; //过滤 //药物名称 if (!string.IsNullOrWhiteSpace(drugInfoName)) { query = query.Where(dd => dd.DrugInventoryRecord.DrugInfo.ProductName.Contains(drugInfoName)); } //生产批号 if (!string.IsNullOrWhiteSpace(batchNumber)) { query = query.Where(dd => dd.DrugInventoryRecord.BatchNumber.Contains(batchNumber)); } //入库日期 //生产日期 if (productDateRange != null) { if (productDateRange.Max != default(DateTime)) { query = query.Where(dd => dd.DrugInventoryRecord.PruductDate <= productDateRange.Max); } if (productDateRange.Min != default(DateTime)) { query = query.Where(dd => dd.DrugInventoryRecord.PruductDate >= productDateRange.Min); } } //过期日期 if (outDataRange != null) { if (outDataRange.Max != default(DateTime)) { query = query.Where(dd => dd.DrugInventoryRecord.OutValidDate <= outDataRange.Max); } if (outDataRange.Min != default(DateTime)) { query = query.Where(dd => dd.DrugInventoryRecord.OutValidDate >= outDataRange.Min); } } //以上To Do query = query.Where(PreparePredicate(dd => true)); //过滤一下 pager.RecordCount = query.Count(); //处理总录条数 //处理排序 query = query .OrderByDescending(dd => dd.CreateTime) .OrderByDescending(dd => dd.UpdateTime) .OrderBy(dd => dd.Handled); records = query .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); return(records); } catch (Exception ex) { return(this.HandleException <List <DoubtDrug> >("分页查询疑问记录为疑问管理失败", ex)); } }
/// <summary> /// 查询保健食品 /// </summary> /// <param name="keys"></param> /// <param name="index"></param> /// <param name="size"></param> /// <param name="pager"></param> /// <param name="ValidCondition"></param> /// <returns></returns> public System.Collections.Generic.IEnumerable <Business.Models.FoodModel> GetFoodByCondition(string keys, int index, int size, out BugsBox.Application.Core.PagerInfo pager, bool ValidCondition) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { var all = this.Queryable.Where(r => r.BusinessScopeCode.Contains("保健食品")); if (!string.IsNullOrEmpty(keys)) { all = all.Where(r => (r.Pinyin != null && r.Pinyin.ToUpper().Contains(keys.ToUpper())) || (r.ProductGeneralName != null && r.ProductGeneralName.Contains(keys)) || (r.DictionaryDosageCode != null && r.DictionaryDosageCode.Contains(keys)) || (r.DictionarySpecificationCode != null && r.DictionarySpecificationCode.Contains(keys))); } if (ValidCondition)//查询被锁定保健食品 { all = all.Where(r => r.Valid == false); } var c = from i in all join w in RepositoryProvider.Db.Warehouses on i.WareHouses equals w.Id join u in RepositoryProvider.Db.Users on i.CreateUserId equals u.Id select new Business.Models.FoodModel { BusinessScopeCode = i.BusinessScopeCode, CreateTime = i.CreateTime, CreateUserName = u.Employee.Name, DictionaryDosageCode = i.DictionaryDosageCode, DictionaryMeasurementUnitCode = i.DictionaryMeasurementUnitCode, DictionarySpecificationCode = i.DictionarySpecificationCode, DocCode = i.DocCode, Code = i.Code, DrugStorageTypeCode = i.DrugStorageTypeCode, FactoryName = i.FactoryName, Id = i.Id, IsApproval = i.IsApproval == true ? "审批通过" : "未审批通过", IsImport = i.IsImport == true ? "进口" : "非进口", LicensePermissionNumber = i.LicensePermissionNumber, LimitedUpPrice = i.LimitedUpPrice, MaxInventoryCount = i.MaxInventoryCount, MinInventoryCount = i.MinInventoryCount, PerformanceStandards = i.PerformanceStandards, Pinyin = i.Pinyin, Price = i.Price, ProductGeneralName = i.ProductGeneralName, SalePrice = i.SalePrice, Origin = i.Origin, LicensePermissionOutValidDate = i.PermitOutDate, Valid = i.Valid == true ? "有效" : "无效", ValidPeriod = i.ValidPeriod, WareHouses = w.Name, Locked = i.IsLock == true ? "锁定" : "未锁定", NotValidReason = i.ValidRemark, WareHouseZone = i.WareHouseZones, BarCode = i.BarCode, LimitedLowPrice = i.LimitedLowPrice, Contact = i.FactoryNameAbbreviation, Description = i.Description, }; pager.RecordCount = c.Count(); c = c.OrderBy(d => d.Code).ThenBy(r => r.ProductGeneralName); var records = c .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); records.ForEach(r => { if (!string.IsNullOrEmpty(r.WareHouseZone)) { Guid wzid = Guid.Parse(r.WareHouseZone); var wz = RepositoryProvider.Db.WarehouseZones.FirstOrDefault(u => u.Id == wzid); if (wz != null) { r.WareHouseZone = wz.Name; } } }); return(records); } catch (Exception ex) { return(null); } finally { this.Dispose(); } }
/// <summary> /// 查询药品基础信息 /// </summary> /// <param name="keys"></param> /// <param name="index"></param> /// <param name="size"></param> /// <param name="pager"></param> /// <param name="ValidCondition"></param> /// <returns></returns> public IEnumerable <Business.Models.DrugInfoModel> GetDrugInfoByCondition(string keys, int index, int size, out PagerInfo pager, bool ValidCondition) { pager = PagerInfo.Validate(new PagerInfo { Index = index, Size = size }); try { var all = this.Queryable; if (!string.IsNullOrEmpty(keys)) { all = all.Where(r => (r.Pinyin != null && r.Pinyin.ToUpper().Contains(keys.ToUpper())) || (r.ProductGeneralName != null && r.ProductGeneralName.Contains(keys)) || (r.BusinessScopeCode != null && r.BusinessScopeCode.Contains(keys)) || (r.DictionaryDosageCode != null && r.DictionaryDosageCode.Contains(keys)) || (r.DictionarySpecificationCode != null && r.DictionarySpecificationCode.Contains(keys))); } all = all.Where(r => !r.BusinessScopeCode.Contains("医疗器械") || !r.BusinessScopeCode.Contains("保健食品")); //医疗器械和保健食品不查 if (ValidCondition) //查询被锁定药品 { all = all.Where(r => r.Valid == false); } var c = from i in all join w in RepositoryProvider.Db.Warehouses on i.WareHouses equals w.Id join u in RepositoryProvider.Db.Users on i.CreateUserId equals u.Id select new Business.Models.DrugInfoModel { BarCode = i.BarCode, BigPackage = i.BigPackage, BusinessScopeCode = i.BusinessScopeCode, Code = i.Code, CreateTime = i.CreateTime, CreateUserId = u.Employee.Name, DictionaryDosageCode = i.DictionaryDosageCode, DictionaryMeasurementUnitCode = i.DictionaryMeasurementUnitCode, DictionaryPiecemealUnitCode = i.DictionaryPiecemealUnitCode, DictionarySpecificationCode = i.DictionarySpecificationCode, DocCode = i.DocCode, DrugCategoryCode = i.DrugCategoryCode, DrugClinicalCategoryCode = i.DrugClinicalCategoryCode, DrugStorageTypeCode = i.DrugStorageTypeCode, FactoryName = i.FactoryName, id = i.Id, IsApproval = i.IsApproval == true ? "审批通过" : "未审批通过", IsImport = i.IsImport == true ? "进口" : "非进口", IsMainMaintenance = i.IsMainMaintenance ? "重点养护" : "一般养护", IsMedicalInsurance = i.IsMedicalInsurance ? "医保药品" : "非医保药品", IsPrescription = i.IsPrescription ? "处方药" : "非处方药", IsSpecialDrugCategory = i.IsSpecialDrugCategory ? "特殊管理药品" : "非特殊管理药品", LicensePermissionNumber = i.LicensePermissionNumber, LimitedUpPrice = i.LimitedUpPrice, MaxInventoryCount = i.MaxInventoryCount, MedicalCategoryDetailCode = i.MedicalCategoryDetailCode, MiddlePackage = i.MiddlePackage, MinInventoryCount = i.MinInventoryCount, Origin = i.Origin, Package = i.Package, PackageAmount = i.PackageAmount, PerformanceStandards = i.PerformanceStandards, PermitLicenseCode = i.PermitLicenseCode, PiecemealNumber = i.PiecemealNumber, PiecemealSpecification = i.PiecemealSpecification, Pinyin = i.Pinyin, Price = i.Price, ProductGeneralName = i.ProductGeneralName, ProductName = i.ProductName, PurchaseManageCategoryDetailCode = i.PurchaseManageCategoryDetailCode, RetailPrice = i.RetailPrice, SalePrice = i.SalePrice, SmallPackage = i.SmallPackage, SpecialDrugCategoryCode = i.SpecialDrugCategoryCode, StandardCode = i.StandardCode, Valid = i.Valid ? "有效" : "无效", ValidPeriod = i.ValidPeriod, WareHouses = w.Name, WholeSalePrice = i.WholeSalePrice, Description = i.Description, WareHouseZones = i.WareHouseZones }; pager.RecordCount = c.Count(); c = c.OrderBy(d => d.Code).ThenBy(r => r.ProductGeneralName); var records = c .Skip((pager.Index - 1) * pager.Size) .Take(pager.Size) .ToList(); records.ForEach(r => { if (!string.IsNullOrEmpty(r.WareHouseZones)) { Guid wzid = Guid.Parse(r.WareHouseZones); var wz = RepositoryProvider.Db.WarehouseZones.FirstOrDefault(u => u.Id == wzid); if (wz != null) { r.WareHouseZones = wz.Name; } } }); return(records); } catch (Exception ex) { return(null); } finally { this.Dispose(); } }