stzyy
Shark 1 year ago
parent 5e7310a2c5
commit 2a9aa46a24
  1. 44
      Gdsi-Api/Controllers/YBInfoController.cs
  2. 9
      Gdsi-Api/Gdsi-Api.csproj
  3. 54
      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> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Gdsi_Api</RootNamespace> <RootNamespace>Gdsi_Api</RootNamespace>
<AssemblyName>Gdsi-Api</AssemblyName> <AssemblyName>Gdsi-Api</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews> <MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress /> <Use64BitIISExpress />
@ -25,6 +25,7 @@
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -60,11 +61,7 @@
<Reference Include="System.Web.Entity" /> <Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" /> <Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" /> <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" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Abstractions" /> <Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" /> <Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
@ -125,6 +122,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\YBInfoController.cs" />
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
@ -146,6 +144,7 @@
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Models\" /> <Folder Include="Models\" />
<Folder Include="Model\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="NLog.config"> <Content Include="NLog.config">

@ -1,55 +1,63 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0"?>
<!-- <!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问 有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=301880 https://go.microsoft.com/fwlink/?LinkId=301880
--> -->
<configuration> <configuration>
<appSettings> <appSettings>
<add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true" /> <add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings> </appSettings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
可在 <httpRuntime> 标记上设置以下特性。
<system.Web>
<httpRuntime targetFramework="4.8" />
</system.Web>
-->
<system.web> <system.web>
<compilation debug="true" targetFramework="4.5" /> <compilation debug="true" targetFramework="4.8"/>
<httpRuntime targetFramework="4.5" /> <httpRuntime targetFramework="4.5"/>
</system.web> </system.web>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" /> <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f"/>
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" /> <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" /> <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" /> <bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
<system.codedom> <system.codedom>
<compilers> <compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers> </compilers>
</system.codedom> </system.codedom>
</configuration> </configuration>

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