
function queryBlack(){
	var idtype = $("#certificates").val();
	var keyword = $("#keyword").val();
	if(idtype==''||idtype==null){
		alert("请输入证件类型");
		return false;
	}
	if($("#keyword").val() == $("#keyword").attr("placeholder")){
		keyword='';
	}
	
		if(keyword==null || keyword==''){
			alert("查询条件不能为空！");
			return false;
		}else {
			
			 findblack();
}

function findblack(){
	/*if(!checkIdentityCard($("#keyword").val())){
		
		return false;
	}*/
	$("#sOpercode").html("");
	$("#uw_risk_desc").html("");
	$("#saddresonValue").html("");
	$("#sAddreason").html("");
	$("#sAddabs").html("");
	$("#smoveno").html("");
	$("#sMovereason").html("");
	var channelType = $("#channelType").val();
	$.ajax({
		
		type:"POST",
		url:"queryBlack.do",
		data:{"sId":keyword,"channelType":channelType,"idtype":idtype},
		error:function(){
			alert("查询失败！");
			return;
		},
		success:function(data){
			$("#blacklistContext").html("");
			if(data==null || data==""){
				$("#blacklistContext").html("");
        		$("#blacklistContext").append("<tr><td colspan=\"7\">查询不到相关内容，请检查查询条件</td></tr>");
			}
				for(var i= 0; i < data.length; i++){
					var blacklist = data[i];
					$("#blacklistContext").append("<tr onclick=\"skip('"+isNull(keyword)+"','"+isNull(idtype)+"',this)\" style=\"cursor: pointer;\"><td>"+isNull(blacklist.sFName)+"</td><td>"+isNull(keyword)+
							"</td><td>"+isNull(blacklist.sFlag)+"</td><td>"+isNull(blacklist.sBegdate)+"</td><td>"
							+isNull(blacklist.sFEnddate)+"</td><td>"+isNull(blacklist.sClaimno)+"</td><td>"+isNull(blacklist.sPolicyno)+"</td></tr>");
				}
				
				
			
		}
		
		
	});
	
}	
	
}

function skip(sId,idtype,flag){
	$("#sOpercode").html("");
	$("#uw_risk_desc").html("");
	$("#saddresonValue").html("");
	$("#sAddreason").html("");
	$("#sAddabs").html("");
	$("#smoveno").html("");
	$("#sMovereason").html("");
	var pageClaimNo=$(flag).find("td:eq(5)").text();
	var channelType = $("#channelType").val();
	
		$.ajax({
			type: "post",  
			url : "lrcxQuery.do", 
			data:{"sId":sId,"channelType":channelType,"idtype":idtype},
			
			success:function(data){
				
				if(data ==""){
					alert("sorry");
					return ;
				}
				for ( var i= 0; i < data.length; i++) {
					if(data[i].sClaimno==pageClaimNo){
						$("#sOpercode").html(data[i].sOpercode);
						$("#uw_risk_desc").html(data[i].uw_risk_desc);
						$("#saddresonValue").html(data[i].reason);//录入原因
						$("#sAddreason").html(data[i].sAddreason);//录入原因码
						$("#sAddabs").html(data[i].sAddabs);//具体描述 
						$("#smoveno").html(data[i].smoveno+data[i].smovenoName);
						$("#sMovereason").html(data[i].sMovereason);
						 //健康告知
						 var healthInform = data[i].healthInformList;
						 if(healthInform>0){
							 $("#jkgz").html("");
							for(var i= 0; i < healthInform.length; i++){
								var jkgzHtml="";
								var h = healthInform[i];
								
								$("#jkgz").append("<tr><td>"+i+"</td><td>"+h.flag+"</td><td>"+h.tel_code1+"</td><td>"+h.tel_code2+"</td><td>"+h.tel_type+"</td><td>"+h.tel_value+"</td><td>"+h.dscrptn+"</td></tr>");
								
							}
						 }
						 break;
					}
				}
			},
			error:function(){
				alert("sorry!");
			}
			
			
		});
	
}

//回车查询
function enterQuery(){
	 var event = window.event||arguments.callee.caller.arguments[0];
	 if(event.keyCode==13){
		 queryBlack();
	 }
}




function isNull(a){
	
	if(a==null){
		return "";
	}else if(a=="Y"){
		return "是";
	}else if(a=="N"){
		return "否";
	}else{
		return a;
	}
	
	
}

//单选

$(".radio_yes,.radio_no").click(function(){ 
	  
	  if($(this).is(".radio_yes")){
	    
		$(this).removeClass("radio_yes");
		$(this).addClass("radio_no"); 
	  
	  }
	  
	  else{
			var obj=  $(".radio_yes");
			obj.removeClass("radio_yes");          
			obj.addClass("radio_no"); 
			$(this).removeClass("radio_no");
	        $(this).addClass("radio_yes");
	        $("#channelType").val($(this).attr("channelValue"));
	}
    
	  
});


function certificate(val){
	$("#keyword").val("");
	$("#certificates").val(val);
}