update_lab_config($lab_config, $updated_specimen_list, $updated_test_list); # Generate initial worksheet configs if missing $lab_config->worksheetConfigGenerate(); # Check if disease report has already been configured. ## If not, add new entries $site_settings = new DiseaseReport(); $site_settings->labConfigId = $lab_config_id; $site_settings->testTypeId = 0; $site_settings->measureId = 0; $site_settings->groupByGender = 1; $site_settings->groupByAge = 0; $site_settings->ageGroups = ""; $site_settings->measureGroups = ""; $existing_settings = DiseaseReport::getByKeys($site_settings->labConfigId, $site_settings->testTypeId, $site_settings->measureId); if ($existing_settings == null) { $site_settings->addToDb(); } $selected_test_list = $lab_config->getTestTypes(); foreach ($selected_test_list as $test_type) { $site_settings->testTypeId = $test_type->testTypeId; $measure_list = $test_type->getMeasures(); foreach ($measure_list as $measure) { $site_settings->measureId = $measure->measureId; $site_settings->measureGroups = $measure->range; if (strpos($site_settings->measureGroups, "/") === true) { # Alphanumeric options: Do not add new entry continue; } $existing_settings = DiseaseReport::getByKeys($site_settings->labConfigId, $site_settings->testTypeId, $site_settings->measureId); if ($existing_settings == null) { $site_settings->addToDb();
$disease_report->groupByAge = 0; $disease_report->ageGroups = null; } if ($_REQUEST['rgender'] == 'y') { # Group by gender enabled $disease_report->groupByGender = 1; } else { # Group by gender not selected $disease_report->groupByGender = 0; } # Insert dummy record with (lab_config_id, 0, 0) for site-wide settings of all test types. # Can be removed later if group_by_gender and group_by_age settings need to be test-specific. $disease_report->testTypeId = 0; $disease_report->measureId = 0; $disease_report->measureGroups = ""; $disease_report->addToDb(); # For each test type ## Fetch range slots for each measure and update in DB $test_list = $_REQUEST['ttypes']; foreach ($test_list as $test_type_id) { $disease_report->testTypeId = $test_type_id; $test_type = TestType::getById($test_type_id); $measure_list = $test_type->getMeasureIds(); foreach ($measure_list as $measure_id) { $slot_string = ""; # Fetch measure slot values $disease_report->measureId = $measure_id; $lower_field_name = "slotl_" . $test_type_id . "_" . $measure_id; $upper_field_name = "slotu_" . $test_type_id . "_" . $measure_id; if (!isset($_REQUEST[$lower_field_name])) { continue;