Add debug endpoint to check IPD master fields
Problem:
- {{ADMISSION_TIME}} showing 12:00 AM instead of actual time
- {{DISCHARGE_TIME}} showing 12:00 AM instead of actual time
- {{DEPARTMENT}} showing blank
- {{DOCTOR_NAMES}} showing blank
Need to identify:
1. Which datetime fields exist in ipd_master table
2. Which department field exists (dept_id, department_id, or department)
3. Which doctor field exists (doc_list, doctor_id, doc_id, consultant_id)
4. What values are actually stored in these fields
Debug Endpoint Added:
- URL: /Ipd_discharge/debug_ipd_fields/{ipdId}
- Example: http://localhost:8080/Ipd_discharge/debug_ipd_fields/123
- Replace 123 with actual IPD ID from your discharge page
What it shows:
- All available field names in ipd_master table
- Values of: register_date, discharge_date, register_time, discharge_time, admission_time
- Values of: dept_id, department_id, department
- Values of: doc_list, doctor_id, doc_id, consultant_id
- Result of getDischargeDepartmentName() function
- Result of getDischargeDoctorNames() function
- Result of safeTime() for register_date and discharge_date
Usage:
1. Go to your discharge form
2. Note the IPD ID from the URL
3. Open: /Ipd_discharge/debug_ipd_fields/{ipdId} in browser
4. Check the JSON output to see which fields exist and their values
This will help identify:
- If datetime fields have time component or just date
- Which field names are actually used in your database
- Why placeholders are showing blank/wrong values
This commit is contained in:
parent
51aa6400c8
commit
87789cff7a
|
|
@ -4494,6 +4494,60 @@ class Ipd_discharge extends BaseController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug endpoint to check IPD master fields
|
||||
* Access via: /Ipd_discharge/debug_ipd_fields/{ipdId}
|
||||
*/
|
||||
public function debug_ipd_fields(int $ipdId)
|
||||
{
|
||||
if ($ipdId <= 0) {
|
||||
return $this->response->setJSON(['error' => 'Invalid IPD ID']);
|
||||
}
|
||||
|
||||
// Get all fields from ipd_master
|
||||
$ipdMaster = $this->db->table('ipd_master')
|
||||
->where('id', $ipdId)
|
||||
->get()
|
||||
->getRow();
|
||||
|
||||
if (!$ipdMaster) {
|
||||
return $this->response->setJSON(['error' => 'IPD not found']);
|
||||
}
|
||||
|
||||
// Get panel info (what getIpdPanelInfo returns)
|
||||
$panelData = $this->ipdBillingModel->getIpdPanelInfo($ipdId);
|
||||
$ipd = $panelData['ipd_info'] ?? null;
|
||||
|
||||
// Check what fields exist
|
||||
$fields = [
|
||||
'Available Fields in ipd_master' => array_keys((array)$ipdMaster),
|
||||
'register_date' => $ipdMaster->register_date ?? 'NOT FOUND',
|
||||
'discharge_date' => $ipdMaster->discharge_date ?? 'NOT FOUND',
|
||||
'register_time' => $ipdMaster->register_time ?? 'NOT FOUND',
|
||||
'discharge_time' => $ipdMaster->discharge_time ?? 'NOT FOUND',
|
||||
'admission_time' => $ipdMaster->admission_time ?? 'NOT FOUND',
|
||||
'dept_id' => $ipdMaster->dept_id ?? 'NOT FOUND',
|
||||
'department_id' => $ipdMaster->department_id ?? 'NOT FOUND',
|
||||
'department' => $ipdMaster->department ?? 'NOT FOUND',
|
||||
'doc_list' => $ipdMaster->doc_list ?? 'NOT FOUND',
|
||||
'doctor_id' => $ipdMaster->doctor_id ?? 'NOT FOUND',
|
||||
'doc_id' => $ipdMaster->doc_id ?? 'NOT FOUND',
|
||||
'consultant_id' => $ipdMaster->consultant_id ?? 'NOT FOUND',
|
||||
];
|
||||
|
||||
// Check what getDischargeDepartmentName returns
|
||||
$fields['getDischargeDepartmentName()'] = $this->getDischargeDepartmentName($ipd);
|
||||
|
||||
// Check what getDischargeDoctorNames returns
|
||||
$fields['getDischargeDoctorNames()'] = $this->getDischargeDoctorNames($ipd);
|
||||
|
||||
// Check safeTime results
|
||||
$fields['safeTime(register_date)'] = $this->safeTime((string)($ipdMaster->register_date ?? ''));
|
||||
$fields['safeTime(discharge_date)'] = $this->safeTime((string)($ipdMaster->discharge_date ?? ''));
|
||||
|
||||
return $this->response->setJSON($fields, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
public function ipd_select(int $ipdId, int $reCreate = 0)
|
||||
{
|
||||
$permission = $this->requireAnyPermission([
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user