
function appInfo(){this.title="浙江省中医药科教信息系统";}
function ResultCode(){}
ResultCode.UNLOGIN=-3;ResultCode.DENY=-2;ResultCode.ERROR=-1;ResultCode.SUCCESS=1;ResultCode.FAILED=2;ResultCode.THIRD=3;ResultCode.FOURTH=4;ResultCode.FIFTH=5;ResultCode.SIXTH=6;function isDenied(resultStatus,alert){var flag=resultStatus.code==ResultCode.DENY||resultStatus.code==ResultCode.UNLOGIN;if(flag&&alert==true){$.messager.alert("拒绝",resultStatus.msg,"error");}
return flag;}
function isError(resultStatus,alert){var flag=resultStatus.code==ResultCode.ERROR;if(flag&&alert==true){$.messager.alert("错误",resultStatus.msg,"error");}
return flag;}
function isSuccess(resultStatus){return resultStatus.code==ResultCode.SUCCESS;}
function isFailed(resultStatus){return resultStatus.code==ResultCode.FAILED;}
function showMsg(m){$.messager.show({title:"浙江省中医药科教信息系统",msg:m,showType:"show"});};function showProgress(t,m){if(t==null){t="请稍候";}
if(m==null){m="正在处理中...";}
$.messager.progress({title:t,msg:m});}
function closeProgress(){$.messager.progress('close');}
function initBaseStart(param){return true;}
function initBaseFinish(param){return true;}
function openDialog(id,callback,param){if(callback!=null&&callback(param)==false){return false;}
$('#'+id).dialog('open');return true;}
function closeDialog(id,callback,param){if(callback!=null&&callback(param)==false){return false;}
$('#'+id).dialog('close');return true;}
function showLoading(id){$('#'+id).addClass("loading");}
function hideLoading(id){$('#'+id).removeClass("loading");}
function hasLoaded(id){id=id==null?"#baseLogo":"#"+id;if($(id).data("loaded")){return true;}else{$(id).data("loaded",true);return false;}}
function changeValidateCode(id){var timenow=new Date().getTime();$('#'+id).attr('src',getContextPath()+"/vc.action?timeStamp="+timenow);}
function showComboTreeLoading(id){$("#"+id).combotree({data:[{"id":"loading","text":"数据加载中...","iconCls":"icon-loading"}]});}
function dictLinearURL(dictCode,note1,note2,note3,note4,note5,detail){return(new dictUrl()).linearDict+getDictParam("Linear",dictCode,null,note1,note2,note3,note4,note5,null,detail);}
function getDictTreeForList(dictCode,itemCode,callback,depth,note1,note2,note3,note4,note5){var URL=(new dictUrl()).treeDict+getDictParam("Tree",dictCode,itemCode,note1,note2,note3,note4,note5);if(depth!=null){URL+="&intData="+depth;}
$.getJSON(URL,function(listData){callback(listData);});}
function initDictTreeCombo(dictCode,itemCode,comboId,depth,note1,note2,note3,note4,note5){showComboTreeLoading(comboId);getDictTreeForList(dictCode,itemCode,function(listData){$("#"+comboId).combobox({data:listData,valueField:"itemCode",textField:"itemName",editable:false});},depth,note1,note2,note3,note4,note5);}
function initDictLinearCombo(dictCode,comboId,note1,note2,note3,note4,note5){$("#"+comboId).combobox({url:dictLinearURL(dictCode,note1,note2,note3,note4,note5),valueField:"itemCode",textField:"itemName",editable:false});}
function getDictLinear(dictCode,callback,note1,note2,note3,note4,note5,detail){$.getJSON(dictLinearURL(dictCode,note1,note2,note3,note4,note5,detail),function(dict){callback(dict);});}
function ClassDictLinear(dictCode,comboId,note1,note2,note3,note4,note5,detail){this.dictCode=dictCode;this.comboId=comboId;this.note1=note1;this.note2=note2;this.note3=note3;this.note4=note4;this.note5=note5;this.detail=detail;}
function getDictLinears(dictsParam,callback){var param="";for(var i=0;i<dictsParam.length;i++){param+=getDictParam("Linear",dictsParam[i].dictCode,null,dictsParam[i].note1,dictsParam[i].note2,dictsParam[i].note3,dictsParam[i].note4,dictsParam[i].note5,i,dictsParam[i].detail);}
var URL=(new dictUrl()).linearDicts+param;$.getJSON(URL,function(dictsMap){callback(dictsMap);});}
function initDictLinearCombos(dictsParam,callback){getDictLinears(dictsParam,function(dictsMap){for(var i=0;i<dictsParam.length;i++){$("#"+dictsParam[i].comboId).combobox({data:dictsMap[dictsParam[i].dictCode],valueField:"itemCode",textField:"itemName",editable:false});}
if(callback!=null){callback(dictsMap);}});}
function getDictParam(type,dictCode,itemCode,note1,note2,note3,note4,note5,index,detail){var objName,param;if(type==null){type="Linear";}
if(index==null){objName="dict"+type+"Item";}else{objName="lstDict"+type+"Item["+index+"]";}
if(index==null||index==0){param="?";}else{param="&";}
if(dictCode!=null&&dictCode!=""){param+=objName+".dictCode="+dictCode;}
if(itemCode!=null&&itemCode!=""){param+=objName+".itemCode="+itemCode;}
if(note1!=null&&note1!=""){param+="&"+objName+".note1="+note1;}
if(note2!=null&&note2!=""){param+="&"+objName+".note2="+note2;}
if(note3!=null&&note3!=""){param+="&"+objName+".note3="+note3;}
if(note4!=null&&note4!=""){param+="&"+objName+".note4="+note4;}
if(note5!=null&&note5!=""){param+="&"+objName+".note5="+note5;}
if(detail!=null&&detail==true){param+="&strData=detail";}
return param;}
function editDictLinear(dictCode,comboId,note1,note2,note3,note4,note5){if($("#dlgDictLinear"+dictCode).size()>0){openDialog("dlgDictLinear"+dictCode);}else{var URL=(new dictUrl()).linearJsEditor+getDictParam("Linear",dictCode,null,note1,note2,note3,note4,note5);$.getScript(URL,function(){initLinear(comboId);});}}
function initComboTree(dictCode,itemCode,treeId,depth,note1,note2,note3,note4,note5){showComboTreeLoading(treeId);getDictTreeForTree(dictCode,itemCode,function(treeData){$("#"+treeId).combotree({data:treeData});},depth,note1,note2,note3,note4,note5);}
function getDictTreeForTree(dictCode,itemCode,callback,depth,note1,note2,note3,note4,note5){var URL=(new dictUrl()).treeTree+getDictParam("Tree",dictCode,itemCode,note1,note2,note3,note4,note5);if(depth!=null){URL+="&intData="+depth;}
$.getJSON(URL,function(treeData){callback(treeData);});}
function getDictTreeChildForTree(itemCode,callback,note1,note2,note3,note4,note5){getDictTreeForTree(null,itemCode,callback,1,note1,note2,note3,note4,note5);}
function initUnitComboTree(unitCode,treeId,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){showComboTreeLoading(treeId);getUnitForTree(unitCode,function(treeData){$("#"+treeId).combotree({data:treeData});},depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
function getUnitForTree(unitCode,callback,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var URL=unitForTreeURL(unitCode,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);$.getJSON(URL,function(treeData){callback(treeData);});}
function unitForTreeURL(unitCode,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){return getUnitParam("tree",unitCode,null,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
function initUnitComboTreeWithRoot(unitCode,treeId,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){showComboTreeLoading(treeId);getUnitForTreeWithRoot(unitCode,function(treeData){$("#"+treeId).combotree({data:treeData});},depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
function getUnitForTreeWithRoot(unitCode,callback,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var URL=getUnitParam("twr",unitCode,null,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);$.getJSON(URL,function(treeData){callback(treeData);});}
function initSystemUnitComboTree(treeId,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){showComboTreeLoading(treeId);getSystemUnitForTree(function(treeData){$("#"+treeId).combotree({data:treeData});},depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
function getSystemUnitForTree(callback,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var URL=getUnitParam("sys",null,null,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);$.getJSON(URL,function(treeData){callback(treeData);});}
function initCategoricalUnitComboTree(treeId,depth,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){showComboTreeLoading(treeId);getCategoricalUnitForTree(function(treeData){$("#"+treeId).combotree({data:treeData});},depth,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
function getCategoricalUnitForTree(callback,depth,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var URL=getUnitParam("cat",null,null,depth,null,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);$.getJSON(URL,function(treeData){callback(treeData);});}
function initUnitCombo(comboId,unitCode,includeItself,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){$("#"+comboId).combobox({url:unitForComboURL(unitCode,includeItself,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType),editable:false});}
function unitForComboURL(unitCode,includeItself,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var upperUnitCode=null;if(!includeItself){upperUnitCode=unitCode;unitCode=null;}
return getUnitParam("combo",unitCode,upperUnitCode,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
function unitForGridURL(unitCode,includeItself,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var upperUnitCode=null;if(!includeItself){upperUnitCode=unitCode;unitCode=null;}
return getUnitParam("grid",unitCode,upperUnitCode,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType);}
var UNIT_FLAG={SYSTEM_UNIT:0,OTHER_UNIT:1,ALL_UNIT:2,GROUP_NODE:0,UNIT_NODE:1,ALL_NODE:2};function unitForAutoCompleteURL(systemFlag,nodeType){if(systemFlag==null||systemFlag<0||systemFlag>2){systemFlag=0;}
if(nodeType==null||nodeType<0||nodeType>2){nodeType=1;}
flag=systemFlag*10+nodeType;return unitDataUrl("auto")+"&intData="+flag;}
function initAutoComplete(url,inputId,resultId,max,callback){if(max==null||isNaN(max)){max=10;}
$("#"+inputId).autocomplete(url,{dataType:'json',max:max,parse:function(data){return $.map(data,function(row){return{data:row,value:row.id,result:row.text};});},formatItem:function(item){return item.text;}}).result(function(e,item){if(item){$("#"+resultId).val(item.id);}else{$("#"+resultId).val("");}
if(callback){callback(item);}});$("#"+inputId).change(function(){$("#"+inputId).search();});}
function getUnitParam(type,unitCode,upperUnitCode,depth,categoryCode,propertyCode,isLegalEntity,symbol,districtLevelCode,districtCode,nodeType){var URL=unitDataUrl(type);if(unitCode!=null){URL+="&unit.unitCode="+unitCode;}
if(upperUnitCode!=null){URL+="&unit.upperUnitCode="+upperUnitCode;}
if(depth!=null){URL+="&intData="+depth;}
if(categoryCode!=null){URL+="&unit.categoryCode="+categoryCode;}
if(propertyCode!=null){URL+="&unit.propertyCode="+propertyCode;}
if(isLegalEntity!=null){URL+="&unit.isLegalEntity="+isLegalEntity;}
if(symbol!=null){URL+="&unit.symbol="+symbol;}
if(districtLevelCode!=null){URL+="&unit.districtLevelCode="+districtLevelCode;}
if(districtCode!=null){URL+="&unit.districtCode="+districtCode;}
if(nodeType!=null){URL+="&unit.isLeaf="+nodeType;}
return URL;}
function enableValidateRePwd(){$.extend($.fn.validatebox.defaults.rules,{repwd:{validator:function(value,param){return value==$('#'+param[0]).val();},message:'两次输入的密码不一致'}});}
function enableValidateIdCard(){$.extend($.fn.validatebox.defaults.rules,{idcard:{validator:function(value){return isIdCardNo(value);},message:'请输入正确的身份证号'}});}
function isIdCardNo(num){var factorArr=new Array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1);var varArray=new Array();var lngProduct=0;var intCheckDigit;var intStrLen=num.length;var idNumber=num;if((intStrLen!=15)&&(intStrLen!=18)){return false;}
for(var i=0;i<intStrLen;i++){varArray[i]=idNumber.charAt(i);if((varArray[i]<'0'||varArray[i]>'9')&&(i!=17)){return false;}else if(i<17){varArray[i]=varArray[i]*factorArr[i];}}
if(intStrLen==18){var date8=idNumber.substring(6,14);if(isDate8(date8)==false){return false;}
for(i=0;i<17;i++){lngProduct=lngProduct+varArray[i];}
intCheckDigit=12-lngProduct%11;switch(intCheckDigit){case 10:intCheckDigit='X';break;case 11:intCheckDigit=0;break;case 12:intCheckDigit=1;break;}
if(varArray[17].toUpperCase()!=intCheckDigit){return false;}}
else{var date6=idNumber.substring(6,12);if(isDate6(date6)==false){return false;}}
return true;}
function isDate6(sDate){if(!/^[0-9]{6}$/.test(sDate)){return false;}
var year,month,day;year="19"+sDate.substring(0,2);month=sDate.substring(2,4);day=sDate.substring(4,6);var iaMonthDays=[31,28,31,30,31,30,31,31,30,31,30,31];if(((year%4==0)&&(year%100!=0))||(year%400==0))iaMonthDays[1]=29;if(month<1||month>12)return false;if(day<1||day>iaMonthDays[month-1])return false;return true;}
function isDate8(sDate){if(!/^[0-9]{8}$/.test(sDate)){return false;}
var year,month,day;year=sDate.substring(0,4);month=sDate.substring(4,6);day=sDate.substring(6,8);var iaMonthDays=[31,28,31,30,31,30,31,31,30,31,30,31];if(year<1900||year>2100)return false;if(((year%4==0)&&(year%100!=0))||(year%400==0))iaMonthDays[1]=29;if(month<1||month>12)return false;if(day<1||day>iaMonthDays[month-1])return false;return true;}
Date.prototype.pattern=function(fmt){var o={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours()%12==0?12:this.getHours()%12,"H+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),"S":this.getMilliseconds()};var week={"0":"\u65e5","1":"\u4e00","2":"\u4e8c","3":"\u4e09","4":"\u56db","5":"\u4e94","6":"\u516d"};if(/(y+)/.test(fmt)){fmt=fmt.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length));}
if(/(E+)/.test(fmt)){fmt=fmt.replace(RegExp.$1,((RegExp.$1.length>1)?(RegExp.$1.length>2?"\u661f\u671f":"\u5468"):"")+week[this.getDay()+""]);}
for(var k in o){if(new RegExp("("+k+")").test(fmt)){fmt=fmt.replace(RegExp.$1,(RegExp.$1.length==1)?(o[k]):(("00"+o[k]).substr((""+o[k]).length)));}}
return fmt;};function initRadioGroup(radioGroup,hiddenID,checkedID){if(checkedID==null){$("#"+hiddenID).data("checkedID","");}else{checkOne(checkedID,radioGroup[checkedID]);}
$.each(radioGroup,function(id,value){$("#"+id).click(function(){var oldedID=$("#"+hiddenID).data("checkedID");if(oldedID!=id){if(oldedID!=""){$("#"+oldedID).removeClass("radioSpan-checked");}
checkOne(id,value);}});});function checkOne(checkedID,checkedValue){$("#"+checkedID).addClass("radioSpan-checked");$("#"+hiddenID).data("checkedID",checkedID);$("#"+hiddenID).val(checkedValue);}}
function unselectedRadioGroup(hiddenID){var oldedID=$("#"+hiddenID).data("checkedID");if(oldedID!=null){$("#"+oldedID).removeClass("radioSpan-checked");$("#"+hiddenID).data("checkedID","");$("#"+hiddenID).val(null);}}
function getYMD(fullDate){if(fullDate==null||fullDate.length<10){return null;}else{return fullDate.substr(0,10);}}
function formatJavaDate(fullDate){if(fullDate==null){return null;}else{return fullDate.replace("T"," ");}}
function getExpertQueryCondition(){var workProfCode=$("#ctWorkProf").combotree("getValue");var unitName=$("#acUnitName").val();var unitCode=$("#acUnitCode").val();var withSubUnit=$("#ckWithSubUnit").get(0).checked?1:0;var professionCode=$("#ccProfession").combobox("getValue");var personName=$("#txtPersonName").val();var param=new function(){};if(unitName!=""){if(unitCode!=""){param.unitCode=unitCode;}else{param.unitName=unitName;}
param.withSubUnit=withSubUnit;}
if(workProfCode!=""){param.workProfCode=workProfCode;}
if(professionCode!=""){param.professionCode=professionCode;}
if(personName!=""){param.personName=personName;}
return param;}
