Commit Graph

112 Commits

Author SHA1 Message Date
f4891c0bb4 Fix profile master data loading and remove city_auto_u migration 2026-04-01 19:22:03 +05:30
14a5a4e79a Add InvestigationMasterSeeder: 85 lab tests + 15 investigation profiles 2026-04-01 18:52:40 +05:30
94e1253e40 Investigation Profile Master: CRUD and consult integration 2026-04-01 18:44:52 +05:30
d06fe77f03 Investigation Master: use legacy investigation key field 2026-04-01 18:33:20 +05:30
771fa64778 Investigation Master: CRUD, favourites, specialization filter 2026-04-01 18:26:33 +05:30
e27a69df5d OPD/IPD: add dosage defaults to medicine master form; make drug allergy non-mandatory (default: Allergies Not Known) 2026-04-01 18:12:25 +05:30
a5c604b486 Medicine edit: rename Salt Name label to Substitute 2026-04-01 18:01:51 +05:30
c27e44c9b1 Consult: remove Active/Favorites/All scope buttons, always search all medicines 2026-04-01 17:56:22 +05:30
7df04b9ff2 OPD medicine: fuzzy duplicate detection for dosage variants (8MG/8 MG/8) 2026-04-01 17:52:49 +05:30
7ea22378f5 OPD medicine list: move DataTable to server-side ajax 2026-04-01 17:49:02 +05:30
c3bc8f89b8 OPD: simplify medicine list and reuse master dosage defaults 2026-04-01 17:40:50 +05:30
6b2c82e808 Map OPD dose Hindi labels from master tables 2026-04-01 08:46:29 +05:30
a9b5e76fc9 Improve OPD prescription print template variables 2026-04-01 07:58:48 +05:30
fe1156b68a Fix billing invoice balance/payment flow and deduction UI 2026-04-01 07:23:29 +05:30
3088d1fc85 Fix OPD print placeholders for consult fields
- Add fallback key resolution for complaints, diagnosis, provisional diagnosis, and finding examinations
- Expose placeholder aliases for mixed-case and lowercase template variables
- Keep provisional diagnosis precedence over diagnosis when present
2026-03-31 07:20:35 +05:30
af033c24e0 Add temporary debug logging to OPD paper settings save/read flow
Captures:
- Storage key being used
- Payload length
- Which candidate keys are checked
- Persistence verification results

Remove this commit after testing confirms the fix works
2026-03-31 06:55:59 +05:30
edd577e3e7 Fix OPD paper settings save failure: use short hashed keys + legacy fallback
- Shortened template-scoped paper setting keys to avoid s_name length limits in legacy schemas
- Added legacy key fallback so existing saved settings still load
- Updated rename/delete/reset flows to handle both new and legacy key aliases safely
- Restored corrupted buildOpdLetterPrintData method that broke class structure

This fixes the 'Unable to save OPD paper print settings' error when saving new templates
2026-03-31 06:55:06 +05:30
874d5ffba6 feat: add granular template permissions for role-based template access
- add new permissions:
  template.opd_print, template.pathology_print, template.diagnosis_print,
  template.document_print, template.ipd_document
- Template controller now accepts new permission keys (with backward-compatible fallbacks)
- IPD Document Master now has independent permission key (template.ipd_document)
- Template index tile visibility updated to use new granular keys
- OPD print template builder now honors template.opd_print permission
- preserve existing behavior via legacy permission fallbacks to avoid role breakage
2026-03-31 06:35:36 +05:30
3294e39b02 fix: parse and render ECG AI report in structured sections
- add formatEcgReportHtml() for ECG-specific presentation
- extract key ECG metrics (vent rate, PR, P/QRS/T, QT/QTc, axis)
- extract common findings (normal sinus rhythm, left axis deviation, borderline ECG)
- render note separately when present
- add robust fallback splitter for noisy OCR ECG strings without delimiters
- route ECG-like reports through ECG formatter in formatAiReportHtml()
2026-03-31 05:22:41 +05:30
001992b2b5 feat: format AI scan report text in history cards
- add formatAiReportHtml() in opd_prescription_basic to render labeled sections
- auto-format loaded patient scan history reports after AJAX load
- format updated report immediately after Run AI response
- keep raw report text for Use Report action while presenting readable UI blocks
- style history report container as light card for clearer visual structure
2026-03-31 05:18:33 +05:30
f7b9a51c47 fix: sanitize noisy OCR output for OPD scan AI results
- add sanitizeExtractedScanText() to clean OCR text before analysis/storage
- strip non-ASCII/control noise that appears as mixed-script junk characters
- remove repeated junk tokens (e.g. ffffff, repeated words)
- add ECG-specific OCR normalization (KECG->ECG, Uniconfirmed->Unconfirmed, avt->aVL, VT->V1)
- apply sanitization to both OCR sources (document intelligence and vision fallback)
- keep fallback behavior when sanitization returns empty
2026-03-31 05:12:56 +05:30
cf299de505 feat: add Delete button to Rx-Group list
- new rx_group_delete(int rxId) method in Opd_prescription controller
- deletes linked medicines first (opd_prescrption_prescribed_template), then group row
- POST route: Opd_prescription/rx_group_delete/(:num)
- Delete button (red) added to each row in Rx-Group list table
- confirm dialog before delete (shows group name)
- reloads list after delete; clears form if deleted group was loaded
2026-03-31 04:28:18 +05:30
fa599bb6b1 feat: pre-populate Create Rx-Group modal with current consult medicines
- cache session medicine rows in currentSessionMedicineRows on every renderMedicine() call
- when Create Rx-Group modal opens, show all current consult medicines as checkboxes
- all medicines pre-checked by default so they are included in the new Rx-Group
- uncheck any medicine to exclude it from the Rx-Group
- crgcMedicineList built from checked rows; manually added medicines preserved
- medicines listed as chips: Type Name (Dose When Freq) for quick readability
2026-03-31 04:22:46 +05:30
7dc147a397 feat: add medicine entry to Create Rx-Group modal on consult page
- expanded rxGroupCreateModal to modal-xl with two-column layout
- left column: group info (name, complaints, diagnosis, investigation, finding)
- right column: medicine form (name autocomplete, type, dose/when/freq/where, days/qty/remark)
- medicine name search uses medicine_search endpoint with datalist
- type auto-fills on datalist selection (same Chrome input-event fix as main form)
- dose/when/freq/where selects populated from medicineDoseMasterCache (already loaded)
- + Add Medicine adds to local crgcMedicineList array with live table display
- Remove button (x) on each row in the pending medicine table
- Save Rx-Group: creates group then batch-saves all medicines sequentially
- Save & Apply: same as above then applies group to current session
2026-03-31 04:14:30 +05:30
2ae23c0284 feat: add Create Rx-Group button and modal on consult page
- added '+ Rx-Group' button beside Rx Group selector in medicine panel
- added rxGroupCreateModal with Name/Complaints/Diagnosis/Investigation/Finding fields
- pre-fills Complaints and Diagnosis from current consult textarea values
- Save: creates group and refreshes catalog (group appears in selector)
- Save & Apply: creates group and immediately applies it to current session
- error shown inline in modal, catalog reloads after successful create
2026-03-31 04:07:05 +05:30
e167704aed fix: medicine autocomplete shows plain name, type auto-fills on datalist pick
- remove use_count/(0) decoration from datalist option value
- option value is now plain med_name, no star or count suffix
- extract applyMedicineSelection() helper to avoid code duplication
- detect datalist selection inside input callback (Chrome fires input not change)
- type, med-id, favorite button all fill immediately when exact name match found
- change handler simplified: matches against medicineSuggestRows array directly
2026-03-31 03:47:32 +05:30
ad24857720 feat: align consult Rx medicine controls with Rx-Group Add/Edit masters
- consult form medicine Dose/When/Freq changed to dropdowns from dose masters
- added Where dropdown in consult medicine editor and table display
- consult now loads options from Opd_prescription/rx_group_dose_masters
- medicine add/update payload now includes dosage_where
- medicine list now returns dosage_where_label for readable table output
- edit mode supports existing values not present in current master set
- quick chips now map into select options (with safe fallback)
2026-03-31 03:31:26 +05:30
71f24660b0 fix: prevent duplicate Rx-Group edit requests from repeated event binding
- use namespaced delegated handlers in opd_rx_group_workspace
- call off(...namespace...) before on(...) for all click actions
- resolves multiple rx_group_get calls on single Edit click after panel reopen
2026-03-31 03:18:21 +05:30
ab65ba0514 fix: force Browser Mic mode by default for production stability
- default speech mode preference changed to browser
- on consult load, preference is reset to browser and saved
- prevents automatic /stt-proxy calls until server STT is stabilized
- manual mode selector remains available for future server testing
2026-03-30 19:26:30 +05:30
9e91628370 feat: add manual speech mode switch (Auto/Browser/Server)
- Added Mic Mode selector in consult header
- Apply one preference to both Complaints Mic and Med Mic
- Browser mode can be forced to bypass /stt-proxy 400 errors
- Preference persisted in localStorage
- Mode change stops active recordings safely before applying
2026-03-30 19:21:12 +05:30
f82751db27 feat: add browser fallback mode for Med Mic
- Med Mic now supports server mode and browser speech-recognition mode
- auto-select mode from STT server health: server -> browser -> off
- click behavior updated for both modes (start/stop on same button)
- server failure now auto-falls back to browser mode when supported
- Med Mic labels now reflect current mode (server/browser/off)
2026-03-30 19:15:37 +05:30
bfd155510a fix: diagnose and reduce STT 400 errors
- sttProxy now returns detailed upload error info (code, error string, php limits)
- sttProxy accepts fallback upload field name 'file' in addition to 'audio'
- reject empty audio payloads with explicit message
- client: guard against very short/empty blobs before POST to /stt-proxy
2026-03-30 19:12:49 +05:30
311a7bce4b fix: mixed-content block for STT on HTTPS - add server-side proxy
Production runs HTTPS; browser blocks http://139.59.13.39:8000 (mixed content).
Solution: CI4 proxy endpoints forward audio/health check server-side (HTTP→HTTP).

- Home::sttProxy()       POST stt-proxy    - forwards audio to STT server
- Home::sttProxyHealth() GET  stt-proxy/health - pings STT and returns {ok:bool}
- JS: auto-detect window.location.protocol; use proxy URLs on HTTPS,
  direct IP URLs on HTTP (local/dev)
- checkComplaintsSttServer: parse {ok:bool} from proxy health response
2026-03-30 19:03:20 +05:30
e6c9939b09 fix: Med Mic stop button not working - keep btn-medical-stt class on active button
When recording started, setMedicalMicButtonState() removed btn-medical-stt class
from the active button and the click handler (bound to .btn-medical-stt) never
fired on second click, so recording ran forever with no way to stop.
Fix: keep btn-medical-stt class always; only add/remove btn-danger for active state.
2026-03-30 19:01:19 +05:30
7bb539a620 fix: complaints mic - check server STT on init and handle server mode click
- initComplaintsSpeech() now calls checkComplaintsSttServer() async:
  server up → mode 'server', browser fallback → mode 'browser', else 'off'
- click handler now handles both 'server' and 'browser' modes
  (previously only 'browser' was handled, server mode click did nothing)
- show '…' while server health check is in progress to avoid confusion
2026-03-30 18:55:02 +05:30
17e2d8e16b feat: OPD speech-to-text mic, medicine label enhancements & template search
- Add complaints Speech-to-Text (browser + server STT fallback) with interim preview
- Add Medical Mic (server STT) for examination, diagnosis, provisional diagnosis fields
- Add speech-test route + Home::speechTest() view for STT testing
- OPD prescription: resolve dosage/when/frequency labels from lookup tables
- OPD prescription: show generic/salt name below medicine name in print
- OPD prescription: translate complaints/diagnosis/advice/investigation to Hindi for patient
- Add translateToLocalPatientText() helper with English->Hindi medical term map
- Add 'Remove All' medicines button (btn_clear_medicine)
- Add template search box in Load Template modal
- Fix investigation batch add: dedup + guard against concurrent add
- Fix single investigation add: check duplicate before adding
- Fix rx status text overflow: ellipsis + title tooltip
- Remove unused FHIR History and Back to Invoice buttons from Rx header
- .gitignore: exclude public/uploads/* and writable/ayushman/*
2026-03-30 18:46:33 +05:30
8e981cdf15 Fix CURLRequest constants compatibility for AI server calls 2026-03-29 05:11:51 +05:30
b6812f48d1 Stop tracking runtime uploads 2026-03-29 04:22:28 +05:30
d293c261e6 Add configurable footer version setting 2026-03-27 13:38:56 +05:30
b1ba3105c0 Fix AI medicine enrichment fallback and DataTable reinit issues 2026-03-27 04:16:22 +05:30
911e7b50a7 Add Ayushman package import, billing claim sheet, and reporting dashboards 2026-03-26 15:42:40 +05:30
99ec71677a Restore legacy HMS flows and add IPD document master templates 2026-03-24 04:24:19 +05:30
7ee67ff537 Fix collection total query for ONLY_FULL_GROUP_BY 2026-03-22 04:07:16 +05:30
cb2dad8aab Apply Indian date-time format across report tables 2026-03-22 04:03:05 +05:30
50e2a4f145 Enhance report actions with grouped controls and PDF exports 2026-03-22 04:01:06 +05:30
a519525fa3 Fix diagnosis report query for ONLY_FULL_GROUP_BY 2026-03-22 01:16:24 +05:30
ad70bb2b48 Update App baseURL host handling and report view changes 2026-03-22 00:56:28 +05:30
d2400fc5c2 Make complaints master migration idempotent for existing codes 2026-03-21 16:03:12 +05:30
3e810dec74 Harden medical invoice backfill migration for zero-date strict mode 2026-03-21 16:00:41 +05:30
04c35365cb Fix item request SQL function migration for binlog-safe settings 2026-03-21 15:59:22 +05:30