Commit Graph

70 Commits

Author SHA1 Message Date
8bfd11ccda Persist consult NABH fields via remarks fallback 2026-06-05 05:53:24 +05:30
c692340bb2 Store ABDM bundles in health records 2026-06-03 11:05:40 +05:30
510d121478 Normalize OPD preview bundle_type from profile 2026-06-01 14:04:44 +05:30
c68816ce57 Upgrade regenerated OPD bundle_type to OPConsultRecord 2026-06-01 14:02:23 +05:30
6f312dd0d8 Add manual GET wrapper for FHIR regenerate 2026-06-01 14:00:02 +05:30
b0e3459c19 Add ABDM careContexts and OPD visit key 2026-06-01 13:54:56 +05:30
b70e88dd75 Use OPConsultRecord for OPD bundles 2026-06-01 13:31:53 +05:30
33fc87ac88 Fix OPD FHIR submit record reference 2026-06-01 13:29:10 +05:30
9de803ace7 Send ABDM HFR ID only 2026-06-01 13:24:59 +05:30
e8ec06e8f8 Harden ABDM health record push payloads 2026-06-01 13:23:54 +05:30
07ed8ff305 Sanitize OPD FHIR patient name placeholders 2026-06-01 10:57:30 +05:30
23cca1f9ba feat(abdm): proper FHIR bundles for lab reports and IPD discharge
- FhirR4Builder: rewrite buildLabReportBundle() with DiagnosticReportLab
  profile, structured Observation valueQuantity/valueString, reference
  ranges, interpretation codes, Binary+DocumentReference for HTML report,
  Encounter resource, HFR-based bundle identifier system

- FhirR4Builder: rewrite buildDischargeSummaryBundle() with optional
  Practitioner/Organization params, structured ABDM sections (chief
  complaints 422843007, medical history 1003642006, investigations
  721981007, procedures 1003640003, medications 721912009, follow-up
  736271009), HFR-based bundle identifier system

- AbdmGateway: shareIpdDischargeBundle() now builds a real
  DischargeSummaryRecord FHIR bundle and posts via pushRecord()
  (POST /v3/records/push) instead of the stale shareIpdDischargeBundle()

- AbdmGateway: shareDiagnosisReportBundle() now builds a real
  DiagnosticReportRecord FHIR bundle and posts via pushRecord()
  instead of the stale shareDiagnosisReportBundle()

- AbdmGateway: add getHospitalProfileForFhir() and mapLabTypeToTitle()
  helpers; fix pre-existing undefined \ bug in
  getActiveConsentRecord()

- Add ABDM_FHIR reference package, AbdmBridgeLog controller/view,
  bridge record migration, debug scripts and misc UI/settings updates
2026-05-23 04:41:59 +05:30
1b6f2c2db7 feat: Add Submit to ABDM button on FHIR bundle preview
- POST Opd_prescription/fhir_bundle_submit endpoint:
  loads stored FHIR bundle, fetches patient/OPD/doctor context,
  calls EAtriaBridgeConnector::pushRecord to push to bridge
- Standalone preview page (/Opd_prescription/fhir_bundle_preview/N):
  added Submit to ABDM Bridge button with CSRF-safe AJAX + inline
  success/error alert
- FHIR modal in task_board.php: added Submit to ABDM button next
  to Copy JSON; JS reads _fhirOpdId/_fhirSessionId and posts to
  fhir_bundle_submit with CSRF token refresh
2026-05-22 15:54:13 +05:30
0fe556f37e fix: preserve doctor original text in FHIR form; add live complaint/diagnosis terms to preview 2026-05-20 03:14:17 +05:30
78060d03c8 feat: FHIR form view — inline diagnosis SNOMED edit + show doctor's original text 2026-05-20 03:02:03 +05:30
70bc85ae0c fix: restore advice_search() method declaration lost in prior commit 2026-05-20 02:53:48 +05:30
4250000d43 feat: FHIR form view — inline complaint SNOMED edit with live search and save 2026-05-20 02:49:36 +05:30
cd18551ce2 feat: FHIR bundle — use complaint_snomed_json for coded complaints (SNOMED + severity + duration) 2026-05-20 02:08:01 +05:30
32c1dc20e1 feat: Clinical Master workspace — Complaints + Diagnosis edit with SNOMED CT search 2026-05-20 01:25:01 +05:30
e33b0809a0 fix: fhir_bundle_preview returns JSON for AJAX (modal) requests, HTML for direct browser 2026-05-20 00:56:56 +05:30
02ec0034d7 fix: stop injecting Diagnosis SNOMED lines into Prescription textarea — data is in diagnosis_json; strip legacy lines on save 2026-05-19 23:46:44 +05:30
e275a20946 fix: remove JS-style \u00a0 from PHP PCRE duration regex (PCRE2 does not support \u) 2026-05-19 22:38:33 +05:30
b702ff6fdc feat: complaint Extract Codes button with SNOMED chip review panel
- Add 'Extract Codes' button to complaint lookup input
- Parse free-text with duration/severity extraction (regex: 3 days, moderate etc)
- Call Opd_prescription/complaints_extract endpoint -> local SNOMED FULLTEXT
- Render inline chip cards: term, concept_id, duration, severity, confidence%
- Doctor clicks confirm (green tick) or reject (red x) per chip in seconds
- Confirm pre-fills duration+severity in complaint table row automatically
- 'Confirm All' bulk action; Dismiss clears panel
- Add complaints_extract controller method + parseComplaintFreeText helper
- Add route Opd_prescription/complaints_extract
2026-05-19 22:30:23 +05:30
a56e8a5776 feat: SNOMED background coding pipeline + ABDM Coding Panel
- Add opd_coding_queue + opd_snomed_suggestions migrations
- Add ProcessSnomedCoding spark command (cron: snomed:process-coding)
  Extracts clinical phrases, matches local SNOMED FULLTEXT, saves suggestions
- Add AbdmCodingPanel controller: index/review/confirm/reject/correct/mark_fhir_ready/tip_check
- Add coding_panel + coding_panel_review views (Bootstrap 5, AJAX actions)
- Inject queue trigger in opd_prescription_save (fail-open, ON DUPLICATE KEY)
- Add consult form tip badge: polls tip_check 4s after save, shows review link
- Add AbdmCodingPanel routes behind abdm permission filter
- Various ABDM gateway, FHIR, ABHA, SNOMED library updates
2026-05-19 20:40:27 +05:30
0628f8f813 feat: ABDM OPD Queue + ABHA Register flow + patient ABHA search fix
ABDM OPD Queue (today):
- New EAtriaBridgeConnector: opdQueueFetch/opdTokenCreate/opdTokenUpdateStatus + patch() helper
- New AbdmOpdQueue controller: index/list/fetchQueue/createToken/updateTokenStatus/processScannedToken
  - fetchQueue syncs gateway tokens into abdm_opd_tokens (local DB) and enriches with HMS patient data
  - processScannedToken auto-finds/creates patient_master record from ABHA scan data, marks token CALLED
- New migration: abdm_opd_tokens table (gateway_token_id, source, status, patient_id, opd_id, processed_at)
- New view: abdm/opd_queue.php - reception screen with auto-refresh 30s, HMS Patient column (green row when OPD registered)
- Sidebar: ABDM OPD Queue nav link added
- Routes: AbdmOpdQueue with abdmPermFilter

ABHA Register tab (earlier this session):
- New Abha controller: initiate/verifyOtp/communication/verifyCommOtp/validateAbha/card + autoCreateOrFindPatient
- New views: abha/card.php, partials/abha_create_panel.php, partials/abha_otp_modal.php
- Patient_V.php: ABHA Register tab with 4-method wizard (ABHA number, QR scan, facility QR, mobile OTP)

Patient ABHA search fix:
- Patient::search() now detects ABHA column (abha_id/abha_no/abha/abha_address) and searches by it

ABDM Bridge infrastructure:
- EAtriaBridgeConnector: new connector for e-atria.in ABDM bridge gateway
- AbdmConnectorFactory/Interface updated
- AbdmGatewaySettings controller + view
- SNOMED/CSNOTK terminology service skeleton
- Finance payout OPD consult views
- Migration: AddAbdmPushFieldsToOpdAndPatient, CreateSnomedCoreTables
- Docs: abdm/ API specs, architecture, gateway guides
2026-05-16 04:21:31 +05:30
f311d50745 OPD consult: add women history fields, persist in history, update print sections 2026-05-12 12:52:13 +05:30
fbb03a6abb billing: redesign ABHA wizard, enhance patient info panels and consult page photo/layout 2026-05-08 13:29:57 +05:30
07916f3baf Allow same medicine name with different formulation in OPD save 2026-04-17 09:48:30 +05:30
11fe14089d Stop auto-filling prescription remarks from structured allergy fields 2026-04-17 03:50:01 +05:30
ec872c984c Strengthen OPD autocomplete normalization for spacing and punctuation variants 2026-04-17 03:41:01 +05:30
47423a7d38 Normalize OPD autocomplete suggestions and add one-time cleanup command 2026-04-17 03:31:33 +05:30
aae6211f48 Add investigation shortcuts manager panel 2026-04-14 21:51:49 +05:30
0b2ae6ccc1 Broaden consult search candidates for phonetic medicine matches 2026-04-13 13:04:01 +05:30
992fd83ff2 Normalize separator variants in consult medicine SQL search 2026-04-13 12:57:16 +05:30
9e30d69487 Add phonetic matching for consult medicine search 2026-04-13 12:54:33 +05:30
05ff049526 Improve consult medicine search normalization and duplicate blocking 2026-04-13 12:46:42 +05:30
385c977d88 Auto-mark OPD visited on consult save or print 2026-04-10 03:59:10 +05:30
7275d13500 Add OPD keyword manager and caret-aligned autocomplete 2026-04-09 06:25:03 +05:30
418fb3e5e7 Add cached consult autotype suggestions and doctor/master keyword save 2026-04-09 06:07:46 +05:30
b1d329e462 Port legacy OPD autotype suggestions for complaints, provisional diagnosis, and findings 2026-04-09 06:00:29 +05:30
5f35d22f86 Fix medicine search cache key format 2026-04-08 20:06:08 +05:30
2795e6255c Add medicine search DB indexes and prefix query optimization 2026-04-08 19:49:51 +05:30
fad0d89260 Speed up medicine autocomplete with cache and 10-row limit 2026-04-08 19:47:38 +05:30
bca95f14e6 fix: {{medical}} prints Generic Name instead of Substitute in OPD consult print
Root cause: the fallback lookup from opd_med_master used
  $labelField = $masterSaltField ?? $masterGenericField
which preferred salt_name (the Substitute / other brand names field) over
genericname (the actual Generic Name / composition). If a prescription row's
inline genericname was empty, the Substitute string was written into it and
then printed as \"Salt/Generic\" in the {{medical}} block.

Fixes applied in three places:
1. Opd.php buildOpdLetterPrintData - master lookup now prefers genericname
2. Opd.php buildOpdLetterPrintData second loop - removed inline salt_name
   fallback that overwrote genericname with Substitute value
3. Opd.php buildLegacyDashboardTemplateVars - removed salt_name from the
   generic resolution chain used when rendering the medicine table HTML
4. Opd_prescription.php medicine list function - same preferGenericname fix
   and removed inline salt_name -> genericname overwrite"
2026-04-07 11:34:57 +05:30
2958f2e9b6 fix: queue no per-doctor-per-day isolation and stop auto-refresh on digest poll
- Queue No (Opd.php::autoCreateOpdQueue, Opd_prescription.php::opd_prescription_save
  and ::ensurePrescriptionSession): changed MAX(queue_no) query to JOIN through
  opd_master.doc_id instead of trusting opd_prescription.doc_id, ensuring queue
  numbering is strictly per-doctor per-day regardless of stale doc_id values in
  opd_prescription rows.

- OPD appointment list: replaced auto-reload-on-digest-change with a manual
  'Refresh' button. When the 8s digest poll detects new data the button turns
  yellow with a 'New' badge; the page only reloads when the user explicitly clicks
  it, preventing disruptive mid-session reloads."
2026-04-07 11:23:20 +05:30
44cb24c4e1 fix: restore legacy OPD queue workflow 2026-04-06 12:40:34 +05:30
f8cbaacfb0 perf: remove AI enrichment from consult new medicine save flow 2026-04-06 12:20:44 +05:30
2154af394c fix: build Next Visit chips from opd_nextvisit with date from today 2026-04-06 11:45:08 +05:30
f28fcf2717 feat: auto-create new consult medicines in OPD master with AI/local detail enrichment 2026-04-06 11:38:11 +05:30
1843460693 feat: restore Old Prescription panel with add-one/add-all into current consult 2026-04-06 11:24:11 +05:30