$(function() {
	var sumAmtApp=0;
	$(".preapp").each(function() {
		sumAmtApp=Number(sumAmtApp)+Number(this.value);
	});
	$("#sumAmtApp").html(sumAmtApp);
	
	var sumAmtPre=0;
	$(".amtpre").each(function() {
		sumAmtPre=Number(sumAmtPre)+Number(this.innerHTML);
	});
	$("#sumAmtPre").html(sumAmtPre);
	
});

function agress(){
	var params={};
	params["preno"]=$("#preno").val();
	params["verDescribe"]=$("#verDescribe").val();
	$.ajax({
		type : "POST",
		url : getRootPath()+"/preauthorization/savegrant.do",
		//contentType : "application/json; charset=UTF-8",
		data : params,
		success : function(data) {
			SkipByPost(getRootPath()+"/preauthorization/examinePoolsQuery.do",{});
		},
		error : function() {
			alert("保存失败！");
		}
	});
}
function disagress(){
	var params={};
	params["preno"]=$("#preno").val();
	params["verDescribe"]=$("#verDescribe").val();
	$.ajax({
		type : "POST",
		url : "disgrant.do",
		//contentType : "application/json; charset=UTF-8",
		data : params,
		success : function(data) {
			SkipByPost(getRootPath()+"preauthorization/examinePoolsQuery.do",{});
		},
		error : function() {
			alert("保存失败！");
		}
	});
}

function  steppage(){
	var applicantType = $("#type").val();
	var businessSource = $("#source").val();
	var applicantPid = $("#pid").val();
	var applicantName = $("#name").val();
	var preNo = $("#preno").val();
	var policyno = $("#policyNo").val();
	var currentDateBegin = $("#begin").val();
	var currentDateEnd = $("#end").val();
	
	var params = {};
	params.applicantType = applicantType;
	params.businessSource = businessSource;
	params.applicantPid = applicantPid;
	params.applicantName = applicantName;
	params.preNo = preNo;
	params.policyno = policyno;
	params.currentDateBegin = currentDateBegin;
	params.currentDateEnd = currentDateEnd;
	
	SkipByPost("preauthorizationquery.do",params);
}


function showsqxmDiv(flag){
	$("#sqxmresultData").html("");
	var claimIllsBy_ = $("#sqxmIllsBy_").val();
	var illTypes = claimIllsBy_.split("_");
	for(var i=0;i<illTypes.length;i++){
		var ill = illTypes[i].split(",");
		$("#sqxmresultData").append("<tr>" +
				"<td width=\"23%\">"+ill[0]+"</td>" +
				"<td width=\"45%\">"+ill[1]+"</td>" +
				"</tr>");
	}
	if(flag!='init'){
		showDiv("sqxmresult");
	}
	
	
}
//-----------------------------------------------医疗信息 医疗诊断


function showylxxDiv(flag){
	$("#ylxxresultData").html("");
	var claimIllsBy_ = $("#ylxxIllsBy_").val();
	var illTypes = claimIllsBy_.split("_");
	for(var i=0;i<illTypes.length;i++){
		var ill = illTypes[i].split(",");
		$("#ylxxresultData").append("<tr>" +
				"<td width=\"23%\">"+ill[0]+"</td>" +
				"<td width=\"45%\">"+ill[1]+"</td>" +
				"</tr>");
	}
	if(flag!='init'){
		showDiv("ylxxresult");
	}
}

//-----------------------------------------------医疗信息 医疗诊断

function showjvDiv(flag){
	$("#jbresultData").html("");
	var claimIllsBy_ = $("#claimIllsBy_").val();
	var illTypes = claimIllsBy_.split("_");
	for(var i=0;i<illTypes.length;i++){
		var ill = illTypes[i].split(",");
		$("#jbresultData").append("<tr>" +
				"<td width=\"23%\">"+ill[0]+"</td>" +
				"<td width=\"45%\">"+ill[1]+"</td>" +
				"</tr>");
	}
	if(flag!='init'){
		showDiv("jbresult");
	}
	
	
}

//-----------------------------------------------医疗授权信息 医疗诊断