代码拉取完成,页面将自动刷新
<?php
session_start();
#导出处方单
if (!isset($_SESSION['username']) or !isset($_SESSION['identity']) or ($_SESSION['identity'] != 1 && $_SESSION['identity'] != 0)) {
header("Location:login.php");
exit();
}
$filename = "prescription.xls";
header("Content-Type: application/vnd.ms-execl");
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=$filename");
header("Pragma: no-cache");
header("Expires: 0");
$db = @mysqli_connect("localhost", "root", "123456", "MIS");
if (!$db) {
die("Fail to connect the database!!" . mysqli_connect_error());
}
mysqli_query($db, "begin");
mysqli_query($db, "set names utf8");
$info = mysqli_query($db, $_SESSION['sql']);
echo "排班号:"."\t";
echo "患者编号"."\t";
echo "患者姓名"."\t";
echo "医生科室"."\t";
echo "医生编号"."\t";
echo "医生姓名"."\t";
echo "诊断"."\t";
echo "药品号"."\t";
echo "药品名"."\t";
echo "药品数"."\n";
while ($row = mysqli_fetch_array($info)) {
echo $row['Sno']."\t";
echo $row['Pno']."\t";
echo $row['Pname']."\t";
echo $row['Department']."\t";
echo $row['Dno']."\t";
echo $row['Dname']."\t";
echo $row['Diagnosis']."\t";
echo $row['DrugNo']."\t";
echo $row['DrugName']."\t";
echo $row['DrugNum']."\t";
}
mysqli_query($db, "commit");
mysqli_close($db);
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。