Project

General

Profile

Actions

Bug #657

closed
MN RH

Walk-in visit has to pay, follow up doesn't need to pay

Bug #657: Walk-in visit has to pay, follow up doesn't need to pay

Added by Medha N. 15 days ago. Updated 8 days ago.

Status:
Closed
Priority:
High
Target version:
Start date:
10/28/2026
Due date:
% Done:

0%

Estimated time:
Resolved By:

Description

Module: OPD → Patient Registration
Environment: Test, NSSH (https://nssh.test.clinq.health/opd/register)
Severity: High, because it causes revenue leakage
Priority: P1

Description
When a returning patient is registered with Visit type Walk-in and their previous visit was within 3 days, the system waives the consultation fee. The 3-day free window should only apply to Follow-up visits. Every walk-in visit should be charged, however recent the last visit was.

Steps to reproduce

Register patient A as a Walk-in under a department and doctor. The fee is charged (Registration ₹200 + Consultation ₹300 = ₹500).
Within 3 days, register patient A again under the same department and doctor.
Set Visit type to Walk-in.
Look at the Payment section and the generated bill.

Expected result

The consultation fee (₹300) is charged for the Walk-in visit.
The free-visit rule applies only when Visit type = Follow-up and the visit is within the 3-day window.

Actual result
The consultation fee is waived (₹0) for the Walk-in visit because the previous visit was within 3 days.

Business rule

Visit type Within 3 days of last visit After 3 days
Walk-in Charged Charged
Follow-up Free Charged
Emergency / Referral Charged (to confirm) Charged

Suspected cause
The free-window check probably looks only at the last visit date and ignores visit type. It needs a visitType == FOLLOW_UP condition. Check the fee logic in both the registration UI and the backend billing service, so a direct API call can’t bypass it.

RH Updated by Roshni Harish. 15 days ago Actions #1

  • Subject changed from Walk-in visits within 3 days are not charged to Walk-in visit gets a free consultation when the patient returns within 3 days
  • Description updated (diff)
  • Assignee set to Arya M.

AM Updated by Arya M. 11 days ago Actions #2

  • Assignee changed from Arya M. to Fiza M.

FM Updated by Fiza M. 11 days ago Actions #3

  • Status changed from New to Resolved
  • Assignee changed from Fiza M. to Navya P.
  • Resolved By set to Fiza M.

The rule changed from the table in this ticket. Free consultation is now a per-hospital setting, not a visit-type rule, as confirmed by Fiza:

  • VVMC: free for 3 days after a paid consultation, for any visit type.
  • NSS, and any hospital with no value set: every visit is charged, including Follow-ups.

Where to set it: Admin > Hospital Settings > "Free consultation days". 0 or blank charges every visit.

Not on the test environment yet. This needs the OPD fix (bugfix/redmine-657-walkin-free-revisit, commit b6d11c6b) and the Admin card (bugfix/redmine-657-free-revisit-setting, commit 33f90aee) merged and deployed. The OPD commit is not pushed yet. Do not test or merge from e6763abb on the remote OPD branch, as that was an earlier design and is reverted.

How to test once deployed:

  1. NSS: register a returning patient as Walk-in. Consultation is ₹300. Check Follow-up, Emergency and Referral too: all ₹300.
  2. Set a hospital to 3 days. Bill a paid consultation, then register the same patient again: ₹0, button says "Register (No Charge)", discount reason "Free revisit (within 3 days)".
  3. After the window ends, the patient is charged again. A free visit does not restart the window.

A patient can only have one active visit a day, so end the first visit before registering again. Skip it rather than cancelling, because cancelling voids the bill.

Needed at release:

  • Set VVMC to 3. Without this VVMC starts charging every visit. Any other hospital that should keep free days also needs a value.
  • Check that billing migrations 20261028070630_AddBillRefundedAmount and 20261028161330_AddPaymentLastStatusCheckedAt are applied. They were missing on the shared dev DB and bills failed without them.

Verified on local dev (hospital CL-MAIN): repeat Walk-in at 0 days billed ₹300 (BILL-3-00137). At 3 days billed ₹0 with the reason above (BILL-3-00138). Manually checked by Fiza. Not yet tested on the test environment or at VVMC itself.

RH Updated by Roshni Harish. 11 days ago Actions #4

  • Assignee changed from Navya P. to Dilbar S.

FM Updated by Fiza M. 11 days ago Actions #5

Update: the OPD and Admin changes are now merged to dev (a24985e9, be7bc83a). Still needs deploying to the test environment before testing. The release steps above still apply.

MN Updated by Medha N. 11 days ago Actions #6

  • Subject changed from Walk-in visit gets a free consultation when the patient returns within 3 days to Walk-in visit has to pay, follow up doesn't need to pay

FM Updated by Fiza M. 11 days ago Actions #7

  • Status changed from Resolved to In Progress
  • Assignee changed from Dilbar S. to Fiza M.

FM Updated by Fiza M. 10 days ago Actions #8

  • Status changed from In Progress to Resolved
  • Assignee changed from Fiza M. to Navya P.

This replaces the NSS rule in my earlier comment. NSS no longer charges every visit: Follow-up is free within 3 days, and the other visit types are charged.

What changed: each hospital's admin now chooses which visit types get the free days. Go to Admin > Hospital Settings > "Free for these visit types", below "Free consultation days".

Hospital setup Walk-in, Emergency, Referral, Appointment Follow-up
3 days, only Follow-up ticked (NSS) Charged Free within 3 days, then charged
3 days, all types ticked (VVMC) Free within 3 days Free within 3 days
0 days or not set Charged Charged

A follow-up booked as an appointment counts as Follow-up. The desk has no option to change this per patient.

Status: merged to dev (OPD 01110fc1, Admin f286be7e). Automated tests cover the rule. Not yet tested on the test environment, and it needs deploying there first.

How to test once deployed:

  1. On NSS, set 3 days and tick only Follow-up.
  2. Bill and pay a consultation for a patient, then end that visit. Skip it rather than cancelling, because cancelling voids the bill.
  3. Within 3 days, register the same patient as Walk-in: consultation is ₹300.
  4. Switch the visit type to Follow-up: the fee changes to ₹0 and the button says "Register (No Charge)". Register and confirm the bill is ₹0.
  5. Check Emergency and Referral: both ₹300.
  6. After the 3 days, Follow-up is ₹300. A free visit does not restart the window.
  7. Set the days to 0: Follow-up is ₹300.

Needed at release:

  • NSS: set 3 days and tick only Follow-up. It charges every visit until this is set.
  • VVMC: set 3 days and leave all types ticked. Without the days, VVMC charges every visit.
  • Any other hospital that gives free days needs its own values.

AM Updated by Arya M. 10 days ago Actions #9

  • Target version set to Sprint 1

FM Updated by Fiza M. 10 days ago Actions #10

  • Assignee changed from Navya P. to Roshni Harish.

RH Updated by Roshni Harish. 8 days ago Actions #11

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom