public JsonResult SyncHospital() { try { StreamReader reader = new StreamReader(Request.InputStream); var req = reader.ReadToEnd(); LogHelper.Info(req); SyscHospitalCallBack request = JsonConvert.DeserializeObject <SyscHospitalCallBack>(req); var res = request.requestData; var supplier = res.supplier.ToLower(); switch (supplier) { case "xms": supplier = " P_HOSPITAL.IsXMS = '是' "; break; case "bds": supplier = " P_HOSPITAL.IsBDS = '是' "; break; } var channel = HospitalClientChannelFactory.GetChannel(); var hospital = channel.LoadHospital(supplier); return(LargeJson(new { code = 200, message = "ok", result = hospital })); } catch (Exception exp) { LogHelper.Error("Exception SyncHospital", exp); return(Json(new { code = 500, message = "error" })); } }
public JsonResult _ChooseHospital(P_ChooseHospital entity) { var baseDataChannel = BaseDataClientChannelFactory.GetChannel(); var listMarket = baseDataChannel.LoadMarket(); var hospitalChannel = HospitalClientChannelFactory.GetChannel(); var Hospital = hospitalChannel.FindByCode(entity.addressCode); var market = listMarket.First(a => a.Name == entity.market); entity.hospital = Hospital.GskHospital; entity.invoiceTitle = market.InvoiceTitle; entity.dutyParagraph = market.DutyParagraph; entity.isExternal = Hospital.External; entity.longitude = Hospital.Longitude; entity.latitude = Hospital.Latitude; entity.addressCode = Hospital.HospitalCode; HospitalInfo = entity; return(Json(new { state = 1 })); }
public JsonResult LoadRestaurant(string hospitalId, string supplier, string sendTime) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-cn"); var channel = HospitalClientChannelFactory.GetChannel(); var hospital = channel.FindByCode(hospitalId); if (hospital == null || string.IsNullOrEmpty(hospital.Name)) { return(Json(new { state = 0, txt = "载入餐厅列表数据失败!", errCode = 9013 })); } //var openApiChannel = OpenApiChannelFactory.GetChannel(); //var res = openApiChannel.queryRes(hospital.ID.ToString(), hospital.Address, hospital.Latitude, hospital.Longitude); if (string.IsNullOrEmpty(supplier)) { supplier = ""; } if (string.IsNullOrEmpty(sendTime)) { sendTime = ""; } var req = new SearchRestaurantReq() { _Channels = supplier, hospitalId = hospital.HospitalCode, address = hospital.Address, latitude = hospital.Latitude, longitude = hospital.Longitude, sendTime = sendTime, keyword = "" }; var res = apiClient.SearchRestaurant(req); if (res == null) { return(Json(new { state = 0, txt = "载入餐厅列表数据失败!", errCode = 9013 })); } res = res.OrderBy(a => a.resName).ToList(); #region 对接餐厅管理平台,排除黑名单餐厅 //比对黑名单数据,对接餐厅管理平台 try { if (WebConfigHandler.IsLoadRestaurantData == "1") { var baseDataChannel = BaseDataClientChannelFactory.GetChannel(); var resstatelist = baseDataChannel.LoadRestaurantState(); var resstateResID = resstatelist.Select(x => x.ResId).ToList(); res = res.Where(x => resstateResID.Contains(x.resId) || x.resName.Contains("堂食")).ToList(); resstatelist = resstatelist.Where(p => p.Status == 0).ToList(); foreach (var item in resstatelist) { var inlist = res.FirstOrDefault(p => p.resId == item.ResId); if (inlist != null) { res.Remove(inlist); } } } } catch (Exception e) { return(Json(new { state = 1, rows = e.Message })); } #endregion //IComparer<SearchRestaurantRes> comparer = new Restaurant(); //res.Sort(comparer); //20200221 修改订单修改餐厅过滤原餐厅 if (ChangeOrderID != null) { var channelOrder = OrderApiClientChannelFactory.GetChannel(); var list = channelOrder.FindOrderByCN(PreApproval.HTCode); string restaurantId = list.RestaurantId; var re = res.Where(a => a.resId != restaurantId).ToList(); return(Json(new { state = 1, rows = re })); } return(Json(new { state = 1, rows = res })); }
/// <summary> /// 判断是否超出预算 /// </summary> /// <param name="cityID"></param> /// <returns></returns> public JsonResult IsBindRes(string hospitalId) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-cn"); var channel = HospitalClientChannelFactory.GetChannel(); var hospital = channel.FindByCode(hospitalId); if (hospital == null || string.IsNullOrEmpty(hospital.Name)) { return(Json(new { state = 1, data = false, txt = "该目标医院暂不支持送餐服务,是否继续?" })); } //var openApiChannel = OpenApiChannelFactory.GetChannel(); //var res = openApiChannel.queryRes(hospital.ID.ToString(), hospital.Address, hospital.Latitude, hospital.Longitude); //if (string.IsNullOrEmpty(supplier)) //{ // supplier = ""; //} var req = new SearchRestaurantReq() { _Channels = "", hospitalId = hospital.HospitalCode, address = hospital.Address, latitude = hospital.Latitude, longitude = hospital.Longitude, keyword = "" }; var res = apiClient.SearchRestaurant(req); if (res == null) { return(Json(new { state = 1, data = false, txt = "该目标医院暂不支持送餐服务,是否继续?" })); } res = res.OrderBy(a => a.resName).ToList(); #region 对接餐厅管理平台,排除黑名单餐厅 //比对黑名单数据,对接餐厅管理平台 if (WebConfigHandler.IsLoadRestaurantData == "1") { var baseDataChannel = BaseDataClientChannelFactory.GetChannel(); var resstatelist = baseDataChannel.LoadRestaurantState(); var resstateResID = resstatelist.Select(x => x.ResId).ToList(); res = res.Where(x => resstateResID.Contains(x.resId) || x.resName.Contains("堂食")).ToList(); resstatelist = resstatelist.Where(p => p.Status == 0).ToList(); foreach (var item in resstatelist) { var inlist = res.FirstOrDefault(p => p.resId == item.ResId); if (inlist != null) { res.Remove(inlist); } } } #endregion //IComparer<SearchRestaurantRes> comparer = new Restaurant(); //res.Sort(comparer); if (res.Count > 0) { return(Json(new { state = 1, data = true })); } else { return(Json(new { state = 1, data = false, txt = "该目标医院暂不支持送餐服务,是否继续?" })); } }