From 9665e820ecd0cc06bb556c3388426880cc816d72 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sat, 29 Aug 2026 03:02:12 +0530 Subject: [PATCH] feat(doctor): copy full native HMS OPD consultation controls, vitals, findings, and direct PDF printing --- app/Controllers/Api/v1/DoctorApi.php | 6 ++ public/App/Doctor/index.html | 94 ++++++++++++++-------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/app/Controllers/Api/v1/DoctorApi.php b/app/Controllers/Api/v1/DoctorApi.php index cece970..012914a 100644 --- a/app/Controllers/Api/v1/DoctorApi.php +++ b/app/Controllers/Api/v1/DoctorApi.php @@ -294,9 +294,12 @@ class DoctorApi extends BaseController if (! empty($prescRow)) { $prescRow['chief_complaints'] = $prescRow['complaints'] ?? ''; + $prescRow['finding_examinations'] = $prescRow['Finding_Examinations'] ?? ''; $prescRow['provisional_diagnosis'] = $prescRow['diagnosis'] ?? $prescRow['Provisional_diagnosis'] ?? ''; $prescRow['bp_systolic'] = $prescRow['bp'] ?? ''; $prescRow['bp_diastolic'] = $prescRow['diastolic'] ?? ''; + $prescRow['height'] = $prescRow['height'] ?? ''; + $prescRow['rr_min'] = $prescRow['rr_min'] ?? ''; } return $this->response->setJSON([ @@ -343,7 +346,10 @@ class DoctorApi extends BaseController 'diastolic' => trim((string) ($post['bp_diastolic'] ?? '')), 'spo2' => trim((string) ($post['spo2'] ?? '')), 'weight' => trim((string) ($post['weight'] ?? '')), + 'height' => trim((string) ($post['height'] ?? '')), + 'rr_min' => trim((string) ($post['rr_min'] ?? '')), 'complaints' => trim((string) ($post['chief_complaints'] ?? '')), + 'Finding_Examinations' => trim((string) ($post['finding_examinations'] ?? '')), 'diagnosis' => trim((string) ($post['provisional_diagnosis'] ?? '')), 'advice' => trim((string) ($post['advice'] ?? '')), 'investigation' => trim((string) ($post['investigation'] ?? '')), diff --git a/public/App/Doctor/index.html b/public/App/Doctor/index.html index 2e7944d..83678ab 100644 --- a/public/App/Doctor/index.html +++ b/public/App/Doctor/index.html @@ -136,7 +136,6 @@ // Active Workspace state const [activePatient, setActivePatient] = useState(null); const [activeOpd, setActiveOpd] = useState(null); - const [hmsConsultModalOpen, setHmsConsultModalOpen] = useState(false); const [workspaceData, setWorkspaceData] = useState([]); const [emrTab, setEmrTab] = useState('vitals'); const [installPrompt, setInstallPrompt] = useState(null); @@ -150,9 +149,10 @@ const [newPin, setNewPin] = useState(''); const [confirmPin, setConfirmPin] = useState(''); - // OPD Prescription Form State + // OPD Prescription Consultation Controls State (Full Copy of HMS Functionality) const [prescForm, setPrescForm] = useState({ chief_complaints: '', + finding_examinations: '', provisional_diagnosis: '', investigation: '', advice: '', @@ -162,7 +162,9 @@ bp_systolic: '', bp_diastolic: '', spo2: '', - weight: '' + weight: '', + height: '', + rr_min: '' }); // Medicines Repeater Array @@ -171,10 +173,11 @@ ]); // Quick Chips presets for Mobile Typing - const COMPLAINT_CHIPS = ['Fever', 'Cough', 'Swelling', 'Joint Pain', 'Headache', 'Back Ache', 'Nausea / Vomiting', 'Weakness']; - const DIAGNOSIS_CHIPS = ['Acute Rheumatic Fever', 'Viral Infection', 'Hypertension', 'Type 2 Diabetes', 'GERD', 'Bronchitis', 'Osteoarthritis']; + const COMPLAINT_CHIPS = ['Fever', 'Cough', 'Swelling', 'Joint Pain', 'Headache', 'Back Ache', 'Nausea / Vomiting', 'Weakness', 'Chest Pain', 'Shortness of Breath']; + const EXAMINATION_CHIPS = ['Pallor (+)', 'Icterus (-)', 'Cyanosis (-)', 'Clubbing (-)', 'Edema (-)', 'B/L Chest Clear', 'S1 S2 Heard']; + const DIAGNOSIS_CHIPS = ['Acute Rheumatic Fever', 'Viral Infection', 'Essential Hypertension', 'Type 2 Diabetes Mellitus', 'GERD', 'Acute Bronchitis', 'Osteoarthritis']; const DRUG_CHIPS = ['Paracetamol 500mg', 'Amoxicillin 500mg', 'Pantoprazole 40mg', 'Cetirizine 10mg', 'Ibuprofen 400mg', 'Azithromycin 500mg', 'Multivitamin']; - const LAB_CHIPS = ['CBC', 'Serum Creatinine', 'LFT', 'KFT', 'Chest X-Ray PA', 'ECG', 'Urine RE']; + const LAB_CHIPS = ['CBC', 'Serum Creatinine', 'LFT', 'KFT', 'Chest X-Ray PA', 'ECG', 'Urine RE', 'HbA1c', 'USG Abdomen']; const fetchDoctors = async () => { try { @@ -349,6 +352,7 @@ const pr = json.prescription; setPrescForm({ chief_complaints: pr.chief_complaints || pr.complaints || '', + finding_examinations: pr.finding_examinations || pr.Finding_Examinations || '', provisional_diagnosis: pr.provisional_diagnosis || pr.diagnosis || '', investigation: pr.investigation || '', advice: pr.advice || '', @@ -358,7 +362,9 @@ bp_systolic: pr.bp || '', bp_diastolic: pr.diastolic || '', spo2: pr.spo2 || '', - weight: pr.weight || '' + weight: pr.weight || '', + height: pr.height || '', + rr_min: pr.rr_min || '' }); if (json.medicines && json.medicines.length > 0) { setMedicines(json.medicines); @@ -372,8 +378,8 @@ } } else { setPrescForm({ - chief_complaints: '', provisional_diagnosis: '', investigation: '', advice: '', next_visit: '', - temp: '', pulse: '', bp_systolic: '', bp_diastolic: '', spo2: '', weight: '' + chief_complaints: '', finding_examinations: '', provisional_diagnosis: '', investigation: '', advice: '', next_visit: '', + temp: '', pulse: '', bp_systolic: '', bp_diastolic: '', spo2: '', weight: '', height: '', rr_min: '' }); setMedicines([{ drug_name: '', dosage: '1 Tab', frequency: '1-0-1', duration: '5 Days', instructions: 'After Food' }]); } @@ -681,7 +687,7 @@ ) : activeOpd ? ( /* ------------------------------------------------------------- - OPD CONSULTATION & PRESCRIPTION FORM + OPD CONSULTATION & PRESCRIPTION FORM (NATIVE CONTROLS COPY) ------------------------------------------------------------- */
@@ -689,11 +695,11 @@ Back to Appointments
-
@@ -713,9 +719,9 @@
- {/* Vitals Entry Bar */} + {/* Vitals Entry Bar (Native HMS Controls) */}
-
Patient Vitals
+
Patient Vitals (BP, Pulse, Temp, SpO2, Weight)
@@ -733,14 +739,18 @@ setPrescForm({...prescForm, spo2: e.target.value})} />
-
+
setPrescForm({...prescForm, temp: e.target.value})} />
-
+
setPrescForm({...prescForm, weight: e.target.value})} />
+
+ + setPrescForm({...prescForm, height: e.target.value})} /> +
@@ -755,6 +765,17 @@
+ {/* Clinical Examination & Findings */} +
+ +
+ {EXAMINATION_CHIPS.map(e => ( + + ))} +
+ +
+ {/* Provisional Diagnosis */}
@@ -766,7 +787,7 @@
- {/* Medicines Rx Repeater (Mobile Friendly) */} + {/* Medicines Rx Repeater (Native HMS Controls) */}
@@ -820,7 +841,7 @@ {/* Lab Investigations & Advice */}
- +
{LAB_CHIPS.map(lab => ( @@ -840,35 +861,16 @@ setPrescForm({...prescForm, next_visit: e.target.value})} />
- -
- ) : null} - - {/* FULL HMS CONSULTATION FORM MODAL (100% IDENTICAL TO HMS SCREEN) */} - {hmsConsultModalOpen && activeOpd && ( -
-
-
-
-
- - Official HMS OPD Consult Form - {activeOpd.patient_display_name} ({activeOpd.opd_code}) -
- -
-
-