//注册单个注册健康卡
public string Lx_registerHealthCard(string lxbirthday, string lxidtype, string lxgender, string lxidCard,string lxname,string lxnation,string lxaddress,string lxphone1,string lxwechatcode)
{
var result = proxy.RegisterHealthCard(
new RegisterHealthCardReq
{
birthday = lxbirthday, //生日
idType = lxidtype, //证件类型
gender = lxgender, //性别
idNumber = lxidCard, //身份证号
name = lxname, //姓名
nation = lxnation, //民族
phone1 = lxphone1, //手机号
address=lxaddress, //地址
wechatCode = lxwechatcode
},
new com.tencent.healthcard.HealthCardOpenAPI.CommonIn
{
requestId = System.Guid.NewGuid().ToString(),
hospitalId = LxAppConfig.GetHospitalId(),
//channelNum = 0,
appToken = appToken
}
);
var commonOut =(com.tencent.healthcard.HealthCardOpenAPI.CommonOut)result["commonOut"];
var rsp = (RegisterHealthCardRsp)result["rsp"];
return JsonConvert.SerializeObject(rsp);
}
//注册批量健康卡
public string Lx_RegisterBatchHealthCard()
{
#region 测试和程序代码
BatchHealthCardItem[] items = new BatchHealthCardItem[2];
for (int i = 0; i < 2; i++)
{
BatchHealthCardItem item = new BatchHealthCardItem
{
birthday = "1996-01-23",
idType = "01",
gender = "男",
idCard = "432901196310056419",
name = "蒋建正",
nation = "汉族",
phone1 = "18656130435",
wechatCode = "13B8AC208CEDACE7DD1DF57963150664"
};
items[i] = item;
}
var result = proxy.RegisterBatchHealthCard(
new RegisterBatchHealthCardReq
{
healthCardItems = items
},
new com.tencent.healthcard.HealthCardOpenAPI.CommonIn
{
requestId = System.Guid.NewGuid().ToString(),
hospitalId = "20006",
appToken = appToken
}
);
var commonOut = (com.tencent.healthcard.HealthCardOpenAPI.CommonOut)result["commonOut"];
var rsp = (RegisterBatchHealthCardRsp)result["rsp"];
return JsonConvert.SerializeObject(rsp);
}
常见问题总结:
1、wechatCode 编码30分钟时效,用过之后失效。
2、身份证信息一定要用真实的,微信端验证真实身份信息。
3、提示重要参数问题,需要看看参数是否有效和值是否正确。