diff --git a/check_abdm_m3_status.php b/check_abdm_m3_status.php new file mode 100644 index 0000000..9aaa934 --- /dev/null +++ b/check_abdm_m3_status.php @@ -0,0 +1,55 @@ +query("SELECT id, p_fname, p_lname, abha_address FROM patient_master WHERE id = {$pid}"); +$patient = $r ? $r->fetch_assoc() : null; +print_r($patient); + +$abhaAddress = $patient['abha_address'] ?? ''; + +echo "\n=== abdm_hiu_workflows columns ===\n"; +$colsResult = $db->query("SHOW COLUMNS FROM abdm_hiu_workflows"); +$workflowCols = []; +while ($c = $colsResult->fetch_assoc()) { + $workflowCols[] = $c['Field']; +} +echo implode(', ', $workflowCols) . "\n"; + +echo "\n=== abdm_hiu_workflows (latest 15 for this ABHA / patient) ===\n"; +$where = $abhaAddress !== '' ? "abha_address = '" . $db->real_escape_string($abhaAddress) . "'" : "1=0"; +$result = $db->query(" + SELECT * + FROM abdm_hiu_workflows + WHERE {$where} + ORDER BY id DESC + LIMIT 15 +"); +if ($result) { + while ($row = $result->fetch_assoc()) { + print_r($row); + } +} else { + echo "Query failed or table missing: " . $db->error . "\n"; +} + +echo "\n=== abdm_api_logs (latest 15) ===\n"; +$result2 = $db->query("SHOW TABLES LIKE 'abdm_api_logs'"); +if ($result2 && $result2->num_rows > 0) { + $cols = $db->query("SHOW COLUMNS FROM abdm_api_logs"); + $colNames = []; + while ($c = $cols->fetch_assoc()) { + $colNames[] = $c['Field']; + } + echo "Columns: " . implode(', ', $colNames) . "\n\n"; + $result3 = $db->query("SELECT * FROM abdm_api_logs ORDER BY id DESC LIMIT 15"); + while ($row = $result3->fetch_assoc()) { + print_r($row); + } +} else { + echo "abdm_api_logs table not found.\n"; +} + +$db->close(); diff --git a/check_abdm_request.php b/check_abdm_request.php new file mode 100644 index 0000000..9695515 --- /dev/null +++ b/check_abdm_request.php @@ -0,0 +1,30 @@ +real_escape_string($requestId); + +echo "=== abdm_hiu_workflows matching request_id/gateway_request_id/hms_request_id = {$requestId} ===\n"; +$result = $db->query(" + SELECT * + FROM abdm_hiu_workflows + WHERE request_id = '{$escaped}' OR gateway_request_id = '{$escaped}' OR hms_request_id = '{$escaped}' + ORDER BY id ASC +"); +if ($result) { + while ($row = $result->fetch_assoc()) { + print_r($row); + } +} else { + echo "Query failed: " . $db->error . "\n"; +} + +echo "\n=== abdm_api_logs matching entity_id = {$requestId} ===\n"; +$result2 = $db->query("SELECT * FROM abdm_api_logs WHERE entity_id = '{$escaped}' ORDER BY id ASC"); +if ($result2) { + while ($row = $result2->fetch_assoc()) { + print_r($row); + } +} + +$db->close(); diff --git a/check_bridge_settings.php b/check_bridge_settings.php new file mode 100644 index 0000000..696c0e0 --- /dev/null +++ b/check_bridge_settings.php @@ -0,0 +1,10 @@ +query("SELECT s_name, s_value FROM hospital_setting WHERE s_name IN ('EATRIA_BRIDGE_TOKEN','ABDM_HFR_ID')"); +$settings = []; +while ($r = $rows->fetch_assoc()) { + $settings[$r['s_name']] = $r['s_value']; +} +echo "Token present: " . (isset($settings['EATRIA_BRIDGE_TOKEN']) && $settings['EATRIA_BRIDGE_TOKEN'] !== '' ? 'yes (len=' . strlen($settings['EATRIA_BRIDGE_TOKEN']) . ')' : 'NO') . "\n"; +echo "HFR ID: " . ($settings['ABDM_HFR_ID'] ?? 'NOT SET') . "\n"; +$db->close(); diff --git a/check_hospital_setting_cols.php b/check_hospital_setting_cols.php new file mode 100644 index 0000000..7740b86 --- /dev/null +++ b/check_hospital_setting_cols.php @@ -0,0 +1,13 @@ +query('SHOW COLUMNS FROM hospital_setting'); +$colNames = []; +while ($c = $cols->fetch_assoc()) { + $colNames[] = $c['Field']; +} +echo "Columns: " . implode(', ', $colNames) . "\n"; +$rows = $db->query('SELECT * FROM hospital_setting LIMIT 5'); +while ($r = $rows->fetch_assoc()) { + print_r($r); +} +$db->close(); diff --git a/delete_abdm_old_request.php b/delete_abdm_old_request.php new file mode 100644 index 0000000..304cbb7 --- /dev/null +++ b/delete_abdm_old_request.php @@ -0,0 +1,20 @@ +real_escape_string($abhaAddress); + +$countResult = $db->query("SELECT COUNT(*) AS c FROM abdm_hiu_workflows WHERE abha_address = '{$escaped}'"); +$count = $countResult->fetch_assoc()['c'] ?? 0; +echo "Rows to delete for {$abhaAddress}: {$count}\n"; + +$db->query("DELETE FROM abdm_hiu_workflows WHERE abha_address = '{$escaped}'"); +echo "Deleted. Affected rows: " . $db->affected_rows . "\n"; + +$docCountResult = $db->query("SHOW TABLES LIKE 'abdm_hiu_documents'"); +if ($docCountResult && $docCountResult->num_rows > 0) { + $docRows = $db->query("SELECT COUNT(*) AS c FROM abdm_hiu_documents WHERE abha_address = '{$escaped}'"); + echo "Existing abdm_hiu_documents rows for {$abhaAddress}: " . ($docRows->fetch_assoc()['c'] ?? 0) . "\n"; +} + +$db->close(); diff --git a/raw_bridge_status_check.php b/raw_bridge_status_check.php new file mode 100644 index 0000000..08b4868 --- /dev/null +++ b/raw_bridge_status_check.php @@ -0,0 +1,44 @@ +query("SELECT s_name, s_value FROM hospital_setting WHERE s_name IN ('EATRIA_BRIDGE_TOKEN','ABDM_HFR_ID')"); +$settings = []; +while ($r = $rows->fetch_assoc()) { + $settings[$r['s_name']] = $r['s_value']; +} +$db->close(); + +$token = trim((string) ($settings['EATRIA_BRIDGE_TOKEN'] ?? '')); +$hfrId = trim((string) ($settings['ABDM_HFR_ID'] ?? '')); + +$requestId = $argv[1] ?? 'REQ-20260728030125-b03b873b'; + +$url = 'https://abdm-bridge.e-atria.in/api/v1/hiu/consent/status?' . http_build_query([ + 'request_id' => $requestId, + 'hfr_id' => $hfrId, +]); + +$ch = curl_init(); +curl_setopt_array($ch, [ + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HEADER => true, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTPHEADER => [ + 'Accept: application/json', + 'Authorization: Bearer ' . $token, + ], +]); +$raw = curl_exec($ch); +$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); +$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); +$err = curl_error($ch); +curl_close($ch); + +echo "URL: {$url}\n"; +echo "HTTP Code: {$httpCode}\n"; +echo "Curl error: {$err}\n"; +if ($raw !== false) { + echo "--- Headers ---\n" . substr($raw, 0, $headerSize) . "\n"; + echo "--- Body (raw bytes length=" . strlen(substr($raw, $headerSize)) . ") ---\n"; + echo substr($raw, $headerSize) . "\n"; +}