stzyy
Shark 1 year ago
parent 5e7310a2c5
commit 2a9aa46a24
  1. 44
      Gdsi-Api/Controllers/YBInfoController.cs
  2. 9
      Gdsi-Api/Gdsi-Api.csproj
  3. 12
      Gdsi-Api/Web.config
  4. 17
      Gdsi/Config/GdsiConfig.cs
  5. 133
      Gdsi/Domain/GdStApi.cs
  6. 6
      Gdsi/Gdsi.csproj
  7. 9
      Gdsi/Model/YBRequest.cs
  8. 50
      Gdsi/Model/YBReturn.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
/// <summary>
/// 对象转Json字符串
/// </summary>
/// <param name="obj">对象</param>
/// <returns></returns>
private string toJson(object obj)
{
return JsonConvert.SerializeObject(obj);
}
#endregion
}
}

@ -14,7 +14,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Gdsi_Api</RootNamespace>
<AssemblyName>Gdsi-Api</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
@ -25,6 +25,7 @@
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -60,11 +61,7 @@
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
@ -125,6 +122,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\YBInfoController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
@ -146,6 +144,7 @@
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Models\" />
<Folder Include="Model\" />
</ItemGroup>
<ItemGroup>
<Content Include="NLog.config">

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=301880
@ -10,8 +10,16 @@
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
可在 <httpRuntime> 标记上设置以下特性。
<system.Web>
<httpRuntime targetFramework="4.8" />
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5" />
<compilation debug="true" targetFramework="4.8"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
<runtime>

@ -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";
}
}

@ -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<YBR>(strRes);
return jObject;
}
catch (Exception ex)
{
}
return null;
}
}
}

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Gdsi</RootNamespace>
<AssemblyName>Gdsi</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -46,8 +47,11 @@
<ItemGroup>
<Compile Include="Config\GdsiConfig.cs" />
<Compile Include="Domain\GdsiApi.cs" />
<Compile Include="Domain\GdStApi.cs" />
<Compile Include="Helper\Http.cs" />
<Compile Include="Model\Info.cs" />
<Compile Include="Model\YBRequest.cs" />
<Compile Include="Model\YBReturn.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,9 @@
namespace Gdsi.Model
{
public class YBRequest
{
public string type { get; set; }
public string value { get; set; }
}
}

@ -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<YBinsuInfo> insuinfo { get; set; }
public List<YBBZInfo> feedetail { get; set; }
}
public class YBBZInfo
{
public string opsp_dise_code { get; set; }
public string opsp_dise_name { get; set; }
}
}
Loading…
Cancel
Save