devsofttech_hms_ci4/check_bed_history.php
DevSoftTech Server f2a7546a9d Simplify discharge summary placeholders - eliminate confusion
Changes:
- Rename main placeholder: DISCHARGE_SUMMARY → CLINICAL_SUMMARY (clearer name)
- Keep DISCHARGE_SUMMARY as legacy alias for backward compatibility
- Rename: DISCHARGE_ADVICE → FOLLOW_UP_INSTRUCTIONS (more descriptive)
- Remove: INSTRUCTION_REMARK (duplicate removed)
- Group placeholders by category in code with comments
- Create comprehensive reference guide: DISCHARGE_PLACEHOLDERS_REFERENCE.md

Benefits:
- Clear distinction between clinical summary and discharge instructions
- Organized placeholder groups (clinical, instructions, other)
- Easy migration guide for existing templates
- Complete documentation with examples
2026-06-11 08:18:43 +05:30

40 lines
1.2 KiB
PHP

<?php
$db = new mysqli('localhost', 'root', '', 'hms_data_ci4');
echo "Checking bed_assignment_history for IPD ID: 1\n";
echo "=============================================\n\n";
$result = $db->query("
SELECT
bah.id,
bah.ipd_id,
bah.bed_id,
bm.bed_number,
bm.bed_code,
bm.bed_status,
bm.current_ipd_id,
DATE_FORMAT(bah.assigned_date, '%d-%m-%Y %H:%i') as assigned_date,
bah.released_date
FROM bed_assignment_history bah
LEFT JOIN bed_master bm ON bm.id = bah.bed_id
WHERE bah.ipd_id = 1
ORDER BY bah.assigned_date DESC
");
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "Assignment ID: {$row['id']}\n";
echo "Bed: {$row['bed_number']} ({$row['bed_code']})\n";
echo "Assigned Date: {$row['assigned_date']}\n";
echo "Released Date: " . ($row['released_date'] ?? 'NOT RELEASED') . "\n";
echo "Bed Status in master: {$row['bed_status']}\n";
echo "Current IPD ID in bed: " . ($row['current_ipd_id'] ?? 'NULL') . "\n";
echo "---\n";
}
} else {
echo "No bed assignment history found for this patient.\n";
echo "This patient may need a bed assigned manually.\n";
}
$db->close();