File "HistorialCasos.php"

Full Path: C:/wamp64/www/casos_medicos1/model/HistorialCasos.php
File size: 683 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
require_once __DIR__ . "/conexion.php";

class HistorialCasos {

    private $conn;

    public function __construct() {
        $this->conn = (new Conexion())->getConexion();
    }

    public function obtenerPorCedula($cedula) {

        $sql = "SELECT hi.*, d.codigo 
                FROM historial_incapacidades hi
                LEFT JOIN diagnostico d ON hi.id_diagnostico = d.id
                WHERE hi.cedula = ?
                ORDER BY hi.fecha_inicio DESC";

        $stmt = $this->conn->prepare($sql);
        $stmt->bind_param("s", $cedula);
        $stmt->execute();
        return $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
    }
}