|
|
<?php
|
|
|
class DataController extends ControllerBase{
|
|
|
|
|
|
/**
|
|
|
*NEOVOX NEOENXTO 20110126
|
|
|
*Funcion que genera un listado de un controlador especifico.
|
|
|
**/
|
|
|
|
|
|
public function dolist(){}
|
|
|
|
|
|
public function add(){
|
|
|
$name_form = $_REQUEST["name_form"];
|
|
|
$method = "";
|
|
|
$title = "";
|
|
|
switch ($name_form){
|
|
|
case "frm_01":
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'CRFApplicationModel.php';
|
|
|
require 'components'.DS.'com_subjects'.DS.'models'.DS.'subjectModel.php';
|
|
|
$subject = new subjectModel();
|
|
|
$application = new CRFApplicationModel;
|
|
|
|
|
|
$idsubject = $_SESSION['usersession']['idsubject'];
|
|
|
$result_crf = $application->getCRF($idsubject);
|
|
|
|
|
|
$result = $subject->getSubject($idsubject);
|
|
|
$data_result = $result->fetch();
|
|
|
|
|
|
if(($result_crf->rowCount()) == 1){
|
|
|
$data_crf = $result_crf->fetch();
|
|
|
$_SESSION['usersession']['idapplication'] = $data_crf['idapplication'];
|
|
|
$method = "view";
|
|
|
|
|
|
($data_result["gender"] == 1) ? $gender = "Male" : $gender = "Female";
|
|
|
//echo "hola".$data_result["race"]; die();
|
|
|
switch($data_result["race"]){
|
|
|
case 1:
|
|
|
$race = "American Indian or Alaska Native";
|
|
|
break;
|
|
|
case 2:
|
|
|
$race = "Asian";
|
|
|
break;
|
|
|
case 3:
|
|
|
$race = "Black or African American";
|
|
|
break;
|
|
|
case 4:
|
|
|
$race = "Native Hawaiin or Other Pacific Islander";
|
|
|
break;
|
|
|
case 5:
|
|
|
$race = "White";
|
|
|
break;
|
|
|
case 6:
|
|
|
$race = "Unknown";
|
|
|
break;
|
|
|
default:
|
|
|
$race = "Unknown";
|
|
|
}
|
|
|
switch($data_result["ethnicity"]){
|
|
|
case 1:
|
|
|
$ethnicity = "Hispanic or Latin";
|
|
|
break;
|
|
|
case 2:
|
|
|
$ethnicity = "Not Hispanic or latino";
|
|
|
break;
|
|
|
case 3:
|
|
|
$ethnicity = "Unknown";
|
|
|
break;
|
|
|
default:
|
|
|
$ethnicity = "Unknown";
|
|
|
}
|
|
|
|
|
|
$data_result['date_birth'] = $this->viewDateCRF($data_result['date_birth']);
|
|
|
//echo ">>".$race; die();
|
|
|
//var_dump($data_result); die();
|
|
|
$data['data_result'] = $data_result;
|
|
|
$data['race'] = $race;
|
|
|
$data['gender'] = $gender;
|
|
|
$data['ethnicity'] = $ethnicity;
|
|
|
|
|
|
$crf_appl = new CRFApplicationModel();
|
|
|
$result_crf = $crf_appl->getCRF($idsubject);
|
|
|
$data_crf = $result_crf->fetch();
|
|
|
$data_crf['screening_date'] = $this->viewDateCRF($data_crf['screening_date']);
|
|
|
$data_crf['date_consent'] = $this->viewDateCRF($data_crf['date_consent']);
|
|
|
|
|
|
$data['data_crf'] = $data_crf;
|
|
|
|
|
|
} else {
|
|
|
$method = "add";
|
|
|
list($result, $num_rows) = $subject->dolistWithoutCRF();
|
|
|
$data_list = $result->fetchAll();
|
|
|
$data['data_list'] = $data_list;
|
|
|
$data['data_result'] = $data_result;
|
|
|
}
|
|
|
$title = "Demografics";
|
|
|
break;
|
|
|
case "frm_02":
|
|
|
if(isset ($_SESSION['usersession']['idsubject']) || !empty($_SESSION['usersession']['idsubject'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
$category = 8;
|
|
|
$type = 1;
|
|
|
list($result_criteria, $num_rows_criteria) = $criteria->dolist($type, $category, $idapplication);
|
|
|
if($num_rows_criteria == 10){
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=frm_02";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'dataGeneralModel.php';
|
|
|
$data_general = new dataGeneralModel();
|
|
|
|
|
|
list($result, $num_rows) = $data_general->dolist($category);
|
|
|
$data_list = $result->fetchAll();
|
|
|
$data['data_list'] = $data_list;
|
|
|
$method = "add";
|
|
|
}
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
case "frm_03":
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
$category = 9;
|
|
|
$type = 2;
|
|
|
list($result_criteria, $num_rows_criteria) = $criteria->dolist($type, $category, $idapplication);
|
|
|
if($num_rows_criteria == 14){
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=frm_03";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'dataGeneralModel.php';
|
|
|
$criteria = new dataGeneralModel();
|
|
|
$category = 9;
|
|
|
list($result, $num_rows) = $criteria->dolist($category);
|
|
|
$data_list = $result->fetchAll();
|
|
|
$data['data_list'] = $data_list;
|
|
|
$method = "add";
|
|
|
}
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
break;
|
|
|
case "frm_04":
|
|
|
//************************************************
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'MedicalHistoryModel.php';
|
|
|
$MedicalHistory = new MedicalHistoryModel();
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
$list_history = $MedicalHistory->list_history($idapplication);
|
|
|
//************************************************
|
|
|
$method = "add";
|
|
|
$title = "Screening Medical History";
|
|
|
$data['list_history'] = $list_history;
|
|
|
$data['oculto'] = 1;
|
|
|
break;
|
|
|
case "frm_05":
|
|
|
//****************Traemos la data para mostrar********************************
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'dataMedicalModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'vitalSignsModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'physicalExamModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
$data_medical = new dataMedicalModel();
|
|
|
$obj_vitalSigns = new vitalSignsModel();
|
|
|
$obj_physicalExam = new physicalExamModel();
|
|
|
$obj_test = new testsModel();
|
|
|
$arr_form = explode("frm_","frm_05");
|
|
|
$num_form = (int) $arr_form[1];
|
|
|
$listbool_existe = $application_test->Getappl_test($_SESSION['usersession']['idapplication'],$num_form);
|
|
|
$bool_existe = count($listbool_existe);
|
|
|
if ($bool_existe > 0){
|
|
|
$list_test = $obj_test->Getappl_test($num_form);
|
|
|
$idappl_test = $list_test[0]->idtest ;
|
|
|
$lista_appl_test = $application_test->info($idappl_test);
|
|
|
//var_dump($lista_appl_test);
|
|
|
$items = count($lista_appl_test);
|
|
|
//$variable_veri = is_null($lista_appl_test);
|
|
|
//var_dump($variable_veri);
|
|
|
//if ($variable_veri == true){
|
|
|
if ($items > 0){
|
|
|
//echo "no hay nada";
|
|
|
$list_vitalSigns = $obj_vitalSigns->info_appltest($idappl_test);
|
|
|
$list_physicalExam = $obj_physicalExam->info_appltest($idappl_test);
|
|
|
$data['list_vitalSigns'] = $list_vitalSigns;
|
|
|
$data['lista_appl_test'] = $lista_appl_test;
|
|
|
$data['list_physicalExam'] = $list_physicalExam;
|
|
|
}
|
|
|
|
|
|
} //************************************************
|
|
|
$title = "Screening Vital Signs And Physical Exam (whitin 21 days of Dose 1)";
|
|
|
$data['oculto'] = 1;
|
|
|
//************************************************************
|
|
|
$number = 1;
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
$result = $application_test->getApplicationTest($number);
|
|
|
if(($result->rowCount()) == 1){
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=5";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
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';
|
|
|
$test = new testsModel();
|
|
|
$detail_test = new detailTestModel();
|
|
|
$category = new categoryModel();
|
|
|
$data_medical = new dataMedicalModel();
|
|
|
$id = 1;
|
|
|
|
|
|
$result_test = $test->getTest($id);
|
|
|
$data_test = $result_test->fetch();
|
|
|
|
|
|
list($result_detail, $num_rows_detail) = $detail_test->dolistbyTest($id);
|
|
|
$data_detail = $result_detail->fetchAll();
|
|
|
|
|
|
$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['data_fields'] = $data_fields;
|
|
|
$method = "add";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "frm_05_op2":
|
|
|
//****************Traemos la data para mostrar********************************
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'dataMedicalModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'vitalSignsModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'physicalExamModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
$data_medical = new dataMedicalModel();
|
|
|
$obj_vitalSigns = new vitalSignsModel();
|
|
|
$obj_physicalExam = new physicalExamModel();
|
|
|
$obj_test = new testsModel();
|
|
|
$arr_form = explode("frm_","frm_05");
|
|
|
$num_form = (int) $arr_form[1];
|
|
|
$listbool_existe = $application_test->Getappl_test($_SESSION['usersession']['idapplication'],$num_form);
|
|
|
$bool_existe = count($listbool_existe);
|
|
|
if ($bool_existe > 0){
|
|
|
$list_test = $obj_test->Getappl_test($num_form);
|
|
|
$idappl_test = $list_test[0]->idtest ;
|
|
|
$lista_appl_test = $application_test->info($idappl_test);
|
|
|
//var_dump($lista_appl_test);
|
|
|
$items = count($lista_appl_test);
|
|
|
//$variable_veri = is_null($lista_appl_test);
|
|
|
//var_dump($variable_veri);
|
|
|
//if ($variable_veri == true){
|
|
|
if ($items > 0){
|
|
|
//echo "no hay nada";
|
|
|
$list_vitalSigns = $obj_vitalSigns->info_appltest($idappl_test);
|
|
|
$list_physicalExam = $obj_physicalExam->info_appltest($idappl_test);
|
|
|
$data['list_vitalSigns'] = $list_vitalSigns;
|
|
|
$data['lista_appl_test'] = $lista_appl_test;
|
|
|
$data['list_physicalExam'] = $list_physicalExam;
|
|
|
}
|
|
|
|
|
|
} //************************************************
|
|
|
$title = "Screening Vital Signs And Physical Exam (whitin 21 days of Dose 1)";
|
|
|
$data['oculto'] = 1;
|
|
|
//************************************************************
|
|
|
$number = 1;
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
$result = $application_test->getApplicationTest($number);
|
|
|
if(($result->rowCount()) == 1){
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=5";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
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';
|
|
|
$test = new testsModel();
|
|
|
$detail_test = new detailTestModel();
|
|
|
$category = new categoryModel();
|
|
|
$data_medical = new dataMedicalModel();
|
|
|
$id = 1;
|
|
|
|
|
|
$result_test = $test->getTest($id);
|
|
|
$data_test = $result_test->fetch();
|
|
|
|
|
|
list($result_detail, $num_rows_detail) = $detail_test->dolistbyTest($id);
|
|
|
$data_detail = $result_detail->fetchAll();
|
|
|
|
|
|
$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['data_fields'] = $data_fields;
|
|
|
$method = "add";
|
|
|
}
|
|
|
}
|
|
|
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 listdata(){
|
|
|
$name_form = $_GET["name_form"];
|
|
|
//************************************************
|
|
|
switch ($name_form){
|
|
|
case "frm_04":
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'MedicalHistoryModel.php';
|
|
|
$MedicalHistory = new MedicalHistoryModel();
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
$list_history = $MedicalHistory->list_history($idapplication);
|
|
|
//************************************************
|
|
|
$method = "view";
|
|
|
$title = "Screening Medical History";
|
|
|
$data['list_history'] = $list_history;
|
|
|
$data['content'] = "components".DS.COMPONENT.DS."views".DS.$name_form.".php";
|
|
|
$data['method'] = $method;
|
|
|
$data['title'] = $title;
|
|
|
$data['oculto'] = 1;
|
|
|
break;
|
|
|
case "frm_05":
|
|
|
//****************Traemos la data para mostrar********************************
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'dataMedicalModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'vitalSignsModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'physicalExamModel.php';
|
|
|
$application_test = new applicationTestModel();
|
|
|
$data_medical = new dataMedicalModel();
|
|
|
$obj_vitalSigns = new vitalSignsModel();
|
|
|
$obj_physicalExam = new physicalExamModel();
|
|
|
$idappl_test = $_GET['id'];
|
|
|
$lista_appl_test = $application_test->info($idappl_test);
|
|
|
$list_vitalSigns = $obj_vitalSigns->info_appltest($idappl_test);
|
|
|
$list_physicalExam = $obj_physicalExam->info_appltest($idappl_test);
|
|
|
//****************************************************************************
|
|
|
$number = 1;
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
$result = $application_test->getApplicationTest($number);
|
|
|
if(($result->rowCount()) == 1){
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=5";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}else{
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'testsModel.php';
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'detailTestModel.php';
|
|
|
require_once 'components'.DS.'com_data'.DS.'models'.DS.'categoryModel.php';
|
|
|
$test = new testsModel();
|
|
|
$detail_test = new detailTestModel();
|
|
|
$category = new categoryModel();
|
|
|
$id = 1;
|
|
|
|
|
|
$result_test = $test->getTest($id);
|
|
|
$data_test = $result_test->fetch();
|
|
|
|
|
|
list($result_detail, $num_rows_detail) = $detail_test->dolistbyTest($id);
|
|
|
$data_detail = $result_detail->fetchAll();
|
|
|
|
|
|
$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['data_fields'] = $data_fields;
|
|
|
$method = "add";
|
|
|
}
|
|
|
}
|
|
|
//************************************************
|
|
|
//$method = "view";
|
|
|
$title = "Screening Vital Signs And Physical Exam (whitin 21 days of Dose 1)";
|
|
|
$data['list_vitalSigns'] = $list_vitalSigns;
|
|
|
$data['lista_appl_test'] = $lista_appl_test;
|
|
|
$data['list_physicalExam'] = $list_physicalExam;
|
|
|
$data['content'] = "components".DS.COMPONENT.DS."views".DS.$name_form.".php";
|
|
|
$data['method'] = $method;
|
|
|
$data['title'] = $title;
|
|
|
$data['oculto'] = 1;
|
|
|
break;
|
|
|
}
|
|
|
$this->view->show("template.php", $data);
|
|
|
}
|
|
|
public function save(){
|
|
|
$num_form = $_POST['num_form'];
|
|
|
switch ($num_form){
|
|
|
case 1:
|
|
|
|
|
|
$data_table = $_POST['datos'];
|
|
|
$data_table_1['date_birth'] = $this->formatDateCRF($data_table['db']);
|
|
|
$data_table_1['race'] = $data_table['race'];
|
|
|
$data_table_1['gender'] = $data_table['gender'];
|
|
|
$data_table_1['ethnicity'] = $data_table['ethnicity'];
|
|
|
$data_table_1['initials'] = $data_table['initials'];
|
|
|
|
|
|
$data_table_2['idsubject'] = $data_table['txt_code'];
|
|
|
$data_table_2['screening_date'] = $this->formatDateCRF($data_table['sd']);
|
|
|
$data_table_2['date_consent'] = $this->formatDateCRF($data_table['dics']);
|
|
|
$data_table_2['code'] = "CRF001";
|
|
|
|
|
|
require 'components'.DS.'com_subjects'.DS.'models'.DS.'subjectModel.php';
|
|
|
$subject = new subjectModel();
|
|
|
$subject->setIdValue($data_table['txt_code']);
|
|
|
list($result, $message) = $subject->UpdateItem($data_table_1);
|
|
|
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'CRFApplicationModel.php';
|
|
|
$crf_appl = new CRFApplicationModel();
|
|
|
list($result, $id, $message) = $crf_appl->addItem($data_table_2);
|
|
|
$_SESSION['usersession']['idapplication'] = $id;
|
|
|
|
|
|
$url = "index.php?option=com_data&controller=Data&action=add&name_form=frm_02";
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
$data_form = $_POST['datos'];
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
|
|
|
for($i=1; $i<=10; $i++){
|
|
|
$data_table['idapplication'] = $idapplication;
|
|
|
$data_table['iddata_general'] = $data_form["id_$i"];
|
|
|
$data_table['value'] = $data_form["criteria_$i"];
|
|
|
$data_table['type'] = 1;
|
|
|
list($result, $id, $message) = $criteria->addItem($data_table);
|
|
|
}
|
|
|
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=frm_02";
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
$data_form = $_POST['datos'];
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
|
|
|
for($i=1; $i<=14; $i++){
|
|
|
$data_table['idapplication'] = $idapplication;
|
|
|
$data_table['iddata_general'] = $data_form["id_$i"];
|
|
|
$data_table['value'] = $data_form["criteria_$i"];
|
|
|
$data_table['type'] = 2;
|
|
|
list($result, $id, $message) = $criteria->addItem($data_table);
|
|
|
}
|
|
|
|
|
|
$url = "index.php?option=com_data&controller=Data&action=view&name_form=frm_03";
|
|
|
break;
|
|
|
case 4:
|
|
|
$data_form = $_POST['datos'];
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'CRFApplicationModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'MedicalHistoryModel.php';
|
|
|
//var_dump($_SESSION);
|
|
|
$CRFApplication = new CRFApplicationModel();
|
|
|
$MedicalHistory = new MedicalHistoryModel();
|
|
|
if ($data_form['mh'] == "Y"){
|
|
|
$data_table['medical_history'] = 1;
|
|
|
$CRFApplication->setIdValue($_SESSION['usersession']['idapplication']);
|
|
|
list($result_crf, $message) = $CRFApplication->UpdateItem($data_table);
|
|
|
//print_r($result_crf); die();
|
|
|
//*****************Insertar en la 2 tabla *****************
|
|
|
$data_table2['idapplication'] = $_SESSION['usersession']['idapplication'];
|
|
|
$data_table2['description'] = $data_form['finding'];
|
|
|
$data_table2['bool_active'] = $data_form['finding_status'];
|
|
|
$data_table2['date_create'] = date("Y-m-d H:s:m");
|
|
|
$data_table2['date_update'] = date("Y-m-d H:s:m");
|
|
|
list($result, $id, $message) = $MedicalHistory->addItem($data_table2);
|
|
|
}else{
|
|
|
$data_table['medical_history'] = 0;
|
|
|
$CRFApplication->setIdValue($_SESSION['usersession']['idapplication']);
|
|
|
list($result_crf, $message) = $CRFApplication->UpdateItem($data_table);
|
|
|
}
|
|
|
|
|
|
$url = "index.php?option=com_data&controller=Data&action=listdata&name_form=frm_04";
|
|
|
break;
|
|
|
case 5:
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'applicationTestModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'dataMedicalModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'vitalSignsModel.php';
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'physicalExamModel.php';
|
|
|
//*********Guardando datos en sis_appl_test**********************************
|
|
|
$obj_applicationTest = new applicationTestModel();
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
$idtest = $_POST['num_form'];
|
|
|
$date_exam = $this->formatDateCRF($_POST['date_exam']);
|
|
|
$data_table['idapplication'] = $idapplication;
|
|
|
$data_table['idtest'] = $idtest;
|
|
|
$data_table['date'] = $date_exam;
|
|
|
list($result, $idappltest, $message) = $obj_applicationTest->addItem($data_table);
|
|
|
print_r($result);
|
|
|
//********Guardando datos en sis_vital_signs**********************************
|
|
|
$obj_dataMedical = new dataMedicalModel();
|
|
|
$obj_vSigns = new vitalSignsModel();
|
|
|
$list_vsigns = $obj_dataMedical->list_cat1();
|
|
|
$data_tablevs['idappl_test'] = $idappltest;
|
|
|
$num_items = count($list_vsigns) - 1;
|
|
|
$data_formvs = $_POST['datos']['v_signs'];
|
|
|
for ($i=0; $i<=$num_items; $i++){
|
|
|
$datavsigns = $list_vsigns[$i];
|
|
|
$id_vs = $datavsigns->iddm;
|
|
|
if (isset($data_formvs["value_".$id_vs])){
|
|
|
$data_tablevs['iddm'] = $id_vs;
|
|
|
$data_tablevs['value'] = $data_formvs["value_".$id_vs];
|
|
|
list($result, $idvSigns, $message) = $obj_vSigns->addItem($data_tablevs);
|
|
|
//print_r($result);
|
|
|
}
|
|
|
}//fin del for
|
|
|
//***********Guardando datos sis_physical_exam *******************************
|
|
|
$obj_pExam = new physicalExamModel();
|
|
|
$data_tablepexam['idappl_test'] = $idappltest;
|
|
|
$list_p_exam = $obj_dataMedical->list_cat2();
|
|
|
$num_items = count($list_vsigns) - 1;
|
|
|
$data_formpexam = $_POST['datos']['p_exam'];
|
|
|
for ($i=0; $i<=$num_items; $i++){
|
|
|
$datapexam = $list_p_exam[$i];
|
|
|
$id_pexam = $datapexam->iddm;
|
|
|
if (isset($data_formpexam["value_".$id_pexam])){
|
|
|
$data_tablepexam['iddm'] = $id_pexam;
|
|
|
echo $_POST["text".$id_pexam];
|
|
|
if ((isset($_POST["text".$id_pexam])) and (!empty($_POST["text".$id_pexam])))
|
|
|
$data_tablepexam['description'] = $_POST["text".$id_pexam];
|
|
|
else
|
|
|
$data_tablepexam['description'] = "";
|
|
|
$data_tablepexam['status'] = $data_formpexam["value_".$id_pexam];
|
|
|
list($result, $idvSigns, $message) = $obj_pExam->addItem($data_tablepexam);
|
|
|
//print_r($result);
|
|
|
}
|
|
|
}//fin del for
|
|
|
//****************************************************************************
|
|
|
$url = "index.php?option=com_data&controller=Data&action=listdata&name_form=frm_05&id=".$idappltest;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
public function view(){
|
|
|
$name_form = $_REQUEST["name_form"];
|
|
|
$method = "";
|
|
|
$title = "";
|
|
|
switch ($name_form){
|
|
|
case "frm_01":
|
|
|
require 'components'.DS.'com_subjects'.DS.'models'.DS.'subjectModel.php';
|
|
|
$subject = new subjectModel();
|
|
|
if(isset ($_SESSION['usersession']['idsubject']) || !empty($_SESSION['usersession']['idsubject'])){
|
|
|
$idsubject = $_SESSION['usersession']['idsubject'];
|
|
|
$method = "view";
|
|
|
$result = $subject->getSubject($idsubject);
|
|
|
$data_result = $result->fetch();
|
|
|
($data_result["gender"] == 1) ? $gender = "Male" : $gender = "Female";
|
|
|
switch($data_result["race"]){
|
|
|
case 1:
|
|
|
$race = "American Indian or Alaska Native";
|
|
|
break;
|
|
|
case 2:
|
|
|
$race = "Asian";
|
|
|
break;
|
|
|
case 3:
|
|
|
$race = "Black or African American";
|
|
|
break;
|
|
|
case 4:
|
|
|
$race = "Native Hawaiin or Other Pacific Islander";
|
|
|
break;
|
|
|
case 5:
|
|
|
$race = "White";
|
|
|
break;
|
|
|
case 6:
|
|
|
$race = "Unknown";
|
|
|
break;
|
|
|
}
|
|
|
switch($data_result["ethnicity"]){
|
|
|
case 1:
|
|
|
$ethnicity = "Hispanic or Latin";
|
|
|
break;
|
|
|
case 2:
|
|
|
$ethnicity = "Not Hispanic or latino";
|
|
|
break;
|
|
|
case 3:
|
|
|
$ethnicity = "Unknown";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data_result['date_birth'] = $this->viewDateCRF($data_result['date_birth']);
|
|
|
|
|
|
$data['data_result'] = $data_result;
|
|
|
$data['race'] = $race;
|
|
|
$data['gender'] = $gender;
|
|
|
$data['ethnicity'] = $ethnicity;
|
|
|
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'CRFApplicationModel.php';
|
|
|
$crf_appl = new CRFApplicationModel();
|
|
|
$result_crf = $crf_appl->getCRF($idsubject);
|
|
|
$data_crf = $result_crf->fetch();
|
|
|
$data_crf['screening_date'] = $this->viewDateCRF($data_crf['screening_date']);
|
|
|
$data_crf['date_consent'] = $this->viewDateCRF($data_crf['date_consent']);
|
|
|
|
|
|
$data['data_crf'] = $data_crf;
|
|
|
|
|
|
}else{
|
|
|
$method = "add";
|
|
|
list($result, $num_rows) = $subject->dolistWithoutCRF();
|
|
|
$data_list = $result->fetchAll();
|
|
|
$data['data_list'] = $data_list;
|
|
|
}
|
|
|
$title = "Demografics";
|
|
|
break;
|
|
|
case "frm_02":
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
$title = "Inclusion Criteria";
|
|
|
$type = 1;
|
|
|
$category = 8;
|
|
|
|
|
|
list($result_criteria, $num_rows) = $criteria->dolist($type, $category, $idapplication);
|
|
|
$data_table = $result_criteria->fetchAll();
|
|
|
$data['data_list'] = $data_table;
|
|
|
$method = "view";
|
|
|
}else{
|
|
|
$url = "index.php?option=com_data&controller=Data&action=add&name_form=frm_02";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case "frm_03":
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
$title = "Exclusion Criteria";
|
|
|
$type = 2;
|
|
|
$category = 9;
|
|
|
|
|
|
list($result_criteria, $num_rows) = $criteria->dolist($type, $category, $idapplication);
|
|
|
$data_table = $result_criteria->fetchAll();
|
|
|
$data['data_list'] = $data_table;
|
|
|
$method = "view";
|
|
|
}else{
|
|
|
$url = "index.php?option=com_data&controller=Data&action=add&name_form=frm_03";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case "frm_04":
|
|
|
if(isset ($_SESSION['usersession']['idapplication']) || !empty($_SESSION['usersession']['idapplication'])){
|
|
|
$idapplication = $_SESSION['usersession']['idapplication'];
|
|
|
require 'components'.DS.'com_data'.DS.'models'.DS.'criteriaModel.php';
|
|
|
$criteria = new criteriaModel();
|
|
|
$title = "Screening Medical History";
|
|
|
$type = 2;
|
|
|
$category = 9;
|
|
|
|
|
|
list($result_criteria, $num_rows) = $criteria->dolist($type, $category, $idapplication);
|
|
|
$data_table = $result_criteria->fetchAll();
|
|
|
$data['data_list'] = $data_table;
|
|
|
$method = "view";
|
|
|
}else{
|
|
|
$url = "index.php?option=com_data&controller=Data&action=add&name_form=frm_04";
|
|
|
header("location: ".$url);
|
|
|
exit();
|
|
|
}
|
|
|
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";
|
|
|
if ($mes == "00") $mes2 = "Nn";
|
|
|
|
|
|
$a = explode ("-", $date_tmp);
|
|
|
$date_tmp = $a[2]."/".$mes2."/".$a[0];
|
|
|
|
|
|
return $date_tmp;
|
|
|
}
|
|
|
}
|
|
|
?>
|
|
|
|