Commit Graph

450 Commits

Author SHA1 Message Date
dec025d6bf ABDM Custom Request: default Expiry Date uses exact +1 year instead of +365 days 2026-07-28 16:57:34 +05:30
7256858562 ABDM Custom Request modal: Purpose as fixed dropdown + add Expiry Date field 2026-07-28 16:54:00 +05:30
25db2e5ddc ABDM OPD tab: replace flow buttons with per-patient Consent Request History list (Phase 3) 2026-07-28 16:42:20 +05:30
48d19f0ff7 ABDM: add manual Consent Request form with editable HI types + date range (Phase 2)
- New Patient::abdm_content_request_custom(int \) endpoint builds a custom
  consent{} block (purpose, hiTypes, permission.dateRange, dataEraseAt) from
  user-submitted hi_types[]/date_from/date_to/purpose form fields, instead of
  always using M3HiuWorkflowService::buildDefaultConsent()'s hardcoded
  OPConsultation+DiagnosticReport / 365-day defaults. Reuses the existing
  requester/hiu-id resolution and hiTypes normalization already built into
  preparePayloadForOperation() for the consent_request operation, so no
  M3HiuWorkflowService changes were needed.
- New route (POST) patient/abdm_content_request_custom/(:num).
- New 'Custom Request' button + '#abdmCustomConsentModal' form
  (Patient_Profile_Opd_V.php) with HI type checkboxes (OPConsultation,
  DiagnosticReport, Prescription, DischargeSummary, HealthDocument,
  ImmunizationRecord, Wellness, Invoice), Valid From/To date inputs
  (defaulted to today-365d..today), and a Purpose text field. On submit,
  reuses the existing auto-flow polling loop (runAutoFlowStep) with the
  returned request_id to track status through to data fetch.
- Live-verified end-to-end on patient 11 (Devender Singh): submitted a
  request for OPConsultation + DiagnosticReport + Prescription; sandbox
  granted only OPConsultation/DiagnosticReport, and the Phase 1 consent
  detail modal correctly showed Prescription as DENIED alongside the two
  GRANTED types, confirming the partial-grant per-HI-type breakdown works
  correctly end-to-end.
2026-07-28 16:23:47 +05:30
7f47045c55 ABDM: add per-HI-type Consent Detail view (Phase 1)
- New Patient::getAbdmConsentArtifactDetail() helper builds a requested-vs-granted
  HI type breakdown for a patient's current ABDM consent artifact, using the
  bridge-team-confirmed 'Option A' model: overall status is single-valued
  (GRANTED/REVOKED/EXPIRED/DENIED), per-type status is derived by comparing the
  requested hiTypes (from the saved consent_request request_json) against the
  granted hi_types array (already flattened onto responses by
  M3HiuGatewayClient). No bridge changes or DB migrations required.
- New Patient::abdm_consent_detail(int \) JSON endpoint + route
  patient/abdm_consent_detail/(:num).
- New 'View Consent' link + Bootstrap modal on the OPD ABDM tab
  (Patient_Profile_Opd_V.php) rendering a lifecycle stepper, consent metadata
  (Consent ID, Purpose, Valid From/To, Erase Date), and a per-HI-type table
  (Document Type / Permission / Status / Timestamp).
- Fixed a bug found during live testing: once a consent reaches COMPLETED
  (after a successful data_fetch), the highest-priority workflow row has no
  hi_types field (it's a FHIR data bundle), which was causing all granted
  types to show as DENIED. Now searches workflow history for the most recent
  row that actually carries the granted hi_types payload.
- Live-verified against patient 15 (Meera Bisht): both requested HI types
  (OPConsultation, DiagnosticReport) correctly show GRANTED with timestamps.
2026-07-28 16:17:10 +05:30
37c3592f69 ABDM: auto-expire stale pending consent requests after 1 hour
Previously, clicking 'Fetch ABDM Records' when a prior consent request was
stuck in REQUESTED/PENDING (no GRANTED/DENIED callback ever received from
the ABDM bridge/PHR - e.g. patient never opened/approved it in their PHR
app) would just resume/re-poll that same dead request indefinitely, since
getLatestAbdmSyncSnapshot() always prioritized the existing REQUESTED
request over starting a new one.

Now:
- getLatestAbdmSyncSnapshot() computes the age of a REQUESTED/PENDING
  snapshot's updated_at and marks restart_required = true once it has
  been pending for more than ABDM_PENDING_STALE_SECONDS (1 hour).
- abdm_content_auto_flow() honors this flag: when the last sync is stale,
  it no longer resumes the old request_id and instead falls through to
  create a brand-new consent_request against the bridge.

Verified locally: a 6h-old stale REQUESTED request for a test ABHA was
correctly abandoned and a fresh consent_request was created and granted
on the next 'Fetch ABDM Records' click, instead of re-polling the dead
request.
2026-07-28 14:36:15 +05:30
becff35929 ABDM OPD tab: fix duplicate fetched-document rows + add dedicated Fetch Records action
- M3HiuDocumentRepository::persistFromDataFetch no longer includes the
  per-call request_id in the document dedup hash. request_id is unique
  every time data_fetch runs, so it was causing a brand-new duplicate
  row to be inserted on every re-fetch of the exact same ABDM document.
  Now dedup key is transaction_id + consent_ref + care_context_reference
  + bundle_id, which stays stable across repeated fetches -> re-fetches
  UPDATE the existing row instead of duplicating it.
- Added Patient::abdm_content_fetch_only() + route
  billing/patient/abdm_content_fetch_only/(id): a lightweight action for
  when consent is already GRANTED/COMPLETED. It calls data_fetch directly
  using the saved consent reference, skipping consent_request + reconcile
  polling entirely, avoiding unnecessary bridge calls/noise.
- Patient_Profile_Opd_V.php: added a 'Fetch Records' button that only
  appears once consent phase is GRANTED or COMPLETED, wired to the new
  endpoint; on success it refreshes the document list in place. The
  original 'Fetch ABDM Records' button still owns the full consent
  request -> reconcile -> fetch flow and already stops/re-enables
  correctly on DENIED/FAILED (verified, no change needed there).
- One-time cleanup: deduped existing abdm_hiu_documents rows in dev DB
  (13 -> 3) and recomputed doc_hash with the new stable key.
2026-07-28 04:34:08 +05:30
a5219bca2d ABDM Gateway settings: add admin UI toggle for SSL certificate verification
Adds a 'Verify SSL Certificate' switch on Admin -> ABDM Gateway page,
persisted as hospital_setting.ABDM_BRIDGE_SSL_VERIFY (default ON/secure).
Wired into M3HiuGatewayClient, EAtriaBridgeConnector, and the settings
page's own Test Connection check. Per-machine ABDM_BRIDGE_SSL_VERIFY env
var still overrides this DB setting for deployments needing a quick
local-only workaround. Verification stays on by default everywhere;
disabling it is an explicit, visible opt-in with an on-page warning.
2026-07-28 03:47:06 +05:30
716ad04d13 Fix duplicate ABDM consent requests: only treat consent_request submission failure as terminal FAILED 2026-07-28 02:36:27 +05:30
acc4e5c287 Prefer recent granted/completed over pending 404 snapshot 2026-07-28 02:28:57 +05:30
5c15424280 Promote granted consent status in snapshot ranking 2026-07-28 02:26:19 +05:30
98b25914d7 Include callback operations in ABDM sync snapshot 2026-07-28 02:15:34 +05:30
71e0c7cf24 Treat transient consent 404 as pending 2026-07-28 02:07:50 +05:30
c2a3e3054f Resolve fallback consent status in OPD flow 2026-07-28 01:53:44 +05:30
a15f5a0785 Handle failed ABDM consent reset and add status help 2026-07-28 01:05:25 +05:30
90831d4b39 Harden ABDM bridge auth flow and sync handling 2026-07-28 00:14:49 +05:30
3b6ed76a3c Reset stale ABDM request flow after bridge 404 2026-07-27 15:21:42 +05:30
0048cb1eff Resume granted consent flow on reconcile 404 and attempt direct fetch 2026-07-27 15:01:36 +05:30
698b9cd520 Prefer granted/completed ABDM state over latest 404 reconcile rows 2026-07-27 14:40:39 +05:30
c77201ec96 Persist and resume ABDM sync state on profile reload 2026-07-27 14:32:47 +05:30
8086bfbeb6 Stop ABDM auto-sync polling on reconcile 404 2026-07-27 14:28:42 +05:30
49698a72d7 Handle ABDM reconcile not-found as pending state 2026-07-27 14:18:07 +05:30
92a954a4cd Fix ABDM HIU auto-flow duplicate consent handling 2026-07-27 14:12:56 +05:30
83c9a9f015 Show actual ABDM bridge messages in ABHA OTP flows 2026-07-25 22:25:31 +05:30
39b5fc7c3e Use opd_no on OPD history header 2026-07-25 21:20:10 +05:30
4e060b9b98 Add patient details to OPD history header 2026-07-25 21:03:06 +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
3bda6f5291 ABDM M2 care-context outbound sync and server cron automation 2026-07-23 15:12:46 +05:30
c84ea383e4 ABDM records/push: treat 201/409 as submitted, persist record IDs, and update OPD UI state 2026-07-21 01:32:30 +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
2bd52532a0 Add ABDM M3 fetch option to Ayushman claim sheet 2026-07-19 01:19:56 +05:30
7a547eb443 Add E-Atria immunization master sync 2026-07-19 01:00:43 +05:30
82fd31d105 Add patient immunization module 2026-07-19 00:41:12 +05:30
629590d9ab ABDM: separate course section and include doctor in discharge FHIR 2026-07-17 18:40:19 +05:30
ca025a088e ABDM: hide empty investigations and standardize discharge headings 2026-07-17 18:33:43 +05:30
d7fe05e6b0 ABDM: enrich discharge FHIR with observations advice and risks 2026-07-17 17:59:54 +05:30
2335006c30 ABDM: enrich IPD discharge FHIR preview with clinical content 2026-07-17 17:48:41 +05:30
3b3e71341d ABDM: persist IPD discharge FHIR to sync outbox 2026-07-17 17:42:17 +05:30
e9b31e8475 Remove duplicate complaint subheading in print output 2026-07-17 17:32:47 +05:30
d6caf13be9 Ensure complaint narrative appears in discharge print output 2026-07-17 17:30:02 +05:30
7c76973ca3 Fix IPD discharge complaint live add/remove and section refresh sync 2026-07-17 17:23:43 +05:30
c4533b0294 Fix discharge print complaints section fallback 2026-07-17 16:42:08 +05:30
2b53c05a68 Add ABDM documents and patient profile sync UI 2026-07-16 18:23:40 +05:30
0e8e164335 Preserve repaired discharge HTML sections in mPDF
Serialize the full repaired body instead of only the temporary wrapper contents so DOMDocument recovery does not drop later discharge sections before mPDF rendering.
2026-07-15 21:16:25 +05:30
8270c8a049 Fix discharge mPDF rendering for malformed HTML
Normalize malformed discharge summary HTML before passing it to mPDF so browser-tolerated markup does not break PDF output.
2026-07-15 21:11:53 +05:30
3801610cdf Add mbstring-safe fallbacks in OPD prescription save 2026-07-10 01:18:34 +05:30
bb5f570ead Return JSON error response for OPD autosave exceptions 2026-07-10 01:11:49 +05:30
6767fce287 Fix OPD prescription autosave 500 on non-string payload values 2026-07-10 01:07:27 +05:30
60d708c7b8 Fix Orgcase table 500 and prevent duplicate DataTable init 2026-07-10 00:34:49 +05:30