www.gusucode.com > 2029网博士成品网站管理系统 PHP网站源码程序 > 2028/hospital/module/HospitalExpertTable.php

    <?php

function HospitalExpertTable(){

	global $msql,$fsql,$tsql,$strAm,$strPassType1,$strPm;
	global $strWeek1,$strWeek2,$strWeek3,$strWeek4,$strWeek5,$strWeek6,$strWeek7;
				
	$coltitle=$GLOBALS["PLUSVARS"]["coltitle"];
	$tempname=$GLOBALS["PLUSVARS"]["tempname"];
		
	$memberid=$_COOKIE["MEMBERID"];
	$nowtime=time();
				
		
	//模板解释
	$Temp=LoadTemp($tempname);
	$TempArr=SplitTblTemp($Temp);
		
	$var=array(
		'coltitle' => $coltitle
	);
			
	$str=ShowTplTemp($TempArr["start"],$var);
	
	$msql -> query ("select * from {P}_hospital_cat where pid='0' and ifshow='1' order by xuhao");
	while($msql -> next_record()) {
		$catid = $msql -> f ('catid');
		$pid = $msql -> f ('pid');
		$cat = $msql -> f ('cat');
		
		//获取科室下的专业数
		$fsql->query("select count('catid') from {P}_hospital_cat where pid='$catid'");
		if($fsql->next_record()){
			$enums=$fsql->f("count('catid')");
		}
		
		//科室下有无专业的条件判断
		if($enums=='' || $enums=='0'){
			$enums2=2;
			$scl=" catid='$catid' and pid='0' and ifshow='1' ";
		}else{
			$enums2=2*$enums;
			$scl=" pid='$catid' and ifshow='1' ";
		}
		
		$k=1;
		$fsql->query("select * from {P}_hospital_cat where $scl order by xuhao");
		while($fsql->next_record()){
			$scatid=$fsql->f('catid');
			$spid=$fsql->f('pid');
			$scat=$fsql->f('cat');
						
			//读取专家设置
			//名称初始化
			$name10info=$name11info=$name20info=$name21info=$name30info=$name31info=$name40info=$name41info=$name50info=$name51info=$name60info=$name61info=$name70info=$name71info='';

			//星期一
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and mondayam='1'");
			while($tsql->next_record()){
				$eid10=$tsql->f('eid');
				$name10=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid10.".html")){
					$name10info.="<a href='".ROOTPATH."hospital/html/".$eid10.".html'>".$name10."</a><br />";
				}else{
					$name10info.="<a href='".ROOTPATH."hospital/html/?".$eid10.".html'>".$name10."</a><br />";
				}
			}
			if($name10info==''){
				$name10info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and mondaypm='1'");
			while($tsql->next_record()){
				$eid11=$tsql->f('eid');
				$name11=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid11.".html")){
					$name11info.="<a href='".ROOTPATH."hospital/html/".$eid11.".html'>".$name11."</a><br />";
				}else{
					$name11info.="<a href='".ROOTPATH."hospital/html/?".$eid11.".html'>".$name11."</a><br />";
				}
			}
			if($name11info==''){
				$name11info="&nbsp;";
			}
			
			//星期二
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and tuesdayam='1'");
			while($tsql->next_record()){
				$eid20=$tsql->f('eid');
				$name20=$tsql->f('name');
			
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid20.".html")){
					$name20info.="<a href='".ROOTPATH."hospital/html/".$eid20.".html'>".$name20."</a><br />";
				}else{
					$name20info.="<a href='".ROOTPATH."hospital/html/?".$eid20.".html'>".$name20."</a><br />";
				}
			}
			if($name20info==''){
				$name20info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and tuesdaypm='1'");
			while($tsql->next_record()){
				$eid21=$tsql->f('eid');
				$name21=$tsql->f('name');
					
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid21.".html")){
					$name21info.="<a href='".ROOTPATH."hospital/html/".$eid21.".html'>".$name21."</a><br />";
				}else{
					$name21info.="<a href='".ROOTPATH."hospital/html/?".$eid21.".html'>".$name21."</a><br />";
				}
			}
			if($name21info==''){
				$name21info="&nbsp;";
			}
			
			//星期三
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and wednesdayam='1'");
			while($tsql->next_record()){
				$eid30=$tsql->f('eid');
				$name30=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid30.".html")){
					$name30info.="<a href='".ROOTPATH."hospital/html/".$eid30.".html'>".$name30."</a><br />";
				}else{
					$name30info.="<a href='".ROOTPATH."hospital/html/?".$eid30.".html'>".$name30."</a><br />";
				}
			}
			if($name30info==''){
				$name30info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and wednesdaypm='1'");
			while($tsql->next_record()){
				$eid31=$tsql->f('eid');
				$name31=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid31.".html")){
					$name31info.="<a href='".ROOTPATH."hospital/html/".$eid31.".html'>".$name31."</a><br />";
				}else{
					$name31info.="<a href='".ROOTPATH."hospital/html/?".$eid31.".html'>".$name31."</a><br />";
				}
			}
			if($name31info==''){
				$name31info="&nbsp;";
			}
			
			//星期四
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and thursdayam='1'");
			while($tsql->next_record()){
				$eid40=$tsql->f('eid');
				$name40=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid40.".html")){
					$name40info.="<a href='".ROOTPATH."hospital/html/".$eid40.".html'>".$name40."</a><br />";
				}else{
					$name40info.="<a href='".ROOTPATH."hospital/html/?".$eid40.".html'>".$name40."</a><br />";
				}
			}
			if($name40info==''){
				$name40info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and thursdaypm='1'");
			while($tsql->next_record()){
				$eid41=$tsql->f('eid');
				$name41=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid41.".html")){
					$name41info.="<a href='".ROOTPATH."hospital/html/".$eid41.".html'>".$name41."</a><br />";
				}else{
					$name41info.="<a href='".ROOTPATH."hospital/html/?".$eid41.".html'>".$name41."</a><br />";
				}
			}
			if($name41info==''){
				$name41info="&nbsp;";
			}
			
			//星期五
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and fridayam='1'");
			while($tsql->next_record()){
				$eid50=$tsql->f('eid');
				$name50=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid50.".html")){
					$name50info.="<a href='".ROOTPATH."hospital/html/".$eid50.".html'>".$name50."</a><br />";
				}else{
					$name50info.="<a href='".ROOTPATH."hospital/html/?".$eid50.".html'>".$name50."</a><br />";
				}
			}
			if($name50info==''){
				$name50info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and fridaypm='1'");
			while($tsql->next_record()){
				$eid51=$tsql->f('eid');
				$name51=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid51.".html")){
					$name51info.="<a href='".ROOTPATH."hospital/html/".$eid51.".html'>".$name51."</a><br />";
				}else{
					$name51info.="<a href='".ROOTPATH."hospital/html/?".$eid51.".html'>".$name51."</a><br />";
				}
			}
			if($name51info==''){
				$name51info="&nbsp;";
			}
			
			//星期六
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and saturdayam='1'");
			while($tsql->next_record()){
				$eid60=$tsql->f('eid');
				$name60=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid60.".html")){
					$name60info.="<a href='".ROOTPATH."hospital/html/".$eid60.".html'>".$name60."</a><br />";
				}else{
					$name60info.="<a href='".ROOTPATH."hospital/html/?".$eid60.".html'>".$name60."</a><br />";
				}
			}
			if($name60info==''){
				$name60info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and saturdaypm='1'");
			while($tsql->next_record()){
				$eid61=$tsql->f('eid');
				$name61=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid61.".html")){
					$name61info.="<a href='".ROOTPATH."hospital/html/".$eid61.".html'>".$name61."</a><br />";
				}else{
					$name61info.="<a href='".ROOTPATH."hospital/html/?".$eid61.".html'>".$name61."</a><br />";
				}
			}
			if($name61info==''){
				$name61info="&nbsp;";
			}
			
			//星期日
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and sundayam='1'");
			while($tsql->next_record()){
				$eid70=$tsql->f('eid');
				$name70=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid70.".html")){
					$name70info.="<a href='".ROOTPATH."hospital/html/".$eid70.".html'>".$name70."</a><br />";
				}else{
					$name70info.="<a href='".ROOTPATH."hospital/html/?".$eid70.".html'>".$name70."</a><br />";
				}
			}
			if($name70info==''){
				$name70info="&nbsp;";
			}
			$tsql->query("select * from {P}_hospital_expertset where catid='$scatid' and sundaypm='1'");
			while($tsql->next_record()){
				$eid71=$tsql->f('eid');
				$name71=$tsql->f('name');
				
				if($GLOBALS["CONF"]["CatchOpen"]=="1" && file_exists(ROOTPATH."hospital/html/".$eid71.".html")){
					$name71info.="<a href='".ROOTPATH."hospital/html/".$eid71.".html'>".$name71."</a><br />";
				}else{
					$name71info.="<a href='".ROOTPATH."hospital/html/?".$eid71.".html'>".$name71."</a><br />";
				}
			}
			if($name71info==''){
				$name71info="&nbsp;";
			}
			
			
			if($k==1){
			
				$var=array(
					'tenums2' => $enums2,
					'tcat' => $cat,
					'tscat' => $scat,
					'tscatidam1' => $scatid.'_1_am',
					'tscatidam2' => $scatid.'_2_am',
					'tscatidam3' => $scatid.'_3_am',
					'tscatidam4' => $scatid.'_4_am',
					'tscatidam5' => $scatid.'_5_am',
					'tscatidam6' => $scatid.'_6_am',
					'tscatidam7' => $scatid.'_7_am',
					'tscatidpm1' => $scatid.'_1_pm',
					'tscatidpm2' => $scatid.'_2_pm',
					'tscatidpm3' => $scatid.'_3_pm',
					'tscatidpm4' => $scatid.'_4_pm',
					'tscatidpm5' => $scatid.'_5_pm',
					'tscatidpm6' => $scatid.'_6_pm',
					'tscatidpm7' => $scatid.'_7_pm',
					'tname10' => $name10info,
					'tname20' => $name20info,
					'tname30' => $name30info,
					'tname40' => $name40info,
					'tname50' => $name50info,
					'tname60' => $name60info,
					'tname70' => $name70info,
					'tname11' => $name11info,
					'tname21' => $name21info,
					'tname31' => $name31info,
					'tname41' => $name41info,
					'tname51' => $name51info,
					'tname61' => $name61info,
					'tname71' => $name71info
				);
			
				$str.=ShowTplTemp($TempArr["menu"],$var);
				
			}else{
			
				$var=array(
					'scat' => $scat,
					'scatidam1' => $scatid.'_1_am',
					'scatidam2' => $scatid.'_2_am',
					'scatidam3' => $scatid.'_3_am',
					'scatidam4' => $scatid.'_4_am',
					'scatidam5' => $scatid.'_5_am',
					'scatidam6' => $scatid.'_6_am',
					'scatidam7' => $scatid.'_7_am',
					'scatidpm1' => $scatid.'_1_pm',
					'scatidpm2' => $scatid.'_2_pm',
					'scatidpm3' => $scatid.'_3_pm',
					'scatidpm4' => $scatid.'_4_pm',
					'scatidpm5' => $scatid.'_5_pm',
					'scatidpm6' => $scatid.'_6_pm',
					'scatidpm7' => $scatid.'_7_pm',
					'name10' => $name10info,
					'name20' => $name20info,
					'name30' => $name30info,
					'name40' => $name40info,
					'name50' => $name50info,
					'name60' => $name60info,
					'name70' => $name70info,
					'name11' => $name11info,
					'name21' => $name21info,
					'name31' => $name31info,
					'name41' => $name41info,
					'name51' => $name51info,
					'name61' => $name61info,
					'name71' => $name71info
				);
			
				$str.=ShowTplTemp($TempArr["list"],$var);
				
			}
		$k++;
		}
	}
	
	$str.=$TempArr["end"];
		
	return $str;

}


?>