-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseguimientos.php
123 lines (116 loc) · 3.45 KB
/
seguimientos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
set_time_limit(1000);
ini_set('memory_limit','128M');
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=CohorteSeguimiento.xls");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
$d1=array("PO","NN","NE","ND","NS");
$d2=array("POSITIVO","NO DISPONIBLE NO SOLICITADO","NEGATIVO","NO DISPONIBLE","NO DISPONIBLE SOLICITADO");
$NoContinua=array("SD","CA","SU");
$NoContinua2=array("SIN DATOS","CAMBIO","SUSPENDIO");
?>
<!DOCTYPE html>
<html>
<body>
<h3>Seguimiento</h3>
<table border="1" cellspacing="0" cellpadding="3" width="100%">
<tr>
<th>Código</th>
<th>Centro</th>
<th>Tipo</th>
<th>Numero</th>
<th>Fecha</th>
<th>Examen</th>
<th>Enfermedad</th>
<th>Tratamiento</th>
<th>CVHepatitis</th>
<th>Antigeno</th>
<th>FechaControl</th>
<th>Observacion</th>
</tr>
<?php
$username="root";
$password="r1r7C1h6ZG4ZVWF";
$database="cohorte";
//mysql_connect("cohorte.cvssq77sdkiq.sa-east-1.rds.amazonaws.com",$username,$password);
mysql_connect("cohorte.cbupq68leyb4.us-east-1.rds.amazonaws.com",$username,$password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
$query = "SELECT Paciente.Codigo as Codigo, Centro.Nombre as Centro, Seguimiento.*, Patologia.Nombre as Enfermedad ";
$query .= " FROM Paciente ";
$query .= " LEFT JOIN Centro ON Paciente.CentroID=Centro.ID ";
$query .= " LEFT JOIN Seguimiento ON Paciente.ID=Seguimiento.PacienteID ";
$query .= " LEFT JOIN Patologia ON Patologia.ID=Seguimiento.PatologiaID ";
if(isset($_GET["c"]) && is_numeric($_GET["c"])){
$query .= " WHERE Paciente.CentroID={$_GET["c"]}";
}
$query .= " ORDER BY Paciente.Codigo ";
//$query .= " LIMIT 500;";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result)>0){
while($row = mysql_fetch_array($result)){
echo "<tr>";
//Codigo
echo "<td>{$row["Codigo"]}</td>";
//Centro
echo "<td>{$row["Centro"]}</td>";
//Controles
if($row["Tipo"]=="EA"){
echo "<td>ENFERMEDADES ASOCIADAS</td>";
}elseif($row["Tipo"]=="SE"){
echo "<td>SEROLOGÍAS</td>";
}elseif($row["Tipo"]=="CM"){
echo "<td>CONTROL MÉDICO</td>";
}elseif($row["Tipo"]=="CO"){
echo "<td>CONTROL VHB</td>";
}else{
echo "<td></td>";
}
echo "<td>{$row["NumeroControl"]}</td>";
echo "<td>".str_replace("0000-00-00","",$row["Fecha"])."</td>";
echo "<td>";
switch($row["Examen"]){
case 'VH':
echo "VHC";
break;
case 'VD':
echo "VDRL";
break;
case 'CH':
echo "CHAGAS";
break;
case 'PA':
echo "PAP";
break;
case 'HB':
echo "HDSAG";
break;
}
echo "</td>";
echo "<td>{$row["Enfermedad"]}</td>";
if($row["Tratamiento"]=="S"){
echo "<td>SI</td>";
}elseif($row["Tratamiento"]=="N"){
echo "<td>NO</td>";
}else{
echo "<td></td>";
}
echo "<td>{$row["CVHepatitis"]}</td>";
if($row["Antigeno"]=="P"){
echo "<td>POSITIVO</td>";
}elseif($row["Antigeno"]=="N"){
echo "<td>NEGATIVO</td>";
}else{
echo "<td></td>";
}
echo "<td>".str_replace("0000-00-00","",$row["FechaControl"])."</td>";
echo "<td>{$row["Observacion"]}</td>";
echo "</tr>";
}
}
mysql_close();
?>
</table>
</body>
</html>