Problem:
- PDF shows old cached content with 'Date of Discharge: 2026-06-05'
- Debug page shows correct new format (status header only)
- Discharge content is cached in ipd_discharge table
- PDF generation uses cached content from database
- Fix only affects newly generated content, not cached content
Root Cause:
When discharge is first created, content is generated and saved to DB.
PDF generation flow (show_discharge method):
1. Load cached content from ipd_discharge table
2. Only regenerate if content is empty
3. Apply template and render PDF
So old discharges still have old format cached.
Solution:
Added 'refresh' parameter to show_discharge() method:
- If refresh=1, ignore cached content and regenerate
- Regenerate using buildAutoDischargeContent() (has fix)
- Save new content to database
- Then render PDF
Code Change (line 5900-5913):
Added:
\ = (int) (\->request->getGet('refresh') ?? 0) === 1;
Changed:
if (\ || trim(strip_tags(\)) === '') {
Usage:
1. Original URL (uses cache):
http://localhost:8080/Ipd_discharge/show_discharge/1/1?tpl=1
2. Force refresh (regenerates):
http://localhost:8080/Ipd_discharge/show_discharge/1/1?tpl=1&refresh=1
3. After first refresh, cache is updated with new format
Subsequent views will use new cached content
Note:
- preview_discharge_report() already has 'regen=1' parameter
- Same functionality, different parameter name
- Both methods now support force regeneration
For existing discharges:
- Add &refresh=1 to URL once to update cache
- Or recreate discharge from edit page
- Or clear ipd_discharge.content for that IPD ID"
COMPLETED ALL TODO ITEMS:
✅ Task 1: Enhanced Surgery autocomplete with SNOMED/ICD codes
✅ Task 2: Enhanced Procedure autocomplete with SNOMED/ICD codes
✅ Task 3: Verified Master CRUD integration (modal already working)
✅ Task 4: Created comprehensive testing documentation
KEY FIXES:
- Removed conflicting bindSurgeryTermLookup() calls from initSurgeryTools()
- Old datalist code no longer interferes with new custom dropdown
- Both autocompletes work independently with separate dropdown containers
TESTING DOCUMENT INCLUDES:
- 10 detailed test scenarios with expected results
- Database verification queries
- Troubleshooting guide
- Edge case handling
- Performance checks
- User acceptance checklist
- Future enhancement suggestions
FILE: SURGERY_PROCEDURE_AUTOCOMPLETE_TESTING.md
Ready for QA testing and user acceptance.