Practitioner Deactivate and Bulk Delete - hmislk/hmis GitHub Wiki
Practitioner — Deactivate and Bulk Delete
HMIS does not delete practitioner records permanently when you press Delete. Instead, every "delete" action is a soft delete — the record is flagged as retired and hidden from active lists, but kept in the database so that historical bills, sessions, audit trails, and reports continue to display correctly. This article describes how to retire one practitioner, how to retire many at once, what happens behind the scenes, and how to restore.
Soft delete in plain English
When you click Delete on a doctor, consultant, or staff record:
- The system sets
retired = trueon the record. - It captures the user who clicked Delete (
retirer) and the timestamp (retiredAt). - The record disappears from every active list: Staff List, Doctors (Excluding / Including Consultants), Consultant, Other Staff, autocomplete dropdowns, channel booking screens, etc.
- Historical bills, sessions, payments, leaves, and audit entries that reference the retired record continue to display the correct name and details — nothing is lost.
This means retiring a practitioner is reversible at the database level (an administrator can clear the retired flag), and it never breaks past records.
Retiring a single doctor
- Open Manage Staff → Doctors (Excluding Consultants) (or Doctors (Including Consultants) if the doctor is a consultant).
- Select the doctor in the listbox.
- Click the red Delete button at the top.
- Confirm the "Are you sure you want to delete this record?" browser dialog.
A growl message confirms "Deleted Successfully". The doctor disappears from the list.
Retiring a single consultant
- Open Manage Staff → Consultant.
- Select the consultant.
- Click Delete → confirm.
Retiring a single other staff member
- Open Manage Staff → Staff List (or the relevant focused list).
- There is no Delete button on the Staff List grid itself — open the staff edit form via the Edit action and use the system's deactivation flow from the editor, or use the Bulk Delete Staff screen for retiring records by selection. Most administrators use the bulk screen even for a single record because the staff editor is geared toward updating fields rather than retiring.
Bulk Delete Staff
For retiring multiple records in one operation, use the dedicated bulk screen.
Navigation
Top menu → Administration → Manage Staff → (Setup tab) → Bulk Delete Staff.
Path: /admin/staff/staff_bulk_delete.xhtml.
Workflow
- The screen shows every active staff record in a paginated grid (5/10/15/500 rows per page) with these columns:
- Selection checkbox
- Type (the database record type, e.g.,
Staff,Doctor,Consultant) - Name (filter and sort)
- Speciality (shown using the Designation field; filter and sort)
- Created By
- Use the column filters to narrow to the records you want to retire. For example, type a designation in the Speciality column to focus on one group.
- Tick the checkbox on every row to retire. The header checkbox toggles all rows on the current page.
- Click Remove Selected.
- Confirm the "Are you sure you want to delete this record?" dialog. (This dialog covers the entire batch, not each row.)
All ticked rows are retired in one operation. The grid refreshes; retired rows are gone.
Tips for bulk retire
- Apply filters before ticking; the grid pages, and selections do not always persist across pages depending on the PrimeFaces version. If unsure, work one page at a time.
- The grid does not show retired records, so any row visible here is still active.
- A bulk retire performed in error is recoverable at the database level only. There is no in-app "Undo".
What happens to linked data
| Linked data | Effect of retiring the practitioner |
|---|---|
| Past OPD bills | Unchanged. The bill still shows the doctor's name as it was. |
| Past channel bookings | Unchanged. Past sessions still show the consultant. |
| Future / pending bookings on an active session | The booking screen will not pick up the consultant for new bookings, but bookings already saved remain. Cancel or reschedule those manually if needed. |
| Channel sessions linked to the consultant | Sessions remain visible on schedule reports but should not be opened for new bookings. Retire or end the sessions separately if appropriate. |
| Staff signature | Image stays attached to the (now retired) record. Not displayed on new bills because the staff is no longer pickable. |
Linked WebUser login |
Not automatically disabled. If the staff member has a login, disable it separately in Administration → Manage Users. |
| Salary, leave, EPF history | Untouched. Payroll reports for past periods still include the staff member's records. |
Restoring a retired practitioner
There is no in-app reactivation button. To bring a record back:
- Ask a system administrator (or whoever has database access) to set the row's
retiredflag back tofalse(and optionally clearretirerandretiredAt). - Reload the staff list. The record reappears in active lists.
Because the underlying data is intact, restoration restores all linked sessions, signatures, and payroll history.
When to retire vs when to hard-delete
In normal operation you should always use the soft retire flow described here. Hard deletion (physically removing the row) is not exposed in the UI and is reserved for administrators dealing with data-quality issues such as test records, duplicates, or fields that violate referential integrity. See Admin — Retirement vs Hard Delete for the administrator perspective.
Limitations and gotchas
- No merge. If the same doctor was registered twice, you must keep both records; HMIS has no merge function. Retire the duplicate and use the surviving record going forward.
- No "Disable temporarily". Retire is the only available state change; there is no in-app "Active / Inactive" toggle. A consultant temporarily on long leave should usually stay active with channel sessions marked as leave (see Channel — Doctor Leave Management) rather than retired.
- The Delete confirmation is a single browser-level dialog. Make sure you really intended to retire before clicking OK; the action is immediate.