Skip to content

Practitioner Master & Schedule Setup

Overview

A Healthcare Practitioner represents a doctor, nurse, or other clinical staff member. Each practitioner can have one or more Practitioner Schedules that define when they're available for appointments, and at which service units.

Healthcare Practitioner

Creating a Practitioner

Navigate to: Healthcare workspace > Healthcare Practitioner > New

Key Fields

Identity & Type

FieldTypeDescription
first_nameDataRequired
last_nameDataOptional
practitioner_nameDataAuto-generated (first + last), read-only
genderLinkGender
statusSelectActive / Disabled
practitioner_typeSelectInternal (linked to Employee) or External (linked to Supplier)

Employee & User Linking

FieldTypeDescription
employeeLink → EmployeeFor internal practitioners — links to HR module
user_idLink → UserLogin account — enables desk access and auto-fills from Employee
departmentLink → DepartmentMedical department
designationLink → Designatione.g., Senior Consultant, Resident
supplierLink → SupplierFor external practitioners

When user_id is set, the system automatically adds User Permissions so the practitioner can only see their own records.

When employee is set on the JS form (line 162), it auto-fetches user_id, names, and phone numbers from the Employee record.

Consulting Charges

FieldTypeDescription
op_consulting_charge_itemLink → ItemERPNext Item for outpatient consultation
op_consulting_chargeCurrencyFee amount
inpatient_visit_charge_itemLink → ItemERPNext Item for inpatient visits
inpatient_visit_chargeCurrencyFee amount

These can be overridden at the Appointment Type level for department-specific pricing.

Schedule Assignment

FieldTypeDescription
practitioner_schedulesTablePractitioner Service Unit Schedule (pairs a schedule with a service unit)
google_calendarLinkOptional Google Calendar sync

Validation Rules (healthcare_practitioner.py)

  • validate_user_id() (line 113): User must exist, be enabled, and not already assigned to another practitioner
  • validate_practitioner_schedules() (line 83): If video conferencing is enabled on a schedule, validates prerequisites; checks for duplicate schedule+service_unit combinations
  • autoname() (line 23): Document name = concatenation of first and last name

API Methods

python
# Get list of active practitioners (for dropdowns)
frappe.call("healthcare.healthcare.doctype.healthcare_practitioner.healthcare_practitioner.get_practitioner_list", {
    filters: { status: "Active" }
})

# Get supplier and user for a practitioner
frappe.call("healthcare.healthcare.doctype.healthcare_practitioner.healthcare_practitioner.get_supplier_and_user", {
    practitioner: "DR-001"
})

Practitioner Schedule

Creating a Schedule

Navigate to: Healthcare workspace > Practitioner Schedule > New

A Practitioner Schedule is a reusable template — one schedule can be assigned to multiple practitioners.

Fields

FieldTypeDescription
schedule_nameDataUnique name (e.g., "Morning OPD", "Evening Clinic")
disabledCheckDeactivates the schedule
allow_video_conferencingCheckEnables teleconsultation for slots in this schedule
time_slotsTableHealthcare Schedule Time Slot entries

Time Slot Configuration

Each row in time_slots defines availability for one day:

FieldTypeDescription
daySelectSunday through Saturday
from_timeTimeSlot window start (e.g., 09:00)
to_timeTimeSlot window end (e.g., 13:00)
durationFloatAuto-calculated: to_time - from_time in minutes (read-only)
maximum_appointmentsIntOptional cap on appointments per slot window

Example: A schedule with:

  • Monday: 09:00–13:00 (4-hour window)
  • Monday: 14:00–17:00 (3-hour window)
  • Wednesday: 09:00–13:00

If the appointment duration is 15 minutes, the 09:00–13:00 window generates 16 slot buttons.

Validation (practitioner_schedule.py line 10–27)

  • Validates that time slot durations don't exceed available time in the window
  • Checks for overlapping time slots on the same day

Practitioner Service Unit Schedule (Linking)

This child table on the Healthcare Practitioner pairs a schedule with a service unit:

FieldTypeDescription
scheduleLink → Practitioner ScheduleWhich schedule to use
service_unitLink → Healthcare Service UnitWhere the practitioner works during this schedule

A practitioner can have multiple entries — e.g., "Morning OPD" at "Consultation Room 1" and "Evening Clinic" at "Consultation Room 3".

The get_available_slots() function iterates through these entries to calculate availability (see Block & Slot Booking).


Practitioner Availability (Overrides)

For one-off changes (time off, extra availability), use the Practitioner Availability DocType instead of modifying the schedule.

Fields

FieldTypeDescription
typeSelectAvailable (add extra time) or Unavailable (block time)
scope_typeSelectHealthcare Practitioner / Healthcare Service Unit / Medical Department
scopeDynamic LinkThe specific practitioner, unit, or department
statusSelectActive / Expired
start_date / end_dateDateDate range for the override
start_time / end_timeTimeTime range within each day
durationIntAuto-calculated (minutes), read-only
reasonSelectTime Off / Break / Training / Travel / Emergency (for unavailable type)
repeatSelectNever / Daily / Weekly / Monthly
mondaysundayCheckRepeat days (for weekly repeat)
service_unitLinkOverride location (for Available type only)

Validation (practitioner_availability.py)

  • validate_start_and_end() (line 43): End time must be after start time
  • validate_availability_overlaps() (line 55): Checks for overlapping availability/unavailability periods
  • validate_existing_appointments() (line 153): Prevents creating unavailable blocks that conflict with existing patient appointments
  • Practitioner: healthcare/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py
  • Practitioner JS: healthcare/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.js
  • Schedule: healthcare/healthcare/doctype/practitioner_schedule/practitioner_schedule.py
  • Availability: healthcare/healthcare/doctype/practitioner_availability/practitioner_availability.py
  • Child table: healthcare/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.json
  • Time slots: healthcare/healthcare/doctype/healthcare_schedule_time_slot/healthcare_schedule_time_slot.json