<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class PatientModel extends CI_Model{



	public function getEmployeeInfoProcessing() {

		$this->db->select("SHA1(employee_id) as employee_id, CONCAT(firstname,' ',lastname,' - ',email) as full_name");

		$query = $this->db->get('hcs_employee');

		echo json_encode($query->result_array());
	}   

	public function getPatientsAllTestData($id){
		$result=$this->getIDProcessing($id);
		$employee_id=$result->employee_id;
		$this->db->select("SHA1(test_id) as test_id,`test_type`, `test_date`, `created_at`, `result`, `specimen`, `confirmed_case`, `retest`, `retest_date`, `self_isolation_recomanded`, `rt_pcr`, SHA1(client_id) as client_id");
		$this->db->where('employee_id',$employee_id);
		$query = $this->db->get('hcs_test');

		echo json_encode($query->result_array());
	} 

	public function getIDProcessing($id) {
        $this->db->select("employee_id");
        $this->db->where('sha1(employee_id)',$id);
        $query = $this->db->get('hcs_employee');
        return $query->row();
    }


}