118 lines
4.1 KiB
Python
118 lines
4.1 KiB
Python
"""
|
|
Django admin configuration for nursing app.
|
|
"""
|
|
|
|
from django.contrib import admin
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from .models import (
|
|
NursingEncounter,
|
|
GrowthChart,
|
|
VitalSignsAlert,
|
|
)
|
|
|
|
|
|
@admin.register(NursingEncounter)
|
|
class NursingEncounterAdmin(admin.ModelAdmin):
|
|
"""Admin interface for NursingEncounter model."""
|
|
|
|
list_display = ['patient', 'encounter_date', 'filled_by', 'temperature', 'hr_bpm',
|
|
'bp_systolic', 'bp_diastolic', 'bmi', 'signed_by', 'tenant']
|
|
list_filter = ['encounter_date', 'tenant', 'signed_at']
|
|
search_fields = ['patient__mrn', 'patient__first_name_en', 'patient__last_name_en']
|
|
readonly_fields = ['id', 'bmi', 'bmi_category', 'blood_pressure', 'has_abnormal_vitals',
|
|
'created_at', 'updated_at']
|
|
date_hierarchy = 'encounter_date'
|
|
|
|
fieldsets = (
|
|
(_('Patient & Provider'), {
|
|
'fields': ('patient', 'tenant', 'encounter_date', 'appointment', 'filled_by')
|
|
}),
|
|
(_('Vital Signs'), {
|
|
'fields': ('temperature', 'hr_bpm', 'respiratory_rate', 'bp_systolic',
|
|
'bp_diastolic', 'blood_pressure', 'spo2', 'crt')
|
|
}),
|
|
(_('Measurements'), {
|
|
'fields': ('height_cm', 'weight_kg', 'bmi', 'bmi_category', 'head_circumference_cm')
|
|
}),
|
|
(_('Pain & Allergies'), {
|
|
'fields': ('pain_score', 'allergy_present', 'allergy_details')
|
|
}),
|
|
(_('Observations'), {
|
|
'fields': ('observations',)
|
|
}),
|
|
(_('Abnormal Findings'), {
|
|
'fields': ('has_abnormal_vitals',),
|
|
'classes': ('collapse',)
|
|
}),
|
|
# (_('Additional Notes'), {
|
|
# 'fields': ('notes',),
|
|
# 'classes': ('collapse',)
|
|
# }),
|
|
(_('Signature'), {
|
|
'fields': ('signed_by', 'signed_at'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
(_('Metadata'), {
|
|
'fields': ('id', 'created_at', 'updated_at'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
)
|
|
|
|
|
|
@admin.register(GrowthChart)
|
|
class GrowthChartAdmin(admin.ModelAdmin):
|
|
"""Admin interface for GrowthChart model."""
|
|
|
|
list_display = ['patient', 'measurement_date', 'age_months', 'weight_kg', 'height_cm',
|
|
'head_circumference_cm', 'bmi']
|
|
list_filter = ['patient', 'measurement_date']
|
|
search_fields = ['patient__mrn', 'patient__first_name_en', 'patient__last_name_en']
|
|
readonly_fields = ['id', 'age_months', 'bmi', 'created_at', 'updated_at']
|
|
|
|
fieldsets = (
|
|
(None, {
|
|
'fields': ('patient', 'nursing_encounter', 'measurement_date', 'age_months')
|
|
}),
|
|
(_('Measurements'), {
|
|
'fields': ('weight_kg', 'height_cm', 'head_circumference_cm', 'bmi')
|
|
}),
|
|
(_('Percentiles'), {
|
|
'fields': ('percentile_weight', 'percentile_height', 'percentile_head_circumference',
|
|
'percentile_bmi'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
(_('Metadata'), {
|
|
'fields': ('id', 'created_at', 'updated_at'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
)
|
|
|
|
|
|
@admin.register(VitalSignsAlert)
|
|
class VitalSignsAlertAdmin(admin.ModelAdmin):
|
|
"""Admin interface for VitalSignsAlert model."""
|
|
|
|
list_display = ['nursing_encounter', 'vital_sign', 'severity', 'status', 'acknowledged_by', 'tenant']
|
|
list_filter = ['vital_sign', 'severity', 'status', 'tenant', 'created_at']
|
|
search_fields = ['nursing_encounter__patient__mrn', 'vital_sign', 'value']
|
|
readonly_fields = ['id', 'created_at', 'updated_at']
|
|
date_hierarchy = 'created_at'
|
|
|
|
fieldsets = (
|
|
(None, {
|
|
'fields': ('nursing_encounter', 'tenant', 'vital_sign', 'severity', 'status')
|
|
}),
|
|
(_('Alert Details'), {
|
|
'fields': ('value',)
|
|
}),
|
|
(_('Acknowledgment'), {
|
|
'fields': ('acknowledged_by', 'acknowledged_at', 'notes'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
(_('Metadata'), {
|
|
'fields': ('id', 'created_at', 'updated_at'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
)
|