1.安装硬件机具(见上传资源分享)
插上硬件的usb接口,查看win7_64bit驱动文件夹的操作指南。(见上传资源分享)
附件为身份证读取插件
下载驱动的插件,进入shen身份证控件安装文件夹,执行cab.bat文件。
3.在项目的jsp界面添加身份zhen证读取后获取数据的代码。
4.显示身份证信息的div
<div class="portlet-body">
<table class="table table-striped table-bordered table-hover"
id="lfrList">
<tbody>
<tr>
<td class="short-td text-right"><span class="remind">*</span>来访人姓名</td>
<td class="mid-td"><input type="text" class="mid-input requiredField" name="zylfzxm" value="${DjInfo.xm}"/></td>
<td class="short-td text-right"><span class="remind">*</span>来访人类别</td>
<td class="short-td">
<select class="short-input requiredField" name="lb" id="lb">
<option value="">请选择</option>
<option value="个人">个人</option>
<option value="法人">法人</option>
<option value="代理人">代理人</option>
</select>
</td>
<td class="short-td text-right"><span class="remind ">*</span>年龄</td>
<td class="short-td"><input type="text" class="short-input requiredField" name="nl" value="${DjInfo.nl}"/></td>
<td class="short-td text-right"><span class="remind">*</span>性别</td>
<td class="short-td">
<select class="short-input requiredField" name="xb" id = "xb">
<option value="">请选择</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
</td>
<td class="mid-td" rowspan="4">
<img id="showPic" width="120" height="140" style="border:1px solid #ddd;">
<input name="lfzp" id="lfzp" type="hidden"></td>
</tr>
<tr>
<td class="short-td text-right"><span class="remind">*</span>民族</td>
<td class="short-td">
<select class="short-input requiredField" name="mz" id = "xfrmz">
<option value="">请选择</option>
<c:forEach items="${mzList}" var="mz">
<option value="${mz.dmms}">${mz.dmms}</option>
</c:forEach>
</select>
</td>
<td class="short-td text-right"><span class="remind">*</span>证件号</td>
<td class="mid-td" colspan="5"><input type="text" class="default-input requiredField" style="margin-left: 40px;float: left" name="sfzhm" value="${DjInfo.id}"/>
<input type="button" id="ssfz" value="刷身份证" style="margin-left: 20px;float: left">
<a href="ftp://130.1.1.111/sfzkj.rar" target="_blank" style="margin-left:5px;">下载身份证控件</a>
<input type="button" id="drxx" value="导入信息" style="margin-left: 20px;float: left">
</td>
</tr>
<tr>
<td class="short-td text-right"><span class="remind">*</span>电话</td>
<td class="mid-td"><input type="text" class="mid-input requiredField" name="dh" value="${DjInfo.tel}"/></td>
<td class="short-td text-right"><span class="remind">*</span>与当事人关系</td>
<td class="mid-td">
<select class="default-input requiredField" name="ydsrgx" id="ydsrgx">
<option value="">请选择</option>
<option value="本人">本人</option>
<option value="代理人">代理人</option>
<option value="亲属">亲属</option>
<option value="其他">其他</option>
</select>
</td>
<td class="short-td text-right"><span class="remind">*</span>住址</td>
<td class="default-td" colspan="3">
<input type="text" class="address-input requiredField" name="xzz" id = "xfrxzz" value="${DjInfo.zz}"/>
</td>
</tr>
</tbody>
</table>
</div>
5.js代码
<OBJECT Name="GT2ICROCX" classid="CLSID:5A381625-B14C-4ACD-BD3B-8D2BA0B5C7DB" style="display:none" id="identity" CODEBASE="XX_IdrOcx.CAB#version=2,1,0,0" VIEWASTEXT></OBJECT>
<script type="text/javascript">
//刷身份证
$("#ssfz").click(function(){
showvalue();
});
function showvalue() {
var ret = GT2ICROCX.ReadCard();
if (ret == 0) {
// 地址
$("input[name='xzz']").val(GT2ICROCX.Address);
// 姓名(来访人)
$("input[name='zylfzxm']").val(GT2ICROCX.Name);
// 证件号码
$("input[name='sfzhm']").val(GT2ICROCX.CardNo);
// 性别
var xibie = GT2ICROCX.Sex == "1" ? "男":"女";
$('#xb').val(xibie);
// $('#xb option').each(function () {
// if($(this).val() == xibie){
// $(this).attr("selected",true);
// }
// })
//民族
var nation = GT2ICROCX.Nation;
if (nation==1) nation="汉族";
if (nation==2) nation="蒙古族";
if (nation==3) nation="回族";
if (nation==4) nation="藏族";
if (nation==5) nation="维吾尔族";
if (nation==6) nation="苗族";
if (nation==7) nation="彝族";
if (nation==8) nation="壮族";
if (nation==9) nation="布依族";
if (nation==10) nation="朝鲜族";
if (nation==11) nation="满族";
if (nation==12) nation="侗族";
if (nation==13) nation="瑶族";
if (nation==14) nation="白族";
if (nation==15) nation="土家族 ";
if (nation==16) nation="哈尼族";
if (nation==17) nation="哈萨克族";
if (nation==18) nation="傣族";
if (nation==19) nation="黎族";
if (nation==20) nation="傈僳族";
if (nation==21) nation="佤族";
if (nation==22) nation="畲族";
if (nation==23) nation="高山族";
if (nation==24) nation="拉祜族";
if (nation==25) nation="水族";
if (nation==26) nation="东乡族";
if (nation==27) nation="纳西族";
if (nation==28) nation="景颇族";
if (nation==29) nation="柯尔克孜族";
if (nation==30) nation="土族";
if (nation==31) nation="达斡尔族";
if (nation==32) nation="仫佬族";
if (nation==33) nation="羌族";
if (nation==34) nation="布朗族";
if (nation==35) nation="撒拉族";
if (nation==36) nation="毛南族";
if (nation==37) nation="仡佬族";
if (nation==38) nation="锡伯族";
if (nation==39) nation="阿昌族";
if (nation==40) nation="普米族";
if (nation==41) nation="塔吉克族";
if (nation==42) nation="怒族";
if (nation==43) nation="乌孜别克族";
if (nation==44) nation="俄罗斯族";
if (nation==45) nation="鄂温克族";
if (nation==46) nation="德昂族";
if (nation==47) nation="保安族";
if (nation==48) nation="裕固族";
if (nation==49) nation="京族";
if (nation==50) nation="塔塔尔族";
if (nation==51) nation="独龙族";
if (nation==52) nation="鄂伦春族";
if (nation==53) nation="赫哲族";
if (nation==54) nation="门巴族";
if (nation==55) nation="珞巴族";
if (nation==56) nation="基诺族";
if (nation==97) nation="其他";
if (nation==98) nation="外国血统中国籍人士";
$("#xfrmz option[value='"+nation+"']").attr("selected",true);
//生日(年龄)
var date = new Date();
$("input[name='nl']").val(date.getFullYear()-GT2ICROCX.Born.substring(0,4));
//照片
$("#showPic").attr("src","data:image/jpeg;base64,"+GT2ICROCX.Base64Jpg);
$("#lfzp").val(GT2ICROCX.GetPhotoBuffer);
}
else {
alert("读卡错误!请先下载身份证控件");
}
}
|
|