Commit Graph

42 Commits

Author SHA1 Message Date
6e78e6010e feat: add Day Care & Emergency admission module with IPD conversion and clean patient names
- Add Day Care (<24h) and Emergency (Casualty) admission pathways with prefixes DC- and ER-
- Add dedicated physical wards, ESI 5-level triage, MLC tracking, and PADSS day care discharge
- Implement audited 'Convert to IPD' workflow with SBAR handover and automated bed transfer
- Support unified IPD billing with dedicated group headers for Day Care and Emergency charges
- Redesign Hospital Admission Desk with executive card layout and modern triage controls
- Add comprehensive user documentation and SVG flowchart in public/help.html
- Completely remove legacy patient_master.p_lname column from database and application code
2026-09-21 23:41:24 +05:30
f2e27828bb fix(abha): make verification match modal aware of unique ABHA ID and dynamic titles 2026-09-12 05:23:33 +05:30
7e3c57f48f fix(patient): enforce unique ABHA ID and Aadhaar number on patient registration and updates 2026-09-12 04:30:10 +05:30
35e1018c6b fix(abdm): prevent modal redirect to profile step on wrong OTP verification 2026-09-12 01:48:33 +05:30
7c573403b2 fix(abdm): isolate Aadhaar mobile from ABHA registered mobile and sanitize asterisk placeholders in verification flow 2026-09-12 00:35:51 +05:30
fd492a2aa2 feat(abdm-m1): implement Create / Find ABHA Record wizard aligned with ABDM M1 specifications
- Reorder and streamline wizard into 5 steps (Aadhaar, Aadhaar OTP, Mobile OTP, ABHA Address, Profile & Card)
- Add Aadhaar vs Communication mobile matching to skip or mandate mobile OTP (CRT_ABHA_108 vs CRT_ABHA_109)
- Enforce full consent declarations with master 'I Agree' checkbox and step validation (CRT_ABHA_102)
- Enforce UIDAI Verhoeff algorithm pre-validation and normalize upstream loginId errors (CRT_ABHA_104 / VRFY_ABHA_403)
- Enforce ABHA address validation policy: 8-18 chars, dot/underscore in between only, duplicate detection (CRT_ABHA_112)
- Enforce 60s timer and maximum 2 resend attempts on both OTP verification steps (CRT_ABHA_106)
- Support instant jump to profile & card for existing accounts with 'ABHA Already Exist' notice (VRFY_ABHA_404)
- Update Patient Management and Profile view buttons to 'Create / Find ABHA Record'
2026-09-11 22:11:17 +05:30
9176877d07 feat(abdm): implement M1 find ABHA by mobile flow & M2 user-initiated linking
- M1: Update Find ABHA via Mobile to compliance flow: Mobile Number -> Profiles -> OTP -> Complete Profile Fetched
- M2: Support walk-in non-ABHA patient discovery via demographic matching (verified mobile, gender, year of birth, name)
- M2: Implement care context linking endpoints (/records/link/init and /records/link/confirm) with OTP verification
- Add abdm_link_transactions database migration
- Support Bearer token and HMAC signature authentication for bridge callbacks over VPN
2026-09-09 17:52:20 +05:30
df835008d5 Fix ABDM M1 multi-ABHA account selection payload compatibility and fallback handling 2026-09-03 20:13:46 +05:30
156d12adba Implement ABDM M1 multi-ABHA account selection for Mobile OTP login flow 2026-09-03 16:17:46 +05:30
a7727c9d9e fix(abdm): correct mobile ABHA discovery flow
Route Find ABHA via Mobile through standalone bridge OTP endpoints and remove exact placeholder values from generated FHIR bundles.
2026-08-24 23:19:21 +05:30
7ae9a77d29 fix(abdm): save enrolment mobile on ABHA-created patients
ABDM does not echo the alternate mobile in aadhaar/verify-otp, so patients created from that response were saved without a phone number. Fall back to the enrolment mobile ABDM accepted, flag its origin via mobile_source, and state the origin in the wizard.
2026-08-18 02:51:14 +05:30
8be64239d5 fix(abdm): stop ABHA flow after Aadhaar-created account
ABDM v3 creates the ABHA inside aadhaar/verify-otp when an alternate mobile is supplied. HMS then ran a standalone mobile OTP login, which returned whichever ABHA owned that number (e.g. the parent's) and overwrote the child's record. Skip that step when an ABHA number is returned and show the operator an explicit alternate-mobile status instead.
2026-08-18 02:31:44 +05:30
841b15d27b fix(abdm): bind alternate mobile to enrolment
Use the dedicated Bridge enrolment-mobile OTP endpoints for child/dependent ABHA creation and reject any alternate-mobile response whose ABHA differs from the Aadhaar-verified identity.
2026-08-18 02:13:47 +05:30
c8f44e4493 fix(abdm): complete ABHA creation workflow
Split official and hospital ABHA cards, preserve profile/photo updates, improve existing-patient matching, require and forward communication mobile data, and show accurate Bridge OTP status and errors.
2026-08-17 06:43:37 +05:30
b25ab98fd7 Fetch official ABHA card and surface bridge card provenance 2026-08-15 03:16:25 +05:30
a55c6899f0 Fix ABHA create profile card and photo handling 2026-08-14 04:10:55 +05:30
52dc9fb5fd Read top-level gateway_patient and card fields 2026-08-14 00:33:17 +05:30
6a6895ce35 Add ABHA QR scan registration flow 2026-08-13 19:51:14 +05:30
7cb57b5b28 Match ABHA patients by exact identifier or demographics 2026-08-13 19:23:46 +05:30
bc5fdb8c63 Fix ABHA patient matching for DD-MM-YYYY dates 2026-08-13 19:14:00 +05:30
167a68362a Distinguish official ABHA card from generated fallback 2026-08-13 19:05:36 +05:30
1f4e8fa0cd Send patient X-Token when fetching ABHA card 2026-08-13 18:36:25 +05:30
22e960a834 Detect ABDM Bridge test-mode address responses 2026-08-13 18:13:12 +05:30
d0a0bf984e Fix ABHA card fetch and address suggestions 2026-08-13 17:41:31 +05:30
3e70ff8c4a Redesign ABHA Aadhaar creation flow 2026-08-13 17:11:48 +05:30
73ad7ef11f Store ABHA card and improve patient comparison 2026-08-13 11:30:02 +05:30
6a670d4c48 Refine ABHA patient matching criteria 2026-08-13 11:21:38 +05:30
48d6073a37 Fix false ABHA candidate name matches 2026-08-13 11:15:53 +05:30
fe9f46cb65 Consume enriched ABHA gateway response 2026-08-13 11:03:53 +05:30
c698d5df32 Preserve complete ABHA verification profile 2026-08-13 10:57:38 +05:30
a5447cb83a Complete ABHA account verification flow 2026-08-13 10:36:20 +05:30
ee9bb7b560 Fix ABHA card barcode print rendering 2026-08-01 03:57:43 +05:30
55bcaa7d09 Fix ABDM M3 HIU multi-facility consent session grouping and document display
- Fix groupWorkflowRowsIntoSessions() to correlate workflow rows by stable
  request_id/abdm_consent_request_id instead of chronological proximity to
  the newest CONSENT_REQUEST row. Background polling reconciles all
  historical sessions in one batch, so older sessions' rows previously got
  silently merged into the newest session, causing 'Show Data' to display
  an unrelated older session's single facility instead of all consented
  facilities.
- Skip synthetic orphan sessions (stray rows with no owning CONSENT_REQUEST)
  in getAbdmConsentRequestsList()/getAbdmConsentArtifactDetail() so they
  don't show as phantom history rows or get picked as 'most recent'.
- Fix abdm_documents() consent_request_id filter to match all known sibling
  artifact IDs for a session (via abdm_hiu_consent_artifacts), not just an
  exact single artifact id, so all facilities under one consent request
  appear together.
- Fix CreateAbdmHiuConsentArtifacts migration: reduce VARCHAR(180) to
  VARCHAR(100) on consent_request_id/artifact_id to satisfy MySQL's
  1000-byte composite key length limit (was silently failing to migrate).
- Add fetchAllArtifactsAfterGrant() cascade in M3HiuWorkflowService to fetch
  every known artifact under a granted consent, used by both the cron poll
  and a new abdm_check_live_status() endpoint/button.
- getLatestAbdmSyncSnapshot() session-scoping fix to avoid an older granted
  session masking a newer in-progress one.
- Relabel Dr. Joshi Clinic documents (previously mislabeled 'Test Hospital'
  from the HIP's own FHIR bundle Organization name).
2026-07-30 05:08:44 +05:30
82b7b27273 fix(abha): persist OTP-verified mobile number when bridge response omits it
Abha::verifyOtp() and Abha::verifyCommOtp() were overwriting the
user-typed, OTP-verified mobile number with whatever the ABDM bridge's
verify-otp response echoed back for 'mobile'. Many bridge responses
(especially plain mobile-OTP verification, as opposed to Aadhaar eKYC)
do not echo the mobile at all, so it silently became empty and was
never saved to patient_master.mphone1 during ABHA Register (By ABHA
Number / QR / Facility QR / Mobile OTP) or ABHA Create/Verify.

Fix: fall back to the originally submitted/verified mobile when the
gateway response omits it. Also updated Patient_V.php JS (Verify ABHA
tab, ABHA Register Method 1 and Method 4) to resend the mobile number
along with the verify_comm_otp call so the server has it available.

Address/email are unaffected by this bug: those fields are already
mapped via applyAbhaMetaColumns() when present, but the ABDM mobile-OTP
verification API generally doesn't return KYC demographic data (that
only comes from the Aadhaar-eKYC flow) - so they may legitimately
stay blank for phone-based registration methods.
2026-07-29 13:52:07 +05:30
90831d4b39 Harden ABDM bridge auth flow and sync handling 2026-07-28 00:14:49 +05:30
83c9a9f015 Show actual ABDM bridge messages in ABHA OTP flows 2026-07-25 22:25:31 +05:30
3de17d955d ABHA card: remove official/bridge actions and improve local card data 2026-07-23 16:22:43 +05:30
e89e186281 ABHA: fetch official card via bridge API and print base64 card 2026-07-23 16:10:34 +05:30
5d6acdd480 Implement ABDM bridge health record flows
- add facility QR support and OPD queue bridge fixes
- support care-context push warnings for lab, radiology, IPD and remaining HI types
- improve ABHA patient matching and diagnosis autocomplete performance
- clean up webcam streams on page navigation
2026-07-20 03:02:09 +05:30
985d476bc1 ABDM: finalize ABHA verify persistence, M2 routes/workflows, and location masters seeding 2026-06-24 03:15:22 +05:30
96c030b72d chore: checkpoint before discharge history panel refactor 2026-06-22 02:05:24 +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