|
|
<?php
|
|
|
class urinalysisController extends ControllerBase{
|
|
|
|
|
|
public function dolist(){}
|
|
|
|
|
|
public function add(){
|
|
|
$name_form = $_REQUEST["name_form"];
|
|
|
$method = "";
|
|
|
$title = "";
|
|
|
switch ($name_form){
|
|
|
case "frm_09":
|
|
|
$number = 9;
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
$test = new testsModel();
|
|
|
$result_test = $test->getTestbyNumForm($number);
|
|
|
$data_result = $result_test->fetch();
|
|
|
$idtest = $data_result['idtest'];
|
|
|
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
$result = $application_test->getApplicationTestChecked($idtest, $idapplication);
|
|
|
|
|
|
if(($result->rowCount()) == 1){
|
|
|
$url = "index.php?option=com_data&controller=urinalysis&action=view&name_form=frm_09";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'detailTestModel.php';
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'categoryModel.php';
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'dataMedicalModel.php';
|
|
|
|
|
|
$detail_test = new detailTestModel();
|
|
|
$category = new categoryModel();
|
|
|
$data_medical = new dataMedicalModel();
|
|
|
|
|
|
list($result_detail, $num_rows_detail) = $detail_test->dolistbyTest($data_result['idtest']);
|
|
|
$data_detail = $result_detail->fetchAll();
|
|
|
//var_dump($result_detail); die();
|
|
|
$i = 0;
|
|
|
foreach($data_detail as $detail){
|
|
|
list($result_dm, $num_rows_dm) = $data_medical->dolistbyCategory($detail['idcategory']);
|
|
|
$data_fields[$i] = $result_dm->fetchAll();
|
|
|
$i++;
|
|
|
}
|
|
|
$data['idtest'] = $idtest;
|
|
|
$data['data_fields'] = $data_fields;
|
|
|
$data['flag_edit'] = TRUE;
|
|
|
$method = "add";
|
|
|
$title = "Screening Urinalysis and Toxicology (within 21 Days prior to Dose 1)";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data['content'] = "components".DS.COMPONENT.DS."views".DS.$name_form.".php";
|
|
|
$data['method'] = $method;
|
|
|
$data['title'] = $title;
|
|
|
|
|
|
$this->view->show("template.php", $data);
|
|
|
}
|
|
|
|
|
|
public function save(){
|
|
|
$num_form = $_POST['num_form'];
|
|
|
switch ($num_form){
|
|
|
case 9:
|
|
|
$data_table = $_POST['datos'];
|
|
|
$lst_ids = $_POST['var_ids'];
|
|
|
|
|
|
$data_application['date'] = $this->formatDateCRF($data_table['txt_date']);
|
|
|
$data_application['idtest'] = $data_table['idtest'];
|
|
|
$data_application['idapplication'] = $_SESSION['usersession']['idapplication'];
|
|
|
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
list($result, $idappl_test, $message) = $application_test->addItem($data_application);
|
|
|
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'chemistryModel.php';
|
|
|
$chemistry = new chemistryModel();
|
|
|
|
|
|
for($i = 0; $i<count($lst_ids); $i++){
|
|
|
$data_chemistry['idappl_test'] = $idappl_test;
|
|
|
$data_chemistry['iddm'] = $lst_ids[$i];
|
|
|
$data_chemistry['results'] = $data_table["txt_value_$lst_ids[$i]"];
|
|
|
$data_chemistry['clinically_significant'] = $data_table["sign_$lst_ids[$i]"];
|
|
|
$data_chemistry['repeated'] = $data_table["repeat_$lst_ids[$i]"];
|
|
|
$data_chemistry['description'] = $data_table["comment_$lst_ids[$i]"];
|
|
|
|
|
|
list($result, $id, $message) = $chemistry->addItem($data_chemistry);
|
|
|
}
|
|
|
|
|
|
$url = "index.php?option=com_data&controller=chemistry&action=view&name_form=frm_08";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
public function view(){
|
|
|
$name_form = $_REQUEST["name_form"];
|
|
|
$method = "";
|
|
|
$title = "";
|
|
|
switch ($name_form){
|
|
|
case "frm_08":
|
|
|
$number = 8;
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
$test = new testsModel();
|
|
|
$result_test = $test->getTestbyNumForm($number);
|
|
|
$data_result = $result_test->fetch();
|
|
|
$idtest = $data_result['idtest'];
|
|
|
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
$appl_test = new applicationTestModel();
|
|
|
$result = $appl_test->getApplicationTestChecked($idtest, $idapplication);
|
|
|
$data_appl_test = $result->fetch();
|
|
|
|
|
|
if(($result->rowCount()) == 0){
|
|
|
$url = "index.php?option=com_data&controller=urinalysis&action=add&name_form=frm_09";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'chemistryModel.php';
|
|
|
$chemistry = new chemistryModel();
|
|
|
|
|
|
list($result_chemistry, $num_rows) = $chemistry->getChemistry($data_appl_test['idappl_test']);
|
|
|
$data_chemistry = $result_chemistry->fetchAll();
|
|
|
|
|
|
$method = "view";
|
|
|
$data['flag_edit'] = FALSE;
|
|
|
$data['lst_chemistry'] = $data_chemistry;
|
|
|
$data['date_test'] = $this->viewDateCRF($data_appl_test['date']);
|
|
|
}
|
|
|
$title = "Screening Urinalysis and Toxicology (within 21 Days prior to Dose 1)";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data['content'] = "components".DS.COMPONENT.DS."views".DS.$name_form.".php";
|
|
|
$data['method'] = $method;
|
|
|
$data['title'] = $title;
|
|
|
|
|
|
$this->view->show("template.php", $data);
|
|
|
}
|
|
|
/**
|
|
|
*NEOVOX NEOENXTO 20110126
|
|
|
*Funcion que llama al formulario de edicion de datos (view).
|
|
|
**/
|
|
|
public function edit(){}
|
|
|
/**
|
|
|
*NEOVOX NEOENXTO 20110126
|
|
|
*Funcion que recibe los datos que se ingresaron en el formulario de edicion y los almacena.
|
|
|
**/
|
|
|
public function upgrade(){}
|
|
|
/**
|
|
|
*NEOVOX NEOENXTO 20110126
|
|
|
*Funcion que permite eliminar indivualmente los datos de un listado.
|
|
|
**/
|
|
|
public function remove(){}
|
|
|
/**
|
|
|
*NEOVOX NEOENXTO 20110126
|
|
|
*Funcion que permite eliminar una lista de datos seleccionados.
|
|
|
**/
|
|
|
public function removelist(){}
|
|
|
|
|
|
|
|
|
public function home(){
|
|
|
$idsubject = $_REQUEST['idsubject'];
|
|
|
|
|
|
$_SESSION['usersession']['idsubject'] = $idsubject;
|
|
|
unset($_SESSION['usersession']['idapplication']);
|
|
|
$data = array();
|
|
|
$data['content'] = "components".DS.COMPONENT.DS."views".DS."home.php";
|
|
|
$data['title'] = "RFC";
|
|
|
|
|
|
$this->view->show("template.php", $data);
|
|
|
}
|
|
|
|
|
|
public function formatDateCRF($date_tmp){
|
|
|
|
|
|
$array_date = explode ("/", $date_tmp);
|
|
|
$mes = $array_date[1];
|
|
|
|
|
|
if ($mes == "Jan") $mes2 = "01";
|
|
|
if ($mes == "Feb") $mes2 = "02";
|
|
|
if ($mes == "Mar") $mes2 = "03";
|
|
|
if ($mes == "Apr") $mes2 = "04";
|
|
|
if ($mes == "May") $mes2 = "05";
|
|
|
if ($mes == "Jun") $mes2 = "06";
|
|
|
if ($mes == "Jul") $mes2 = "07";
|
|
|
if ($mes == "Aug") $mes2 = "08";
|
|
|
if ($mes == "Set") $mes2 = "09";
|
|
|
if ($mes == "Oct") $mes2 = "10";
|
|
|
if ($mes == "Nov") $mes2 = "11";
|
|
|
if ($mes == "Dec") $mes2 = "12";
|
|
|
|
|
|
$a = explode ("/", $date_tmp);
|
|
|
$date_tmp = $a[2]."-".$mes2."-".$a[0];
|
|
|
|
|
|
return $date_tmp;
|
|
|
}
|
|
|
|
|
|
public function viewDateCRF($date_tmp){
|
|
|
$array_date = explode ("-", $date_tmp);
|
|
|
$mes = $array_date[1];
|
|
|
|
|
|
if ($mes == "01") $mes2 = "Jan";
|
|
|
if ($mes == "02") $mes2 = "Feb";
|
|
|
if ($mes == "03") $mes2 = "Mar";
|
|
|
if ($mes == "04") $mes2 = "Apr";
|
|
|
if ($mes == "05") $mes2 = "May";
|
|
|
if ($mes == "06") $mes2 = "Jun";
|
|
|
if ($mes == "07") $mes2 = "Jul";
|
|
|
if ($mes == "08") $mes2 = "Aug";
|
|
|
if ($mes == "09") $mes2 = "Set";
|
|
|
if ($mes == "10") $mes2 = "Oct";
|
|
|
if ($mes == "11") $mes2 = "Nov";
|
|
|
if ($mes == "12") $mes2 = "Dec";
|
|
|
|
|
|
$a = explode ("-", $date_tmp);
|
|
|
$date_tmp = $a[2]."/".$mes2."/".$a[0];
|
|
|
|
|
|
return $date_tmp;
|
|
|
}
|
|
|
}
|
|
|
?>
|
|
|
|