From 2a9aa46a24a8193502adb1206170c365c3394ea3 Mon Sep 17 00:00:00 2001 From: Shark <2788660672@qq.com> Date: Thu, 27 Jul 2023 14:02:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gdsi-Api/Controllers/YBInfoController.cs | 44 ++++++++ Gdsi-Api/Gdsi-Api.csproj | 9 +- Gdsi-Api/Web.config | 54 +++++---- Gdsi/Config/GdsiConfig.cs | 17 +-- Gdsi/Domain/GdStApi.cs | 133 +++++++++++++++++++++++ Gdsi/Gdsi.csproj | 6 +- Gdsi/Model/YBRequest.cs | 9 ++ Gdsi/Model/YBReturn.cs | 50 +++++++++ 8 files changed, 285 insertions(+), 37 deletions(-) create mode 100644 Gdsi-Api/Controllers/YBInfoController.cs create mode 100644 Gdsi/Domain/GdStApi.cs create mode 100644 Gdsi/Model/YBRequest.cs create mode 100644 Gdsi/Model/YBReturn.cs diff --git a/Gdsi-Api/Controllers/YBInfoController.cs b/Gdsi-Api/Controllers/YBInfoController.cs new file mode 100644 index 0000000..74f1e39 --- /dev/null +++ b/Gdsi-Api/Controllers/YBInfoController.cs @@ -0,0 +1,44 @@ +using Gdsi.Domain; +using Gdsi.Model; +using Gdsi_Api.Helper; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace Gdsi_Api.Controllers +{ + public class YBInfoController : Controller + { + public string Index() + { + return "广东省医保平台接口!"; + } + + public ActionResult GetInfo(YBRequest request) + { + // 开始时间 + string beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + YBR info = GdStApi.api_1101(request); + // 结束时间 + string endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + LogHelper.saveInfoLog("GetInfo", beginTime, endTime, toJson(request), toJson(info)); + return Json(info); + } + + #region Tool + /// + /// 对象转Json字符串 + /// + /// 对象 + /// + private string toJson(object obj) + { + return JsonConvert.SerializeObject(obj); + } + #endregion + + } +} \ No newline at end of file diff --git a/Gdsi-Api/Gdsi-Api.csproj b/Gdsi-Api/Gdsi-Api.csproj index aa7f5c3..d149a37 100644 --- a/Gdsi-Api/Gdsi-Api.csproj +++ b/Gdsi-Api/Gdsi-Api.csproj @@ -14,7 +14,7 @@ Properties Gdsi_Api Gdsi-Api - v4.5 + v4.8 false true @@ -25,6 +25,7 @@ + true @@ -60,11 +61,7 @@ - - - - @@ -125,6 +122,7 @@ + Global.asax @@ -146,6 +144,7 @@ + diff --git a/Gdsi-Api/Web.config b/Gdsi-Api/Web.config index 0099fea..34fbf81 100644 --- a/Gdsi-Api/Web.config +++ b/Gdsi-Api/Web.config @@ -1,55 +1,63 @@ - + - - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + \ No newline at end of file diff --git a/Gdsi/Config/GdsiConfig.cs b/Gdsi/Config/GdsiConfig.cs index 801a2ab..9c45b0d 100644 --- a/Gdsi/Config/GdsiConfig.cs +++ b/Gdsi/Config/GdsiConfig.cs @@ -9,20 +9,21 @@ namespace Gdsi.Config public class GdsiConfig { // 医保服务调用地址 - public static string server_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/"; + //public static string server_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/";//正式地址 + public static string server_url = "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/";//测试地址 // 医疗机构编码 - public static string fixmedins_code = "H44040300017"; + public static string fixmedins_code = "H44051100034";//汕头市中医医院 // 医疗机构名称 - public static string fixmedins_name = "珠海市斗门区侨立中医院"; + public static string fixmedins_name = "汕头市中医医院"; // 经办人 - public static string opter = "zzj001"; + public static string opter = "ATM001"; // 经办人姓名 - public static string opter_name = "自助机缴费"; + public static string opter_name = "自助机新"; // 就医地医保区划 - public static string city_code = "440403"; + public static string city_code = "440500"; // 应用编码 - public static string paasid = "zh_prd_ejyy"; + public static string paasid = "st_yyce"; // 密钥 - public static string key = "w42Clf7CG5FpvDTdmy6vFeN5pdnpWUhg"; + public static string key = "VFnJJmfZGU0b91WVujwtwQtZksYfHUHK"; } } diff --git a/Gdsi/Domain/GdStApi.cs b/Gdsi/Domain/GdStApi.cs new file mode 100644 index 0000000..486714b --- /dev/null +++ b/Gdsi/Domain/GdStApi.cs @@ -0,0 +1,133 @@ +using Gdsi.Config; +using Gdsi.Model; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Gdsi.Helper; + +namespace Gdsi.Domain +{ + public class GdStApi + { + private static string api_9001() + { + string result = ""; + var req = new + { + infno = "9001", + msgid = GdsiConfig.fixmedins_code + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10000).ToString().PadLeft(4, '0'), + mdtrtarea_admvs = GdsiConfig.city_code, + insuplc_admdvs = GdsiConfig.city_code, + recer_sys_code = "FD0001", + dev_no = "1", + dev_safe_info = "1", + cainfo = "1", + signtype = "1", + infver = "V1.0", + opter_type = "2", + opter = GdsiConfig.opter, + opter_name = GdsiConfig.opter_name, + inf_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + fixmedins_code = GdsiConfig.fixmedins_code, + fixmedins_name = GdsiConfig.fixmedins_name, + sign_no = "", + //app_id = "", + //enc_type = "", + input = new + { + signIn = new + { + opter_no = GdsiConfig.opter, + mac = "FE-FC-FE-EF-F7-D2", + ip = "192.168.11.27" + } + } + }; + string strReq = JsonConvert.SerializeObject(req); + string strRes = Http.HttpPostByHeader(GdsiConfig.server_url + "9001", strReq); + try + { + JObject jObject = JsonConvert.DeserializeObject(strRes) as JObject; + if (jObject["infcode"].ToString() == "0") + { + if (jObject["output"]["signinoutb"]["sign_no"] == null) + { + return result; + } + result = jObject["output"]["signinoutb"]["sign_no"].ToString(); + return result; + } + return result; + } + catch + { + return result; + } + } + + public static YBR api_1101(YBRequest request) + { + YBR jObject = new YBR(); + Info info = new Info(); + string signNo = api_9001(); + if ("".Equals(signNo)) + { + info.Msg = "签到出错"; + return null; + } + var req = new + { + infno = "1101", + msgid = GdsiConfig.fixmedins_code + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10000).ToString().PadLeft(4, '0'), + mdtrtarea_admvs = GdsiConfig.city_code, + insuplc_admdvs = GdsiConfig.city_code, + recer_sys_code = "FD0001", + dev_no = "1", + dev_safe_info = "1", + cainfo = "1", + signtype = "SM3", + infver = "V1.0", + opter_type = "2", + opter = GdsiConfig.opter, + opter_name = GdsiConfig.opter_name, + inf_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + fixmedins_code = GdsiConfig.fixmedins_code, + fixmedins_name = GdsiConfig.fixmedins_name, + sign_no = signNo, + app_id = "", + enc_type = "", + input = new + { + data = new + { + mdtrt_cert_type = request.type, + mdtrt_cert_no = request.value, + card_sn = "", + begntime = "", + psn_cert_type = "", + certno = "", + psn_name = "" + } + } + }; + string strReq = JsonConvert.SerializeObject(req); + //string strRes = "{\"output\":{\"idetinfo\":[],\"baseinfo\":{\"certno\":\"440508199405181411\",\"psn_no\":\"44050000000100072823\",\"gend\":\"1\",\"exp_content\":null,\"brdy\":\"1994-05-18\",\"naty\":\"99\",\"psn_cert_type\":\"01\",\"psn_name\":\"郑泓鑫\",\"age\":29.1},\"insuinfo\":[{\"insuplc_admdvs\":\"440599\",\"psn_insu_date\":\"2016-12-01\",\"cvlserv_flag\":\"0\",\"balc\":0,\"emp_name\":\"广东民企人力资源开发服务中心有限公司汕头分公司 \",\"psn_type\":\"11\",\"psn_insu_stas\":\"1\",\"insutype\":\"510\",\"paus_insu_date\":null},{\"insuplc_admdvs\":\"440599\",\"psn_insu_date\":\"2016-12-01\",\"cvlserv_flag\":\"0\",\"balc\":0,\"emp_name\":\"广东民企人力资源开发服务中心有限公司汕头分公司 \",\"psn_type\":\"11\",\"psn_insu_stas\":\"1\",\"insutype\":\"310\",\"paus_insu_date\":null}]},\"infcode\":0,\"warn_msg\":null,\"cainfo\":null,\"err_msg\":null,\"refmsg_time\":\"20230607132859943\",\"signtype\":null,\"respond_time\":\"20230607132900129\",\"inf_refmsgid\":\"440000202306071329000009829207\"}"; + string strRes = Http.HttpPostByHeader(GdsiConfig.server_url + "1101", strReq); + + try + { + jObject = JsonConvert.DeserializeObject(strRes); + return jObject; + } + catch (Exception ex) + { + + } + return null; + } + } +} diff --git a/Gdsi/Gdsi.csproj b/Gdsi/Gdsi.csproj index cb2d200..e69e0a6 100644 --- a/Gdsi/Gdsi.csproj +++ b/Gdsi/Gdsi.csproj @@ -9,9 +9,10 @@ Properties Gdsi Gdsi - v4.5 + v4.8 512 true + true @@ -46,8 +47,11 @@ + + + diff --git a/Gdsi/Model/YBRequest.cs b/Gdsi/Model/YBRequest.cs new file mode 100644 index 0000000..a67c63f --- /dev/null +++ b/Gdsi/Model/YBRequest.cs @@ -0,0 +1,9 @@ +namespace Gdsi.Model +{ + public class YBRequest + { + public string type { get; set; } + + public string value { get; set; } + } +} \ No newline at end of file diff --git a/Gdsi/Model/YBReturn.cs b/Gdsi/Model/YBReturn.cs new file mode 100644 index 0000000..1fc4b2f --- /dev/null +++ b/Gdsi/Model/YBReturn.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; + +namespace Gdsi.Model +{ + public class YBR + { + public string infcode { get; set; } + + public YBoutput output { get; set; } + + public string err_msg { get; set; } + } + + public class YBbaseInfo + { + public string psn_no { get; set; } + public string psn_cert_type { get; set; } + public string certno { get; set; } + public string psn_name { get; set; } + public string gend { get; set; } + public string naty { get; set; } + public string brdy { get; set; } + public string age { get; set; } + } + + public class YBinsuInfo + { + public string balc { get; set; } + public string insutype { get; set; } + public string psn_type { get; set; } + public string psn_insu_stas { get; set; } + public string psn_insu_date { get; set; } + public string cvlserv_flag { get; set; } + public string insuplc_admdvs { get; set; } + public string emp_name { get; set; } + } + + public class YBoutput + { + public YBbaseInfo baseinfo { get; set; } + public List insuinfo { get; set; } + public List feedetail { get; set; } + } + + public class YBBZInfo + { + public string opsp_dise_code { get; set; } + public string opsp_dise_name { get; set; } + } +} \ No newline at end of file