private static string GetInterfaceData(string code, string feemzId, out string ItemInfo, out string content) { ItemInfo = string.Empty; content = string.Empty; if (feemzId == "5602")//生鲜项目 { flag = "5602"; code = code.Substring(2); } else { flag = "5400"; } IDictionary <string, string> parameters = new Dictionary <string, string>(); string timestamp, token; SetBaseInterfcaeParameters(out timestamp, out token); parameters.Add("method", nameof(GetGoodsWithHis)); parameters.Add("flag", flag); parameters.Add("model", GetGoodsWithHis); DataMain data_main = new DataMain() { goods_code = code, timestamp = timestamp, token = token, }; string Data_Json = SetParametersJson(parameters, data_main); content = HttpRequestHelper.PostPage(strURL, Data_Json); return(code); }
private static string GetInterfaceData(string code, string feemzId, out string ItemInfo, out string content) { ItemInfo = string.Empty; content = string.Empty; string strURL = string.Empty; if (feemzId == "5602")//生鲜项目 { strURL = "http://fenyd.succhi.com:10043/api/His/GetGoodsWithHis"; code = code.Substring(2); } else { strURL = "http://fenyd.succhi.com:10042/api/His/GetGoodsWithHis"; } string timestamp = HttpRequestHelper.GetTimeStamp(Orm.Config.Service.DBClientService.GetServerTime()); string md5 = MD5Helper.GetStringByMd5(timestamp); string token = MD5Helper.GetStringByMd5(md5 + "his9aa1_3db6303565bc"); DataMain data_main = new DataMain() { goods_code = code, timestamp = timestamp, token = token, }; JavaScriptSerializer jsc = new JavaScriptSerializer(); System.Text.StringBuilder jsonData = new System.Text.StringBuilder(); jsc.Serialize(data_main, jsonData); string dataDetail = jsonData.ToString(); content = HttpRequestHelper.PostPage(strURL, dataDetail); return(code); }
/// <summary> /// 获取药店所有药品库存 /// </summary> /// <param name="ShopCode">药店编码</param> /// <param name="LsRepType">处方类型</param> /// <returns></returns> public static ShopStock GetAllShopStocks(string ShopCode, int LsRepType) { SetFlagValue(LsRepType); string shop_code = ShopCode; HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(strURL); //参数 IDictionary <string, string> parameters = new Dictionary <string, string>(); string timestamp, token; SetBaseInterfcaeParameters(out timestamp, out token); parameters.Add("method", nameof(ShopStocks)); parameters.Add("flag", flag); parameters.Add("model", ShopStocks); DataMain data_main = new DataMain() { shop_code = shop_code, goods_code = "", timestamp = timestamp, token = token }; string Data_Json = SetParametersJson(parameters, data_main); string jsonString = HttpRequestHelper.PostPage(strURL, Data_Json); ShopStock returnData = jsSerializer.Deserialize <ShopStock>(jsonString); return(returnData); }
public static List <PharmacyInfo> GetPharmacyInfoListlist(int type, int CurrHospital) { ReturnValue returnValue = new ReturnValue(); SetFlagValue(type); method = "GetDeptList"; IDictionary <string, string> parameters = new Dictionary <string, string>(); string timestamp = HttpRequestHelper.GetTimeStamp(Orm.Config.Service.DBClientService.GetServerTime()); string md5 = MD5Helper.GetStringByMd5(timestamp); string token = MD5Helper.GetStringByMd5(md5 + strToken); parameters.Add("method", nameof(GetDeptList)); parameters.Add("flag", flag); parameters.Add("model", GetDeptList); DataMain data_main = new DataMain() { timestamp = timestamp, token = token }; string dataDetail = SetParametersJson(parameters, data_main); string returnJsonDate = HttpRequestHelper.PostPage(strURL, dataDetail); if (returnJsonDate.Contains("ok")) { if (returnJsonDate.Contains("[") & returnJsonDate.Contains("]")) { int IndexofA = returnJsonDate.IndexOf("["); int IndexofB = returnJsonDate.IndexOf("]"); string contentList = returnJsonDate.Substring(IndexofA, IndexofB - IndexofA + 1); if (type == (int)EnumPharmacyType.药品药房) { List <PharmacyInfo> PharmacyInfoListlist = jsSerializer.Deserialize <List <PharmacyInfo> >(contentList); return(MergeMessage(type, PharmacyInfoListlist, CurrHospital)); } else { List <PharmacyInfo> SXPharmacyInfoListlist = jsSerializer.Deserialize <List <PharmacyInfo> >(contentList); return(MergeMessage(type, SXPharmacyInfoListlist, CurrHospital)); } } else { return(new List <PharmacyInfo>()); } } else { return(new List <PharmacyInfo>()); } }
public static JsonToAbject ReturnGoodsInterface(string orderId, int type) { SetFlagValue(type); System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(strURL); //参数 IDictionary <string, string> parameters = new Dictionary <string, string>(); string timestamp, token; SetBaseInterfcaeParameters(out timestamp, out token); parameters.Add("method", nameof(invalidOrders)); parameters.Add("flag", flag); parameters.Add("model", invalidOrders); DataMain data_main = new DataMain() { order_id = orderId, token = token, timestamp = timestamp, }; string Data_Json = SetParametersJson(parameters, data_main); string jsonString = HttpRequestHelper.PostPage(strURL, Data_Json); JsonToAbject jsonToAbject = HttpRequestHelper.JsonToObject <JsonToAbject>(jsonString); return(jsonToAbject); }
/// <summary> /// 根据单个商品编码和药店编码查询库存是否足够 /// </summary> /// <param name="LsRepType">处方类型</param> /// <param name="code">编码</param> /// <param name="RecipeDtlTotality">数量</param> /// <param name="ShopCode">药店编码</param> /// <returns></returns> public static bool ShopStocksSingle(int LsRepType, string code, double RecipeDtlTotality, string ShopCode) { if (Service.DBClientService.GetModelByID <BsHospital>(UserProfiles.HospitalID).IsInterface) { flag = "5400"; string shop_code = ShopCode; if (LsRepType == (int)EnumRecipeType.生鲜)//生鲜项目 { flag = "5602"; code = code.Substring(2); } HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL); //参数 IDictionary <string, string> parameters = new Dictionary <string, string>(); string timestamp, token; SetBaseInterfcaeParameters(out timestamp, out token); parameters.Add("method", nameof(ShopStocks)); parameters.Add("flag", flag); parameters.Add("model", ShopStocks); DataMain data_main = new DataMain() { shop_code = shop_code, goods_code = code, timestamp = timestamp, token = token }; string Data_Json = SetParametersJson(parameters, data_main); string jsonString = HttpRequestHelper.PostPage(strURL, Data_Json); ShopStock returnData = jsSerializer.Deserialize <ShopStock>(jsonString); double stocks = 0; if (returnData.data == null) { //Orm.Client.Base.FrmMessageRemind.Show("没有查询到该项目库存,请更换药品或者手动删除项目"); return(false); } else if (returnData.data.Count > 0) { stocks = double.Parse(returnData.data[0].stocks); if (RecipeDtlTotality > stocks) { if (LsRepType == (int)EnumOuRecipeLsRepType.中药) { //Orm.Client.Base.FrmMessageBox.ShowDialog(string.Format("【{0}】处方总数【{1}】库存剩余数【{2}】,该项目库存不足,请更换药品或者手动更改数量", returnData.data[0].name, RecipeDtlTotality * 10, stocks * 10), "系统提示"); } else { //Client.Base.FrmMessageBox.ShowDialog(string.Format("【{0}】处方总数【{1}】库存剩余数【{2}】,该项目库存不足,请更换药品或者手动更改数量", returnData.data[0].name, RecipeDtlTotality, stocks), "系统提示"); } return(false); } else { return(true); } } else { //Orm.Client.Base.FrmMessageBox.ShowDialog(string.Format("没有查询到该项目库存,请更换药品或者手动删除项目"), "系统提示"); return(false); } } else { return(true); } }
public static string SetParametersJson(IDictionary <string, string> parameters, DataMain data_main) { string Data_Json = ""; JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); System.Text.StringBuilder data_mainJson = new System.Text.StringBuilder(); jsSerializer.Serialize(data_main, data_mainJson); string dataDetail = data_mainJson.ToString(); parameters.Add("data", dataDetail); System.Text.StringBuilder data_Json = new System.Text.StringBuilder(); jsSerializer.Serialize(parameters, data_Json); return(Data_Json = data_Json.ToString()); }
public static string AddBigOrdersInterface(PMSaveBalanceInfo balanceInfo, int LsRepType) { string shop_code = string.Empty; string jsonString = string.Empty; if (balanceInfo.OuInvoice != null && balanceInfo.OuInvoiceDtlList != null) { foreach (var item in balanceInfo.ouRecipeList) { if (LsRepType == 17) { if (item.LsRepType == 17) { shop_code = item.DeptNo; } } else { if (item.LsRepType != 17) { shop_code = item.DeptNo; } } } if (shop_code == string.Empty) { return("NONE"); } List <data_detail> detailList = new List <data_detail>(); double ypprice = 0; double sxprice = 0; foreach (OuInvoiceDtl ouInvoiceDtl in balanceInfo.OuInvoiceDtlList) { if (LsRepType == (int)EnumRecipeType.生鲜)//生鲜项目 { if (ouInvoiceDtl.FeeId == Config.DBClientBaseInRedis.GetList <BsMzFeety>("Name=@0", "生鲜").FirstOrDefault().GUID) { data_detail data_detail = new data_detail { goods_code = Config.DBClientBaseInRedis.GetModelByGuid <BsItem>(ouInvoiceDtl.ItemId).Code.Substring(2), qty = ouInvoiceDtl.Totality, price = ouInvoiceDtl.Price, subtotal = ouInvoiceDtl.Amount, memo = ouInvoiceDtl.Memo }; sxprice += data_detail.price * data_detail.qty; detailList.Add(data_detail); } } if (LsRepType == (int)EnumRecipeType.西药) { if (ouInvoiceDtl.FeeId == Config.DBClientBaseInRedis.GetList <BsMzFeety>("Name=@0", "西药/中成药").FirstOrDefault().GUID) { data_detail data_detail = new data_detail { goods_code = Config.DBClientBaseInRedis.GetModelByGuid <BsItem>(ouInvoiceDtl.ItemId).Code, qty = ouInvoiceDtl.Totality, price = ouInvoiceDtl.Price, subtotal = ouInvoiceDtl.Amount, memo = ouInvoiceDtl.Memo }; ypprice += data_detail.price * data_detail.qty; detailList.Add(data_detail); } if (ouInvoiceDtl.FeeId == Config.DBClientBaseInRedis.GetList <BsMzFeety>("Name=@0", "中药").FirstOrDefault().GUID) { BsItem bsItems = Config.DBClientBaseInRedis.GetModelByGuid <BsItem>(ouInvoiceDtl.ItemId); //Orm.Config.Common.UtilsLocCache.GetCache<BsItem>(t => t.ID == ouInvoiceDtl.ItemId && t.LocationId== UserProfiles.LocationID); data_detail data_detail = new data_detail { goods_code = bsItems.Code, qty = ouInvoiceDtl.Totality / (bsItems.PharmacyRatio == 0 ? 10 : bsItems.PharmacyRatio), price = Math.Round(ouInvoiceDtl.Price * (bsItems.PharmacyRatio == 0 ? 10 : bsItems.PharmacyRatio), 2), subtotal = Math.Round(ouInvoiceDtl.Amount, 2), memo = ouInvoiceDtl.Memo }; ypprice += data_detail.price * data_detail.qty; detailList.Add(data_detail); } } } if (detailList.Count == 0) { return("NONE"); } string strPayWay = string.Empty; if (balanceInfo.OuInvoicePayList != null && balanceInfo.OuInvoicePayList.Count > 0) { for (int i = 0; i < balanceInfo.OuInvoicePayList.Count; i++) { if (i == 0) { strPayWay = strPayWay + string.Format("{0}", balanceInfo.OuInvoicePayList[i].PayWayName); } else { strPayWay = strPayWay + string.Format("/{0}", balanceInfo.OuInvoicePayList[i].PayWayName); } } } //配送相关信息 string address = string.Empty; string deliverytimebymember = string.Empty; string mobile_phone = string.Empty; string consignee = string.Empty; if (balanceInfo.ouRecipeList != null && balanceInfo.ouRecipeList.Count > 0) { if (balanceInfo.CurrentPatient.IsTakeMedicine > 0) { deliverytimebymember = balanceInfo.CurrentPatient.DistributionPeriod; mobile_phone = balanceInfo.CurrentPatient.Mobile; consignee = balanceInfo.CurrentPatient.PatientName; address = balanceInfo.CurrentPatient.DistributionAddress; } else { mobile_phone = balanceInfo.CurrentPatient.Mobile; consignee = balanceInfo.CurrentPatient.PatientName; } } IDictionary <string, string> parameters = new Dictionary <string, string>(); string timestamp, token; SetFlagValue(LsRepType); SetBaseInterfcaeParameters(out timestamp, out token); parameters.Add("tran_serial_no", flag); parameters.Add("operate_ip", flag); parameters.Add("method", nameof(AddBigOrders)); parameters.Add("flag", flag); parameters.Add("model", AddBigOrders); DataMain data_main = new DataMain() { shop_code = shop_code, amount = 0, order_sn = balanceInfo.OuInvoice.InvoNo, pay_name = strPayWay, mobile_phone = mobile_phone, address = address, consignee = consignee, deliverytimebymember = deliverytimebymember, creater = Orm.Config.UserProfiles.UserName, state = "1", timestamp = timestamp, token = token, data_detail = detailList, }; if (LsRepType == 17) { data_main.amount = sxprice; } else { data_main.amount = ypprice; } string Data_Json = SetParametersJson(parameters, data_main); jsonString = HttpRequestHelper.PostPage(strURL, Data_Json); if (!jsonString.Contains("ok")) { return(jsonString); } else { return(jsonString); } } return(jsonString); }
/// <summary> /// Query /// </summary> void Query() { try { int opIp = this.rdoOp.Checked ? 1 : 2; if (opIp == 1) { this.gvMain.Columns["cardno"].HeaderText = "卡号"; this.gvMain.Columns["bedno"].Visible = false; } else if (opIp == 2) { this.gvMain.Columns["cardno"].HeaderText = "住院号"; this.gvMain.Columns["bedno"].Visible = true; } string startDate = this.dteStart.Value.ToString("yyyy-MM-dd"); string endDate = this.dteEnd.Value.ToString("yyyy-MM-dd"); if (Convert.ToDateTime(startDate) > Convert.ToDateTime(endDate)) { MessageBox.Show("开始日期不能大于结束日期。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } clsPublic.PlayAvi("查询数据,请稍候..."); DataMain.Rows.Clear(); DataDet.Rows.Clear(); clsDomainControlOPMedStore svc = new clsDomainControlOPMedStore(); DataTable dt = svc.QueryProxyBoilMed(startDate, endDate, this.rdoOp.Checked ? 1 : 2); svc = null; string checkId = string.Empty; this.DataSource = dt; List <string> lstCheckId = new List <string>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (this.rdoOp.Checked) // 门诊时recipeId为处方Id { checkId = dr["recipeid"].ToString(); } else if (this.rdoIp.Checked) // 住院时recipeId为registerId { checkId = dr["recipeid"].ToString() + " " + dr["recipeno"].ToString() + Convert.ToDateTime(dr["recipedate"].ToString()).ToString("yyyy-MM-dd"); } if (lstCheckId.IndexOf(checkId) < 0) { lstCheckId.Add(checkId); } else { continue; } DataRow drNew = DataMain.NewRow(); if (dr["sendstatus"] == DBNull.Value) { drNew["sendstatus"] = "未发送"; } else { switch (Convert.ToInt32(dr["sendstatus"])) { case -1: drNew["sendstatus"] = "撤销"; break; case 0: drNew["sendstatus"] = "未发送"; break; case 1: drNew["sendstatus"] = "已发送"; break; case 2: drNew["sendstatus"] = "转药房"; break; default: drNew["sendstatus"] = "未发送"; break; } } drNew["recipedate"] = dr["recipedate"].ToString(); drNew["patname"] = dr["patname"].ToString(); drNew["recipeid"] = dr["recipeid"].ToString(); drNew["deptname"] = (this.rdoOp.Checked ? dr["deptname"].ToString() : dr["areaname"].ToString()); drNew["doctname"] = dr["doctname"].ToString(); drNew["recipeno"] = dr["recipeno"].ToString(); if (opIp == 1) { drNew["cardno"] = dr["cardno"].ToString(); drNew["bedno"] = ""; } else if (opIp == 2) { drNew["cardno"] = dr["ipno"].ToString(); drNew["bedno"] = dr["bedno"].ToString(); } drNew["putmedid"] = dr["putmedid"].ToString(); DataMain.Rows.Add(drNew); } DataMain.AcceptChanges(); this.gvMain.DataSource = DataMain; if (DataMain.Rows.Count > 0 && DataDet.Rows.Count == 0) { ShowMedDetail(0); } for (int i = 0; i < this.gvMain.RowCount; i++) { if (this.gvMain.Rows[i].Cells["sendstatus"].Value.ToString() == "撤销") { this.gvMain.Rows[i].DefaultCellStyle.BackColor = Color.Silver; } else if (this.gvMain.Rows[i].Cells["sendstatus"].Value.ToString() == "已发送") { this.gvMain.Rows[i].DefaultCellStyle.BackColor = Color.FromArgb(103, 202, 103); } else if (this.gvMain.Rows[i].Cells["sendstatus"].Value.ToString() == "转药房") { this.gvMain.Rows[i].DefaultCellStyle.BackColor = Color.SkyBlue; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsPublic.CloseAvi(); } }