Exemple #1
0
        public dynamic GetDrugsBasic(string searchText, int?sourceFrom = 0, int?pageIndex = 1, int?pageSize = 20)
        {
            var ss = Ass.P.PStr(searchText).ToLower().Split(' ');

            searchText = ss[0];
            var searchText1 = (ss.Length > 1 ? ss[1] : "").Trim();//厂商

            var finds = _db.CHIS_Code_Drug_Main.AsNoTracking().Where(m => m.SourceFrom == sourceFrom && m.IsEnable);

            long drugId = 0;

            if (long.TryParse(searchText, out drugId))
            {
                if (searchText.Length > 10)
                {
                    finds = finds.Where(m => m.BarCode == searchText);
                }
                else
                {
                    if (searchText == "999")
                    {
                        finds.Where(m => m.CodeDock.Contains(searchText) || m.DrugId == drugId);
                    }
                    finds = finds.Where(m => m.DrugId == drugId);
                }
            }
            else
            {
                finds = finds.Where(m => m.CodeDock.Contains(searchText));
            }

            var findrlt = finds.Join(_db.CHIS_Code_Drug_Outpatient, a => a.DrugId, g => g.DrugId, (a, g) => new
            {
                DrugId             = a.DrugId,
                DrugName           = a.DrugName,
                DrugModel          = a.DrugModel,
                DrugImgUrl         = a.DrugPicUrl.ahDtUtil().GetDrugImg(a.MedialMainKindCode, true),
                ManufacturerOrigin = a.ManufacturerOrigin,
                a.OriginPlace,
                g.UnitBigId,
                g.UnitSmallId,
                g.DosageUnitId,
                g.OutpatientConvertRate,
                g.DosageContent,
                UnitBigName    = _dictSvr.GetDictById(g.UnitBigId).ItemName,
                UnitSmallName  = _dictSvr.GetDictById(g.UnitSmallId).ItemName,
                DosageUnitName = _dictSvr.GetDictById(g.DosageUnitId).ItemName,
                a.ManufacturerOriginPinYin
            });

            if (searchText1.IsNotEmpty())
            {
                findrlt = findrlt.Where(m => m.ManufacturerOriginPinYin.Contains(searchText1));
            }
            return(findrlt.OrderBy(m => m.DrugId).Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value));
        }
Exemple #2
0
 public IActionResult GetDict(int dictId)
 {
     try
     {
         var data = _dicSvr.GetDictById(dictId);
         var rlt  = MyDynamicResult(data);
         return(Ok(rlt));
     }
     catch (Exception ex) { return(Ok(MyDynamicResult(ex))); }
 }
Exemple #3
0
 public IActionResult SearchDrugsOfClinic(string searchText, int?drugStoreStationId, int?pageIndex = 1, int?pageSize = 20)
 {
     try
     {
         searchText = Ass.P.PStr(searchText);
         if (searchText.Length <= 2)
         {
             throw new UnvalidComException("起码输入2个搜索字符");
         }
         if (drugStoreStationId == null)
         {
             if (UserSelf == null)
             {
                 throw new UnvalidComException("未登录的用户,必须输入药房Id");
             }
             drugStoreStationId = UserSelf.DrugStoreStationId;
         }
         IEnumerable <string> fm = null;
         var drugs = _drugSvr.QueryStockDrugInfos(searchText, drugStoreStationId.Value, ref fm).Skip((pageIndex.Value - 1) * pageSize.Value).Take(pageSize.Value).Select(m => new
         {
             m.StationId,
             DrugInfo = new
             {
                 m.DrugId,
                 m.DrugCode,
                 m.BarCode,
                 m.DrugName,
                 m.Alias,
                 DrugPicUrl = m.DrugPicUrl.ahDtUtil().GetDrugImg(m.MedialMainKindCode, true),
                 m.ManufacturerOrigin,
                 m.Trademark,
                 m.OriginPlace,
                 m.MedialMainKindCode,
                 DrugModel = new
                 {
                     m.DrugModel,
                     m.OutUnitBigName,
                     m.OutpatientConvertRate,
                     m.OutUnitSmallName,
                     m.DosageContent,
                     m.DosageUnitName,
                     m.UnitBigId,
                     m.UnitSmallId,
                     m.DosageUnitId,
                     m.IsMultyUnit,
                 },
                 DefaultUsage = new
                 {
                     m.DefDrugGivenTakeTypeId,
                     DefDrugGivenTakeTypeName = _dicSvr.GetDictById(m.DefDrugGivenTakeTypeId).ItemName,
                     m.DefDrugGivenTimeTypeId,
                     DefDrugGivenTimeTypeName = _dicSvr.GetDictById(m.DefDrugGivenTimeTypeId).ItemName,
                     m.DefDrugGivenWhereTypeId,
                     DefDrugGivenWhereTypeName = _dicSvr.GetDictById(m.DefDrugGivenWhereTypeId).ItemName,
                     m.DefDosage,
                 },
             },
             StockInfo = new
             {
                 m.DrugStockMonitorId,
                 m.DrugStockNum,
                 m.StockUnitName,
                 DrugStockRemark = m.DrugStockNum + m.StockUnitName + "(" + m.BigStockNumber + m.OutUnitBigName + ")",
                 m.StockUnitId,
                 m.StockBuyPrice,
                 m.StockSalePrice,
                 m.StockDrugIsEnable,
                 m.BigStockNumber,
                 m.HasBigStockNumberMore
             },
             m.ThreePartDrugId,
             m.SupplierCoName,
             m.SupplierId,
             m.SourceFrom,
             m.ThreePartDrugRefreshTime,
             m.DrugStockTypeId,
             m.ValidDays,
             m.DrugCompleteScore,
             m.DrugRxType,
             m.IsMultyUnit,
         });
         var rlt = MyDynamicResult(drugs);
         rlt.pageIndex = pageIndex;
         rlt.pageSize  = pageSize;
         return(Ok(rlt));
     }
     catch (Exception ex) { return(Ok(MyDynamicResult(ex))); }
 }