From 89c150324fe1a45abcf788ce6738cfc42a32f42d Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sun, 7 Jun 2026 08:24:38 +0530 Subject: [PATCH] Add refresh parameter to force regenerate cached discharge content in PDF 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" --- app/Controllers/Ipd_discharge.php | 5 +- pdf_test_html.html | 4298 +---------------------------- 2 files changed, 61 insertions(+), 4242 deletions(-) diff --git a/app/Controllers/Ipd_discharge.php b/app/Controllers/Ipd_discharge.php index f0c5505..18bc29d 100644 --- a/app/Controllers/Ipd_discharge.php +++ b/app/Controllers/Ipd_discharge.php @@ -5901,8 +5901,11 @@ class Ipd_discharge extends BaseController return $this->response->setStatusCode(404)->setBody('IPD not found'); } + // Check if user wants to force regenerate content (ignoring cache) + $forceRegenerate = (int) ($this->request->getGet('refresh') ?? 0) === 1; + $content = $this->getDischargeContent($ipdId); - if (trim(strip_tags($content)) === '') { + if ($forceRegenerate || trim(strip_tags($content)) === '') { $content = $this->buildAutoDischargeContent($ipdId, $panelData); if (trim(strip_tags($content)) !== '') { $this->saveDischargeContent($ipdId, $content); diff --git a/pdf_test_html.html b/pdf_test_html.html index b03f7f7..3f1e848 100644 --- a/pdf_test_html.html +++ b/pdf_test_html.html @@ -1,4255 +1,71 @@ - - - -
-
- Name : KAMLA SINGH - / Gender : Female - / Age : 26 Year - / UHID / Patient Code : P26051000001 - / IPD ID : A26050000001 -
- -
- -
- -
-
- -
- - -
-
- -
-
Personal History
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- -
-
-
- -
-
- From Nursing History & Physical Assessment - No Nursing H&P prefill found -
-
-
-
- - -
- -
- - -
-
- - -
-
- - -
-
- - -
-
-
- -
-
-
- -
-
Complaints with Duration and Reason for Admission
-
- - - - - - - - - - - - - - - - - - - - - - - - -
#ComplaintFrequencySeverityDuration
- - - - -
- - - - - - - - - -
- -
- - -
- - -
-
Pain Measurement Scale
- -
- - - - - -
-
- -
-
-
-
Drug Allergy / ADR (NABH)
-
-
- - - -
-
- - - -
-
- - -
-
- - -
-
-
-
-
-
-
Co-Morbidities
-
- - - - - -
-
- - -
- -
-
-
- -
- - -
- -
- -
-
-
- -
-
Examination on Admission
-
-
General Examination
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
-
-
- -
-
Other / Systemic Examinations
-
- - -
-
- -
-
-
- -
-
Clinical Investigation Reports
-
-
-
- Clinical Investigation (In-Hospital Lab) - Blood Hb, Blood Sugar, Renal Function, Serum Bilirubin, Urine Test -
-
-
- - -
-
-
- -
-
- Clinical Investigation (X-Ray / ECG / Sonography / CT / MRI) - Select finalized impression-based reports during this admission -
-
-
No non-pathology impression reports found between admission and discharge dates.
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
- - -
- - - - -
- -
-
-
-
-
Admission / Discharge Information
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
- -
-
- Surgery / Procedure / delivery if any - -
-
-
Surgery
- - - - - - - - - - -
NameDateRemarkAction
LML2026-06-04
- - -
-
-
-
-
-
- - -
Procedure
- - - - - - - - - - -
NameDateRemarkAction
Procedure TEST2026-06-03
- - -
-
-
-
-
-
- -
-
-
- -
-
- Final Diagnosis - -
-
- - - - - -
DiagnosisRemarkAction
No diagnosis rows.
- -
-
-
-
-
- - Tip: if ICD match exists, selected value appends code in diagnosis text. -
- -
- - -
- -
- -
-
-
- -
-
Summary of key investigation during Hospitalization
-
- -
- -
-
-
- -
-
Course / Treatment in the hospital
-
- - - - - -
CourseRemarkAction
No course rows.
- -
-
-
-
-
- -
- -
- - -
- -
- -
-
-
- -
-
Condition at the time of Discharge
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
- -
-
Discharge Medicine Prescribed
-
- - - - -
-
- - No Rx-Group selected -
-
Select group and preview medicines before add.
-
- - - - - - -
MedicineTypeDoseWhenFreqDaysQtyRemarkAction
No medicine added
- - -
-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - - - - - - - - -
- - - - - - - - - - - - - - - -
-
-
- - - -
-
- Discharge Instructions / Advice - -
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- - -
-
- -
-
-
Selected Dietary Advice (Hindi print preview)
-
No dietary advice selected.
-
-
- -
- - -
- -
- - -
-
- - -
-
- -
-
-
- -
-
-
-
-
- - - - - - - - - - - - -
+ p { + text-indent: -25px; + }

Discharge Summary


NameKAMLA SINGHUHIDP26051000001
Age & Gender26 Year / FemaleIPD No.A26050000001
GuardianW/O of RAM SINGHAdmission23-05-2026
Phone No.9720958717Discharge05-06-2026
AddressKASHIPUROrg. NameDirect
DepartmentCardiology


+
+Surgery :
Laparocopy

+

 
+Procedure :
Procedure TEST    / Date of Procedure : 2026-06-03

 
+Presenting Complaints and Reason for Admission :
Acute rheumatic fever with acute arthritis
Able to cough

 
+Pain Measurement Scale: Mild Pain (1) +


+ 
+ 
+ 
+
+

Clinical Investigation Reports

In-Hospital Lab:
TestFixed Normals31-05-2026
Eosinophils30
Hemoglobin11
Total Leukocyte Count10
Neutrophils10
Lymphocytes10
Monocytes10
Red Blood Cells10
Packed Cell Volume10
Mean Corpuscular Volume10
Mean Corpuscular Hemoglobin10
Mean Corpuscular Hemoglobin Concentration1
Platelet Count010
+
 
+ 
+Examination on Discharge : Pulse /min :80/min   Respiration /min :30/min   BP mmHg :80/120mmHg   SPO2 :95

+

 
+

Discharge Medications

#MedicineQtyDaysNotes
1Capsule Aciloc1 day
2Capsule Aciloc1
3Capsule Aciloc1 day
4Capsule Aciloc1

+Dietary Advice:
  1. Use appropriate medicine as Prescribed.: निर्धारित अनुसार उचित दवा का उपयोग करें।
  2. Fruits and Vegetables: पर्याप्त विटामिन और खनिज सुनिश्चित करने के लिए प्रतिदिन विभिन्न प्रकार के ताजे फल और सब्जियों का सेवन करें।
  3. Special Considerations: यदि आपको मधुमेह, उच्च रक्तचाप या किडनी संबंधी समस्या जैसी कोई विशेष समस्या है, तो अपने स्वास्थ्य सेवा प्रदाता द्वारा बताए गए आहार प्रतिबंधों का पालन करें। सर्जरी के बाद ठीक होने के लिए, उपचार को बढ़ावा देने के लिए अंडे, दाल और डेयरी उत्पादों जैसे प्रोटीन युक्त खाद्य पदार्थों को शामिल करें।
+ 
+

Discharge Advice/Instructions/Summary


+

Discharge Summary

Date of Discharge: 2026-06-05
+


+

\ No newline at end of file
   
___________________________________________________________________________
Signature of Consultant