diff --git a/.DS_Store b/.DS_Store
index 6d916a35..4d666203 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/appointments/__pycache__/forms.cpython-312.pyc b/appointments/__pycache__/forms.cpython-312.pyc
index 400cf857..af8934a4 100644
Binary files a/appointments/__pycache__/forms.cpython-312.pyc and b/appointments/__pycache__/forms.cpython-312.pyc differ
diff --git a/appointments/forms.py b/appointments/forms.py
index cbf2e79d..88bbd874 100644
--- a/appointments/forms.py
+++ b/appointments/forms.py
@@ -51,7 +51,7 @@ class AppointmentRequestForm(forms.ModelForm):
self.fields['provider'].queryset = User.objects.filter(
tenant=user.tenant,
is_active=True,
- role__in=['PHYSICIAN', 'NURSE', 'NURSE_PRACTITIONER', 'PHYSICIAN_ASSISTANT']
+ employee_profile__role__in=['PHYSICIAN', 'NURSE', 'NURSE_PRACTITIONER', 'PHYSICIAN_ASSISTANT']
).order_by('last_name', 'first_name')
def clean_preferred_date(self):
diff --git a/current_prompt.md b/current_prompt.md
new file mode 100644
index 00000000..c7e35dcf
--- /dev/null
+++ b/current_prompt.md
@@ -0,0 +1,173 @@
+Agent Instructions:
+You are a senior Django architect and full-stack developer. This is a very large, mission-critical project—do **not** dump all code at once. Follow this strict phased plan-and-approve workflow to minimize hallucination and ensure accuracy:
+
+**Phase 1 – Planning**
+1. Produce a high-level outline of every app/module, its responsibilities, and the key models, views/endpoints, HTMX interactions, Celery tasks, HL7 and DICOM/PACS interfaces, AI analytics hooks, and compliance/multitenancy considerations.
+2. Pause and wait for my confirmation before proceeding.
+
+**Phase 2 – Scoping & Approval (per app)**
+For each confirmed app (one at a time):
+1. List all models, fields, relationships, and choice enums in full detail.
+2. List required UI views (with HTMX attributes) and REST API endpoints/URLs.
+3. List any Celery tasks, HL7/DICOM integration points, IoT hooks, and AI rule triggers.
+4. Pause and wait for my “👍 go ahead with [app_name]” before generating any code.
+
+**Phase 3 – Implementation (per app)**
+When I approve an app:
+1. Generate **models.py** for that app only.
+2. Pause for my review and approval.
+3. Generate **serializers.py** and/or **forms.py**, then pause for review.
+4. Generate **views.py**, **templates/**, and any necessary HTMX snippets, then pause for review.
+5. Generate **static asset scaffolding** (SASS partials, HTMX/JS modules) and pause for review.
+
+**Phase 4 – Shared Tooling & Final Integration**
+After all apps are complete:
+1. Generate Webpack (or Django-Webpack-Loader) setup, SCSS/JS bundling, and `django-compressor` config.
+2. Generate Celery configuration with Redis broker and example tasks (including HL7/DICOM polling, IoT data ingestion, AI analytics jobs).
+3. Generate the **hl7_interface** and **pacs_interface** apps: models, utilities, management commands, and Celery tasks for HL7 v2.x and DICOM messaging.
+4. Generate DRF API docs (Swagger) config, pytest setup, and GitHub Actions CI workflow.
+5. Generate example Gunicorn + Nginx deployment snippets with multitenancy and SSL/TLS, and notes on GDPR/HIPAA compliance (encryption at rest, audit logs, consent management).
+6. Provide a comprehensive README covering:
+ - Python virtualenv setup
+ - `npm install && npm run build`
+ - `manage.py migrate`, superuser setup
+ - ColorAdmin license integration
+ - HTMX usage guidelines
+ - HL7/DICOM endpoint configuration
+ - IoT device onboarding
+ - AI risk-scoring configuration
+ - Multitenancy setup
+ - Compliance controls (2FA, encryption, consent capture)
+
+---
+
+**Project Specification**
+Project name: `hospital_management`
+UI theme: ColorAdmin template (all CSS/JS centralized—no inline or per-template scripts/styles)
+Dynamic behavior: HTMX for all interactive features
+Messaging: Optional inbound/outbound HL7 and DICOM/PACS interfaces
+Analytics: AI-driven predictive risk scoring hooks in `decision_support`
+Security & Compliance:
+- Two-factor authentication, encryption at rest, GDPR/HIPAA audit trails
+- Consent management, digital signatures, detailed audit logs
+- Tenant-scoped data isolation for multi-hospital support
+
+**Apps, Models & Fields**
+
+1. **accounts**
+ - `User` (extends AbstractUser): username, email, first_name, last_name, password, role (choices: Admin, Doctor, Nurse, LabTech, Pharmacist, Receptionist, Patient, EMS), is_active, date_joined, tenant
+ - `TwoFactorDevice`: user FK, device_type, secret_key, confirmed
+ - `SocialAccount` (django-allauth)
+
+2. **core**
+ - `AuditLogEntry`: user FK, action, timestamp, object_type, object_id, change_detail
+ - HL7Utility & DICOMUtility modules (no models; parsing/building functions)
+
+3. **patients**
+ - `PatientProfile`: user FK (Patient), medical_record_number, date_of_birth, gender, blood_type, allergies (text), address, phone, emergency_contact FK, insurance_info FK
+ - `EmergencyContact`: patient FK, name, relationship, phone, email
+ - `InsuranceInfo`: patient FK, provider, policy_number, group_number, coverage_start_date, coverage_end_date
+ - `ConsentForm`: patient FK, form_type, document (FileField), signed_at, signed_by FK
+
+4. **appointments**
+ - `AppointmentRequest`: patient FK, doctor FK, department, requested_datetime, status (Pending/Confirmed/Cancelled), created_at, updated_at
+ - `SlotAvailability`: doctor FK, date, start_time, end_time, is_available
+ - `WaitingQueue`: appointment FK, position, created_at
+ - VirtualCare scheduled via `TelemedicineSession`: patient FK, provider FK, session_url, start_time, end_time, status
+
+5. **inpatients**
+ - `Ward`: name, floor, capacity, department
+ - `Bed`: ward FK, bed_number, bed_type (choices: General/ICU/Private), status
+ - `Admission`: patient FK, ward FK, bed FK, admitted_at, admitted_by FK, reason, status
+ - `DischargeSummary`: admission FK, summary_text, discharged_at, discharged_by FK
+ - `Transfer`: admission FK, from_ward FK, to_ward FK, transferred_at, reason
+ - `SurgerySchedule`: patient FK, surgeon FK, or_block FK, scheduled_at, duration, status
+
+6. **emr**
+ - `Encounter`: patient FK, encounter_date, provider FK, encounter_type, notes
+ - `VitalSigns`: encounter FK, recorded_at, temperature, heart_rate, bp_systolic, bp_diastolic, respiratory_rate, oxygen_saturation
+ - `ProblemList`: patient FK, description, onset_date, status, notes
+ - `CarePlan`: encounter FK, goal, interventions, status
+ - `ClinicalNote`: encounter FK, note_type, content, created_at, created_by FK
+
+7. **billing**
+ - `Invoice`: patient FK, date_issued, due_date, total_amount, status
+ - `ChargeItem`: invoice FK, description, code, quantity, unit_price, total_price
+ - `Payment`: invoice FK, amount, method, paid_at, transaction_id
+ - `InsuranceClaim`: invoice FK, claim_number, status, submitted_at, adjudicated_at
+
+8. **pharmacy**
+ - `Medication`: name, code, description, unit, dosage_form
+ - `Prescription`: patient FK, prescriber FK, prescribed_at, status
+ - `DispenseRecord`: prescription FK, medication FK, quantity, dispensed_at, dispenser FK
+ - `StockItem`: medication FK, batch_number, expiration_date, quantity_on_hand, minimum_threshold
+
+9. **laboratory**
+ - `LabTest`: name, code, description, specimen_type, department
+ - `Specimen`: lab_test FK, patient FK, collected_at, collected_by FK, status
+ - `Result`: specimen FK, result_value, units, reference_range, result_date, verified_by FK
+ - `LISIntegrationLog`: message_id, direction, payload, status, processed_at
+
+10. **radiology**
+ - `RadiologyOrder`: patient FK, imaging_type, ordered_by FK, order_date, priority, status
+ - `ImagingStudy`: order FK, modality, study_date, images_count, report_status
+ - `RadiologyReport`: study FK, report_text, dictated_by FK, dictated_at, approved_by FK, approved_at
+ - `DICOMStudy`: study_instance_uid, patient_fk, modality, study_date, series_data (JSON)
+
+11. **inventory**
+ - `SupplyItem`: name, sku, description, category, unit, reorder_level, location
+ - `PurchaseOrder`: supplier FK, order_date, expected_date, status, total_amount
+ - `StockTransaction`: item FK, transaction_type, quantity, transaction_date, reference
+
+12. **decision_support**
+ - `CDSSRule`: name, trigger_event, condition_expression, action, active
+ - `AlertLog`: rule FK, patient FK, triggered_at, message, status
+ - AI hooks: risk_scoring_config (JSON), last_run, score_thresholds
+
+13. **reporting**
+ - `CustomReport`: name, description, owner FK, query_definition (JSON), created_at, updated_at
+ - `DashboardWidget`: name, report FK, widget_type, settings (JSON), position
+
+14. **hl7_interface**
+ - `HL7Endpoint`: name, host, port, protocol, is_active, last_checked
+ - `HL7MessageLog`: endpoint FK, direction, message_type, raw_message, parsed_message, sent_at, received_at, status
+
+15. **pacs_interface**
+ - `PACSConnection`: name, ae_title, host, port, is_active
+ - `PACSLog`: connection FK, direction, dicom_uid, raw_payload, processed_at, status
+
+16. **operating_theatre**
+ - `ORBlock`: name, theater_number, department, available_slots (JSON)
+ - `EquipmentReservation`: device FK, or_block FK, reserved_from, reserved_to, status
+
+17. **assets**
+ - `MedicalDevice`: name, serial_number, category, location, status, last_maintenance
+ - `MaintenanceLog`: device FK, performed_at, performed_by FK, notes
+ - `IoTSensorReading`: device FK, timestamp, data (JSON)
+
+18. **ems**
+ - `DispatchRequest`: caller_info, location, priority, status, created_at
+ - `Ambulance`: identifier, capacity, status, location
+ - `CrewMember`: user FK, ambulance FK, role
+ - `TripLog`: dispatch FK, ambulance FK, start_time, end_time, patient_fk
+
+19. **nutrition**
+ - `MealPlan`: patient FK, date, meals (JSON), dietary_restrictions
+ - `DietaryOrder`: patient FK, meal_type, order_time, status
+ - `KitchenTask`: plan FK, task_description, assigned_to FK, status, completed_at
+
+20. **security**
+ - `EncryptionKey`: key_name, key_type, created_at, rotation_date
+ - `AuditLogEntry` (enhanced for GDPR/HIPAA as above)
+
+---
+
+**Shared Tooling, Interactivity & Deployment**
+- **Assets**: SCSS in `assets/scss/` → `static/dist/main.css`; JS in `assets/js/` → `static/dist/main.js` via Webpack + Babel; `django-compressor` for compression.
+- **HTMX**: All dynamic features use `hx-*` attributes—no per-template JS.
+- **API**: DRF ModelViewSets under `/api/v1/`, secured with JWT/OAuth2, Swagger UI at `/api/docs/`.
+- **Background**: Celery+Redis for notifications, HL7/DICOM messaging, IoT ingestion, AI scoring.
+- **Testing/CI**: `pytest` + GitHub Actions for lint/test/build.
+- **Deployment**: Gunicorn+Nginx configs, multitenancy notes, SSL/TLS, GDPR/HIPAA compliance checklist, 2FA setup, consent management, and monitoring guidance.
+
+Ensure phased execution and strictly pause for approvals at each step. Good luck!
\ No newline at end of file
diff --git a/db.sqlite3 b/db.sqlite3
index 1a328e1e..7b9ac4d5 100644
Binary files a/db.sqlite3 and b/db.sqlite3 differ
diff --git a/inpatients/__pycache__/models.cpython-312.pyc b/inpatients/__pycache__/models.cpython-312.pyc
index 56dbac13..03b034c1 100644
Binary files a/inpatients/__pycache__/models.cpython-312.pyc and b/inpatients/__pycache__/models.cpython-312.pyc differ
diff --git a/inpatients/__pycache__/urls.cpython-312.pyc b/inpatients/__pycache__/urls.cpython-312.pyc
index d54ea326..6276eb09 100644
Binary files a/inpatients/__pycache__/urls.cpython-312.pyc and b/inpatients/__pycache__/urls.cpython-312.pyc differ
diff --git a/inpatients/__pycache__/views.cpython-312.pyc b/inpatients/__pycache__/views.cpython-312.pyc
index 835be373..14bcebcd 100644
Binary files a/inpatients/__pycache__/views.cpython-312.pyc and b/inpatients/__pycache__/views.cpython-312.pyc differ
diff --git a/inpatients/models.py b/inpatients/models.py
index e8ff9fff..4107edb0 100644
--- a/inpatients/models.py
+++ b/inpatients/models.py
@@ -511,6 +511,26 @@ class Bed(models.Model):
return timezone.now() - self.occupied_since
return None
+ def mark_maintenance(self, notes=None):
+ """
+ Mark bed for maintenance.
+ """
+ self.status = 'MAINTENANCE'
+ self.last_maintenance = timezone.now()
+ if notes:
+ self.maintenance_notes = notes
+ self.save()
+
+ def mark_cleaned(self, user, cleaning_level='STANDARD'):
+ """
+ Mark bed as cleaned.
+ """
+ self.status = 'AVAILABLE'
+ self.last_cleaned = timezone.now()
+ self.cleaned_by = user
+ self.cleaning_level = cleaning_level
+ self.save()
+
class Admission(models.Model):
"""
@@ -1719,4 +1739,3 @@ class SurgerySchedule(models.Model):
if self.actual_duration_minutes:
return self.actual_duration_minutes - self.estimated_duration_minutes
return None
-
diff --git a/inpatients/templates/inpatients/beds/bed_detail.html b/inpatients/templates/inpatients/beds/bed_detail.html
index 95988b33..6c7720fa 100644
--- a/inpatients/templates/inpatients/beds/bed_detail.html
+++ b/inpatients/templates/inpatients/beds/bed_detail.html
@@ -3,6 +3,10 @@
{% block title %}Bed {{ object.bed_number }} Details{% endblock %}
+{% block extra_head %}
+
+{% endblock %}
+
{% block content %}
@@ -190,86 +194,27 @@
{% endif %}
-
-
-
- {% if admission_history %}
-
-
-
-
- Date
- Action
- Patient
- Duration
- Notes
-
-
-
- {% for history in admission_history %}
-
-
- {{ history.admission_datetime|date:"M d, Y" }}
- {{ history.admission_datetime|time:"g:i A" }}
-
-
-
- {{ history.get_action_display }}
-
-
-
- {% if history.patient %}
-
- {{ history.patient.get_full_name }}
-
- {{ history.patient.mrn }}
- {% else %}
- System action
- {% endif %}
-
-
- {% if history.duration %}
- {{ history.duration }}
- {% else %}
- -
- {% endif %}
-
-
- {% if history.notes %}
-
- {{ history.notes }}
-
- {% else %}
- -
- {% endif %}
-
-
- {% endfor %}
-
-
-
- {% else %}
-
-
-
No History Available
-
No bed history records found for this bed.
-
- {% endif %}
-
-
+
+
+
+
+ {% include 'inpatients/partials/bed_history.html' %}
+
+
+
@@ -439,7 +384,7 @@
+
+
+
+
+
+
+
+
+
+ {% if object.current_admission %}
+
+
+ You are about to discharge {{ object.current_admission.patient.get_full_name }} from this bed.
+
+
+ {% else %}
+
+ No patient is currently assigned to this bed.
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+ {% if object.current_admission %}
+
+ {% csrf_token %}
+
+
Current Location
+
+
+
+
+ Ward: {{ object.ward.name }}
+ Bed: {{ object.bed_number }}
+
+
+ Patient: {{ object.current_admission.patient.get_full_name }}
+ Admission Date: {{ object.current_admission.admission_datetime|date:"M d, Y" }}
+
+
+
+
+
+
+ Transfer to Ward
+
+ Select ward...
+ {% for ward in wards %}
+ {% if ward != object.ward %}
+ {{ ward.name }} ({{ ward.available_beds }} available)
+ {% endif %}
+ {% endfor %}
+
+
+
+ Transfer to Bed
+
+ Select bed...
+
+
+
+ Transfer Reason
+
+ Select reason...
+ Clinical need
+ Bed availability
+ Patient request
+ Ward maintenance
+ Other
+
+
+
+ Priority
+
+ Routine
+ Urgent
+ Emergency
+
+
+
+ Notes
+
+
+
+ {% else %}
+
+ No patient is currently assigned to this bed.
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% csrf_token %}
+
+ Cleaning Level
+
+ Routine
+ Deep cleaning
+ Terminal cleaning
+
+
+
+ Notes
+
+
+
+
+
+
+ Mark as cleaned immediately
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% csrf_token %}
+
+ Maintenance Type
+
+ Repair
+ Inspection
+ Equipment replacement
+ Upgrade
+
+
+
+ Description
+
+
+
+ Priority
+
+ Low
+ Medium
+ High
+ Urgent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Current Occupancy:
+ {{ bed_stats.occupancy_rate|default:0 }}%
+
+
+
+
+ Total Admissions:
+ {{ bed_stats.total_admissions|default:0 }}
+
+
+
+
+ Avg Stay (days):
+ {{ bed_stats.avg_stay_days|default:0 }}
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+{% block js %}
+
{% endblock %}
-
diff --git a/inpatients/templates/inpatients/beds/bed_management.html b/inpatients/templates/inpatients/beds/bed_management.html
index 97234068..645418b7 100644
--- a/inpatients/templates/inpatients/beds/bed_management.html
+++ b/inpatients/templates/inpatients/beds/bed_management.html
@@ -1,802 +1,566 @@
{% extends 'base.html' %}
-{% load static %} {% block title %}Bed Management{% endblock %} {% block css %}
-
-{% endblock %} {% block content %}
-
-
-
BedManagement
-
Real-time bed occupancy and availability management.
-
-
-
-
-
-
-
-
-
-
-
-
-
Bed Status Overview
-
-
-
-
-
-
-
- All Wards
- {% for ward in wards %}
- {{ ward.name }}
- {% endfor %}
-
-
-
-
- All Status
- Available
- Occupied
- Maintenance
- Blocked
- Cleaning
-
-
-
-
- All Types
- Standard
- ICU
- Isolation
- Pediatric
- Maternity
-
-
-
-
-
-
-
-
- {% for ward in wards %}
-
-
- {{ ward.name }}
- {{ ward.bed_count }} beds
-
-
- {% for bed in ward.beds.all %}
-
-
-
-
-
-
-
{{ bed.bed_number }}
-
{{ bed.room_number }}
- {% if bed.current_admission %}
-
- {{ bed.current_admission.patient.get_full_name }}
- {{ bed.occupied_since|timesince }} ago
-
- {% endif %}
-
-
- {{ bed.get_status_display }}
-
-
-
-
-
-
- {% endfor %}
-
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ occupancy_rate|floatformat:0}}%
-
-
-
-
-
{{ occupancy_rate|floatformat:0 }}%
-
-
-
- {{ occupied_beds }} of {{ total_beds }} beds occupied
-
-
-
-
-
-
-
- {% for ward in wards %}
-
-
{{ ward.name }}
-
-
-
{{ ward.occupancy_rate|floatformat:0 }}%
-
-
- {% endfor %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% csrf_token %}
-
-
-
- Patient *
-
- Select patient...
- {% for patient in available_patients %}
- {{ patient.get_full_name }} ({{ patient.patient_id }})
- {% endfor %}
-
-
-
- Admission Date *
-
-
-
- Admission Type
-
- Emergency
- Elective
- Transfer
- Observation
-
-
-
- Notes
-
-
-
-
-
-
-
-
-
-{% endblock %} {% block js %}
-
-
+{% block title %}Bed Management - Hospital HMS{% endblock %}
+{% block css %}
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+ Home
+ Inpatients
+ Bed Management
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Bed Management Dashboard
+
+
+
+
+
+
+ Ward
+
+ All Wards
+ {% for ward in wards %}
+ {{ ward.name }}
+ {% endfor %}
+
+
+
+ Status
+
+ All Statuses
+ Available
+ Occupied
+ Maintenance
+ Blocked
+ Cleaning
+ Out of Order
+
+
+
+ Bed Type
+
+ All Types
+ Standard
+ ICU
+ Isolation
+ Pediatric
+ Maternity
+
+
+
+
+
+
+ {% for ward in wards %}
+
+
+
+ {{ ward.name }}
+ {{ ward.beds.count }} beds
+ {{ ward.occupancy_rate|floatformat:0 }}% occupied
+
+
+
+
+
+ {% for bed in ward.beds.all %}
+
+
+
+
+
+
+
Bed {{ bed.bed_number }}
+
Room {{ bed.room_number }}
+
+ {% if bed.current_admission %}
+
+ {{ bed.current_admission.patient.get_full_name }}
+ {{ bed.occupied_since|timesince }} ago
+
+ {% endif %}
+
+
+ {{ bed.get_status_display }}
+
+
+
+
+
+ {% endfor %}
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ occupancy_rate|floatformat:0 }}%
+
Bed Utilization Rate
+
+
+
+ {{ occupied_beds }}
+ Occupied
+
+
+ {{ available_beds }}
+ Available
+
+
+
+
+
+
+
+
+
+
+
+ {% for ward in wards %}
+
+
{{ ward.name }}
+
+
+
{{ ward.occupancy_rate|floatformat:0 }}%
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+ Bulk Update
+
+
+ Export Data
+
+
+ Schedule Maintenance
+
+
+ View Alerts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading...
+
+
Loading bed details...
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block js %}
+
{% endblock %}
diff --git a/inpatients/templates/inpatients/discharges/discharge_confirm_delete.html b/inpatients/templates/inpatients/discharges/discharge_confirm_delete.html
index 4ca8f00a..640c8906 100644
--- a/inpatients/templates/inpatients/discharges/discharge_confirm_delete.html
+++ b/inpatients/templates/inpatients/discharges/discharge_confirm_delete.html
@@ -1,380 +1,123 @@
{% extends "base.html" %}
-{% load static %}
+{% load i18n %}
-{% block title %}Delete Discharge Record{% endblock %}
+{% block title %}{% trans "Delete Discharge Summary" %}{% endblock %}
{% block content %}
-
-
-
-
-
-
-
-
-
- Are you sure you want to delete this discharge record?
-
-
- This action cannot be undone. The discharge record and all associated data will be permanently removed from the system.
-
-
+
+
+ Home
+ Inpatients
+ Discharges
+ Discharge Summaries
+ {{ discharge_summary.admission.patient.get_full_name }}
+ Delete
+
+
+
+
+
-
-
-
-
-
-
- Patient Information
-
-
- Patient: {{ object.admission.patient.get_full_name }}
-
-
- MRN: {{ object.admission.patient.medical_record_number }}
-
-
- DOB: {{ object.admission.patient.date_of_birth|date:"M d, Y" }}
-
-
- Age: {{ object.admission.patient.age }} years
-
-
-
-
-
-
-
-
- Discharge Information
-
-
- Discharge Date: {{ object.discharge_date|date:"M d, Y g:i A" }}
-
-
- Discharge Type: {{ object.get_discharge_type_display }}
-
-
- Status:
-
- {{ object.get_status_display }}
-
-
-
- Discharge ID: {{ object.pk }}
-
-
-
-
-
+
+
+
+
+
+
+
+
+ {% trans "Delete Discharge Summary" %}
+
+ {% trans "Warning" %}
+
+
+
+
+
+
+
+
+ {% trans "Warning: This action cannot be undone!" %}
+
+
{% trans "Are you sure you want to delete this discharge summary? This will permanently remove all associated data." %}
+
-
-
-
-
-
-
- Related Admission Information
-
-
-
-
- Admission Date: {{ object.admission.admission_date|date:"M d, Y g:i A" }}
-
-
- Length of Stay: {{ object.length_of_stay }} days
-
-
- Ward: {{ object.admission.ward.name }}
-
-
-
-
- Bed: {{ object.admission.bed.bed_number }}
-
-
- Attending Physician: {{ object.admission.attending_physician.get_full_name }}
-
-
- Admission Diagnosis: {{ object.admission.primary_diagnosis }}
-
-
-
-
-
-
-
+
+
+
+
+
{% trans "Discharge Summary Details" %}
+
+
+
{% trans "Patient" %}: {{ discharge_summary.admission.patient.get_full_name }}
+
{% trans "MRN" %}: {{ discharge_summary.admission.patient.mrn }}
+
{% trans "Admission Date" %}: {{ discharge_summary.admission.admission_datetime|date:"M d, Y g:i A" }}
+
+
+
{% trans "Discharge Date" %}: {{ discharge_summary.discharge_date|date:"M d, Y" }} {{ discharge_summary.discharge_time|time:"g:i A" }}
+
{% trans "Physician" %}: {{ discharge_summary.discharging_physician.get_full_name }}
+
{% trans "Length of Stay" %}: {{ discharge_summary.length_of_stay }} {% trans "days" %}
+
+
+
+
+
+
+
{% trans "Status" %}
+ {% if discharge_summary.summary_completed %}
+
+ {% trans "Summary Completed" %}
+
+ {% if discharge_summary.summary_signed %}
+
+ {% trans "Summary Signed" %}
+
+ {% endif %}
+ {% else %}
+
+ {% trans "Incomplete" %}
+
+ {% endif %}
+ {% if discharge_summary.patient_copy_provided %}
+
+ {% trans "Patient Copy Provided" %}
+
+ {% endif %}
+
+
+
- {% if object.discharge_summary %}
-
-
-
-
-
- Discharge Summary
-
-
- {{ object.discharge_summary|truncatewords:50 }}
- {% if object.discharge_summary|wordcount > 50 %}
-
- Summary truncated for display...
-
- {% endif %}
-
-
-
-
-
- {% endif %}
+
+
+
{% trans "Please confirm that you want to permanently delete this discharge summary." %}
- {% if object.discharge_medications.exists %}
-
-
-
-
-
- Discharge Medications
-
-
- {% for medication in object.discharge_medications.all|slice:":6" %}
-
-
-
-
-
{{ medication.medication.name }}
-
{{ medication.dosage }} - {{ medication.frequency }}
-
-
-
- {% endfor %}
- {% if object.discharge_medications.count > 6 %}
-
- And {{ object.discharge_medications.count|add:"-6" }} more medications...
-
- {% endif %}
-
-
-
-
-
- {% endif %}
-
-
-
- {% csrf_token %}
-
-
-
- Reason for Deletion *
-
-
- Select a reason
- Data Entry Error
- Duplicate Record
- Patient Request
- Privacy Compliance
- System Error
- Incorrect Discharge
- Administrative Correction
- Other
-
-
-
-
-
- Additional Notes
-
-
-
- These notes will be recorded for audit purposes and compliance.
-
-
-
-
-
-
- I understand that this action cannot be undone and confirm the deletion of this discharge record.
-
-
-
-
-
-
- Notify relevant stakeholders (attending physician, nursing staff, billing department) about this deletion.
-
-
-
-
-
- What happens when you delete this discharge record?
-
-
- The discharge record will be permanently removed from the system
- The associated admission will be marked as "active" again
- The patient's bed will be marked as occupied
- Discharge medications and instructions will be deleted
- Billing records may be affected and require manual adjustment
- This action will be logged in the audit trail
- Follow-up appointments may need to be rescheduled
- Insurance claims may need to be updated
-
-
-
-
-
- Cancel
-
-
- Delete Discharge Record
-
-
-
-
-
-
-
- {% if object.status == 'completed' %}
-
-
-
-
-
Completed Discharge: This discharge has been completed. Deleting it may affect:
-
- Billing and insurance claims that have already been processed
- Quality metrics and hospital statistics
- Regulatory reporting requirements
- Patient care continuity and follow-up schedules
-
-
-
- {% if object.follow_up_appointments.exists %}
-
- Follow-up Appointments: This discharge has {{ object.follow_up_appointments.count }} associated follow-up appointment{{ object.follow_up_appointments.count|pluralize }}.
- These may need to be rescheduled or cancelled.
-
- {% endif %}
-
-
- {% endif %}
-
-
-
-
-
-
-
-
Discharge Details
-
- Discharge ID: {{ object.pk }}
- Created: {{ object.created_at|date:"M d, Y g:i A" }}
- Last Updated: {{ object.updated_at|date:"M d, Y g:i A" }}
- Created By: {{ object.created_by.get_full_name|default:"System" }}
-
-
-
-
System Information
-
- Admission ID: {{ object.admission.pk }}
- Patient ID: {{ object.admission.patient.pk }}
- {% if object.discharge_medications.exists %}
- Medications: {{ object.discharge_medications.count }} prescribed
- {% endif %}
- {% if object.follow_up_appointments.exists %}
- Follow-ups: {{ object.follow_up_appointments.count }} scheduled
- {% endif %}
-
-
-
-
-
-
-
-
-
+
+ {% csrf_token %}
+
+ {% trans "Yes, Delete Discharge Summary" %}
+
+
+ {% trans "Cancel" %}
+
+
+
+
+
+
+
+
+
+
{% endblock %}
-
diff --git a/inpatients/templates/inpatients/discharges/discharge_detail.html b/inpatients/templates/inpatients/discharges/discharge_detail.html
index 8873df5f..814038c1 100644
--- a/inpatients/templates/inpatients/discharges/discharge_detail.html
+++ b/inpatients/templates/inpatients/discharges/discharge_detail.html
@@ -1,596 +1,451 @@
{% extends "base.html" %}
-{% load static %}
+{% load i18n %}
-{% block title %}Discharge Details - {{ object.admission.patient.get_full_name }}{% endblock %}
-
-{% block css %}
-
-
-{% endblock %}
+{% block title %}{% trans "Discharge Summary Detail" %}{% endblock %}
{% block content %}
-
-
- Dashboard
- Inpatients
- Discharges
- {{ object.admission.patient.get_full_name }}
-
-
+
+
+
+ Home
+ Inpatients
+ Discharges
+ Discharge Summaries
+ Detail
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+ Discharge Summary Details
+ {% if discharge_summary.summary_completed %}
+
+ {% trans "Completed" %}
+
+ {% if discharge_summary.summary_signed %}
+
+ {% trans "Signed" %}
+
+ {% endif %}
+ {% else %}
+
+ {% trans "Incomplete" %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
{% trans "Patient Information" %}
+ Basic patient details
+
+
+
+
{% trans "Name" %}: {{ discharge_summary.admission.patient.get_full_name }}
+
{% trans "MRN" %}: {{ discharge_summary.admission.patient.mrn }}
+
{% trans "Admission Date" %}: {{ discharge_summary.admission.admission_datetime|date:"M d, Y g:i A" }}
+
{% trans "Discharge Date" %}: {{ discharge_summary.discharge_date|date:"M d, Y" }} {{ discharge_summary.discharge_time|time:"g:i A" }}
+
{% trans "Length of Stay" %}: {{ discharge_summary.length_of_stay }} {% trans "days" %}
+
+
+
+
+
+
+
{% trans "Provider Information" %}
+ Care team details
+
+
+
+
{% trans "Discharging Physician" %}: {{ discharge_summary.discharging_physician.get_full_name }}
+ {% if discharge_summary.primary_nurse %}
+
{% trans "Primary Nurse" %}: {{ discharge_summary.primary_nurse.get_full_name }}
+ {% endif %}
+
{% trans "Status" %}:
+ {% if discharge_summary.summary_completed %}
+
+ {% trans "Completed" %}
+
+ {% if discharge_summary.summary_signed %}
+
+ {% trans "Signed" %}
+
+ {% endif %}
+ {% else %}
+
+ {% trans "Incomplete" %}
+
+ {% endif %}
+
+ {% if discharge_summary.patient_copy_provided %}
+
{% trans "Patient Copy" %}: {% trans "Provided" %}
+ {% endif %}
+
+
+
-
-
-
-
-
-
Discharge Information
-
-
-
-
-
-
-
- Patient:
-
-
- {{ object.admission.patient.get_full_name }}
-
- {{ object.admission.patient.medical_record_number }}
-
-
-
- Discharge Type:
-
-
- {{ object.get_discharge_type_display }}
-
-
-
-
- Discharge Date:
- {{ object.discharge_date|date:"M d, Y" }}
-
-
- Discharge Time:
- {{ object.discharge_time|time:"H:i" }}
-
-
- Status:
-
-
- {{ object.get_discharge_status_display }}
-
-
-
-
-
-
-
-
- Admission Date:
- {{ object.admission.admission_date|date:"M d, Y" }}
-
-
- Length of Stay:
- {{ object.get_length_of_stay }} days
-
-
- Attending Physician:
-
- {% if object.attending_physician %}
-
- Dr. {{ object.attending_physician.get_full_name }}
-
- {% else %}
- Not specified
- {% endif %}
-
-
-
- Destination:
- {{ object.discharge_destination|default:"Home" }}
-
-
- Created:
- {{ object.created_at|date:"M d, Y H:i" }}
-
-
-
-
-
-
-
+
-
-
-
-
Clinical Information
-
-
-
-
-
-
Diagnoses
- {% if object.primary_diagnosis %}
-
- Primary Diagnosis:
- {{ object.primary_diagnosis }}
-
- {% endif %}
+
+
+
+
+
{% trans "Clinical Summary" %}
+ Medical details and diagnosis information
+
+
- {% if object.secondary_diagnoses %}
-
- Secondary Diagnoses:
- {{ object.secondary_diagnoses|linebreaks }}
-
- {% endif %}
-
-
-
Discharge Planning
-
-
- Patient Education Provided
-
-
-
- Discharge Planning Completed
-
-
-
+
+
+
+
{% trans "Admission Diagnosis" %}
+
{{ discharge_summary.admission_diagnosis|linebreaks|default:"Not specified" }}
+
+
+
+
+
{% trans "Final Diagnosis" %}
+
{{ discharge_summary.final_diagnosis|linebreaks|default:"Not specified" }}
+
+
+
- {% if object.discharge_summary %}
-
-
Discharge Summary
-
- {{ object.discharge_summary|linebreaks }}
-
-
- {% endif %}
-
-
-
+ {% if discharge_summary.secondary_diagnoses %}
+
+
{% trans "Secondary Diagnoses" %}
+
+ {% for diagnosis in discharge_summary.secondary_diagnoses %}
+ {{ diagnosis }}
+ {% endfor %}
+
+
+ {% endif %}
-
-
-
-
Discharge Instructions
-
-
-
- {% if object.discharge_medications %}
-
-
Discharge Medications
-
- {{ object.discharge_medications|linebreaks }}
-
-
- {% endif %}
+ {% if discharge_summary.procedures_performed %}
+
+
{% trans "Procedures Performed" %}
+
+ {% for procedure in discharge_summary.procedures_performed %}
+ {{ procedure }}
+ {% endfor %}
+
+
+ {% endif %}
- {% if object.discharge_instructions %}
-
-
Patient Instructions
-
- {{ object.discharge_instructions|linebreaks }}
-
-
- {% endif %}
+
+
{% trans "Hospital Course" %}
+
+ {{ discharge_summary.hospital_course|linebreaks|default:"Not specified" }}
+
+
- {% if object.follow_up_instructions %}
-
-
Follow-up Instructions
-
- {{ object.follow_up_instructions|linebreaks }}
-
-
- {% endif %}
+ {% if discharge_summary.complications %}
+
+
{% trans "Complications" %}
+ {{ discharge_summary.complications|linebreaks }}
+
+ {% endif %}
-
- {% if object.activity_restrictions %}
-
-
Activity Restrictions
-
- {{ object.activity_restrictions|linebreaks }}
-
-
- {% endif %}
+
- {% if object.diet_restrictions %}
-
-
Diet Restrictions
-
- {{ object.diet_restrictions|linebreaks }}
-
-
- {% endif %}
-
+
+
+
+
+
{% trans "Discharge Medications" %}
+ Medications prescribed at discharge
+
+
- {% if object.notes %}
-
-
Additional Notes
-
- {{ object.notes|linebreaks }}
-
-
- {% endif %}
+ {% if discharge_summary.discharge_medications %}
+
+ {% for med in discharge_summary.discharge_medications %}
+
+
+ {{ med.name|default:"Medication" }}
+ {{ med.dosage|default:"As prescribed" }} {{ med.frequency|default:"" }}
+ {% if med.duration %}Duration: {{ med.duration }} {% endif %}
+ {% if med.refills %}Refills: {{ med.refills }} {% endif %}
+
+
+ {% endfor %}
+
+ {% else %}
+
+
+
{% trans "No medications listed." %}
+
+ {% endif %}
- {% if not object.discharge_medications and not object.discharge_instructions and not object.follow_up_instructions and not object.activity_restrictions and not object.diet_restrictions and not object.notes %}
-
-
-
No discharge instructions available.
-
- {% endif %}
-
-
-
-
+ {% if discharge_summary.medication_changes %}
+
+
{% trans "Medication Changes" %}
+
+ {{ discharge_summary.medication_changes|linebreaks }}
+
+
+ {% endif %}
-
-
-
-
+
-
-
-
-
Patient Information
-
-
-
-
-
-
{{ object.admission.patient.get_full_name }}
-
{{ object.admission.patient.medical_record_number }}
-
-
- View Profile
-
-
-
-
-
- Age:
- {{ object.admission.patient.age }} years
-
-
- Gender:
- {{ object.admission.patient.get_gender_display }}
-
-
- Blood Type:
-
- {% if object.admission.patient.blood_type %}
- {{ object.admission.patient.blood_type }}
- {% else %}
- Unknown
- {% endif %}
-
-
-
- Allergies:
-
- {% if object.admission.patient.allergies %}
- {{ object.admission.patient.allergies }}
- {% else %}
- None known
- {% endif %}
-
-
-
- Emergency Contact:
-
- {% if object.admission.patient.emergency_contact %}
- {{ object.admission.patient.emergency_contact }}
- {% else %}
- Not provided
- {% endif %}
-
-
-
-
-
-
+
+
+
+
+
{% trans "Discharge Instructions" %}
+ Patient care instructions and restrictions
+
+
-
-
-
-
-
-
- Admission Date:
- {{ object.admission.admission_date|date:"M d, Y" }}
-
-
- Admission Type:
- {{ object.admission.get_admission_type_display }}
-
-
- Admission Reason:
- {{ object.admission.admission_reason|default:"Not specified" }}
-
-
- Room/Bed:
- {{ object.admission.bed|default:"Not assigned" }}
-
-
- Insurance:
- {{ object.admission.insurance_information|default:"Not provided" }}
-
-
+
+
+
+
{% trans "Activity Restrictions" %}
+ {{ discharge_summary.activity_restrictions|linebreaks|default:"No restrictions specified" }}
+
+
+
+
+
{% trans "Diet Instructions" %}
+ {{ discharge_summary.diet_instructions|linebreaks|default:"No dietary restrictions" }}
+
+
+
-
-
-
-
+ {% if discharge_summary.wound_care %}
+
+
{% trans "Wound Care" %}
+
+ {{ discharge_summary.wound_care|linebreaks }}
+
+
+ {% endif %}
-
-
-
-
-
-
-
{{ object.admission.admission_date|date:"M d, Y" }}
-
-
-
-
- {{ object.admission.admission_reason|default:"Admission to hospital" }}
-
-
-
+ {% if discharge_summary.special_instructions %}
+
+
{% trans "Special Instructions" %}
+ {{ discharge_summary.special_instructions|linebreaks }}
+
+ {% endif %}
-
-
{{ object.created_at|date:"M d, Y H:i" }}
-
-
-
-
- Discharge documentation initiated
-
-
-
+
- {% if object.discharge_status == 'completed' %}
-
-
{{ object.discharge_date|date:"M d, Y" }} {{ object.discharge_time|time:"H:i" }}
-
-
-
-
- Discharged {{ object.get_discharge_type_display|lower }} to {{ object.discharge_destination|default:"home" }}
-
-
-
- {% endif %}
-
-
-
-
-
+
+
+
+
+
{% trans "Follow-up Care" %}
+ Post-discharge care arrangements
+
+
+
+ {% if discharge_summary.follow_up_appointments %}
+
+
{% trans "Scheduled Appointments" %}
+
+ {% for appt in discharge_summary.follow_up_appointments %}
+
+
+ {{ appt.specialty|default:"Follow-up" }} Appointment
+
+ {{ appt.date|date:"M d, Y" }} at {{ appt.time|default:"TBD" }}
+ {{ appt.provider|default:"TBD" }} - {{ appt.location|default:"TBD" }}
+
+
+
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
{% trans "Follow-up Instructions" %}
+
+ {{ discharge_summary.follow_up_instructions|linebreaks|default:"No specific follow-up instructions" }}
+
+
+
+
+
+
+ {% trans "Warning Signs" %}
+
+
+
+
{% trans "Warning Signs to Watch For" %}
+ {{ discharge_summary.warning_signs|linebreaks|default:"No warning signs specified" }}
+
+
+
{% trans "When to Call" %}
+ {{ discharge_summary.when_to_call|linebreaks|default:"Contact healthcare provider if concerned" }}
+
+
+
+
+
+
+
+
+
+
+
{% trans "Discharge Disposition" %}
+ Discharge destination and arrangements
+
+
+
+
+
+
+ {% trans "Disposition" %}: {{ discharge_summary.get_discharge_disposition_display }}
+ {% if discharge_summary.discharge_location %}
+ {% trans "Location" %}: {{ discharge_summary.discharge_location }}
+ {% endif %}
+
+
+ {% if discharge_summary.transportation_arranged %}
+
+
+ {% trans "Transportation" %}:
+ {{ discharge_summary.get_transportation_method_display }}
+
+
+ {% endif %}
+
+
+
+
+ {% if discharge_summary.durable_medical_equipment %}
+
+
{% trans "Durable Medical Equipment" %}
+
+ {% for item in discharge_summary.durable_medical_equipment %}
+ {{ item }}
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if discharge_summary.supplies_provided %}
+
+
{% trans "Supplies Provided" %}
+
+ {% for supply in discharge_summary.supplies_provided %}
+ {{ supply }}
+ {% endfor %}
+
+
+ {% endif %}
+
+ {% if discharge_summary.education_provided %}
+
+
{% trans "Patient Education" %}
+
+ {% for topic in discharge_summary.education_provided %}
+ {{ topic }}
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
+ {% if discharge_summary.patient_understanding or discharge_summary.readmission_risk or discharge_summary.patient_satisfaction %}
+
+ {% if discharge_summary.patient_understanding %}
+
+
+
{% trans "Patient Understanding" %}
+ {{ discharge_summary.get_patient_understanding_display }}
+
+
+ {% endif %}
+
+ {% if discharge_summary.readmission_risk %}
+
+
+
{% trans "Readmission Risk" %}
+
+ {{ discharge_summary.get_readmission_risk_display }}
+
+
+
+ {% endif %}
+
+ {% if discharge_summary.patient_satisfaction %}
+
+
+
{% trans "Patient Satisfaction" %}
+
+ {% for i in "123456789"|make_list %}
+ {% if forloop.counter <= discharge_summary.patient_satisfaction %}
+
+ {% else %}
+
+ {% endif %}
+ {% endfor %}
+
+
{{ discharge_summary.patient_satisfaction }}/10
+
+
+ {% endif %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+ {% trans "Created" %}: {{ discharge_summary.created_at|date:"M d, Y g:i A" }}
+ {% if discharge_summary.created_by %}
+ {% trans "by" %} {{ discharge_summary.created_by.get_full_name }}
+ {% endif %}
+
+ {% if discharge_summary.updated_at != discharge_summary.created_at %}
+
+
+ {% trans "Last Updated" %}: {{ discharge_summary.updated_at|date:"M d, Y g:i A" }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
{% endblock %}
-
-{% block js %}
-
-
-
-
-
-{% endblock %}
-
diff --git a/inpatients/templates/inpatients/discharges/discharge_form.html b/inpatients/templates/inpatients/discharges/discharge_form.html
index 0fd2e401..24943f01 100644
--- a/inpatients/templates/inpatients/discharges/discharge_form.html
+++ b/inpatients/templates/inpatients/discharges/discharge_form.html
@@ -1,454 +1,458 @@
{% extends "base.html" %}
-{% load static %}
+{% load i18n %}
-{% block title %}{{ object|yesno:"Edit,Create" }} Discharge - Inpatients{% endblock %}
-
-{% block css %}
-
-
-
-
-{% endblock %}
+{% block title %}{% if form.instance.pk %}{% trans "Edit Discharge Summary" %}{% else %}{% trans "Create Discharge Summary" %}{% endif %}{% endblock %}
{% block content %}
-
-
- Dashboard
- Inpatients
- Discharges
- {{ object|yesno:"Edit,Create" }} Discharge
-
-
-
-
-
+
+
+ Home
+ Inpatients
+ Discharges
+ Discharge Summaries
+ {% if form.instance.pk %}Edit{% else %}Create{% endif %}
+
+
+
+
+
-
-
-
-
-
-
Discharge Information
-
-
-
-
- {% csrf_token %}
-
-
-
-
-
Admission *
- {{ form.admission }}
- {% if form.admission.errors %}
-
{{ form.admission.errors.0 }}
- {% endif %}
-
Select the admission to discharge
-
-
-
Discharge Type *
- {{ form.discharge_type }}
- {% if form.discharge_type.errors %}
-
{{ form.discharge_type.errors.0 }}
- {% endif %}
-
-
+
+
+
+
+
+
+
+
+ {% if form.instance.pk %}{% trans "Edit Discharge Summary" %}{% else %}{% trans "Create Discharge Summary" %}{% endif %}
+ {% if form.instance.pk %}
+ {% if form.instance.summary_completed %}
+
+ {% trans "Completed" %}
+
+ {% else %}
+
+ {% trans "Incomplete" %}
+
+ {% endif %}
+ {% else %}
+
+ {% trans "New" %}
+
+ {% endif %}
+
+
+ {% if form.instance.pk %}
+
+
+
+
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+ {% csrf_token %}
-
-
-
-
Discharge Date *
- {{ form.discharge_date }}
- {% if form.discharge_date.errors %}
-
{{ form.discharge_date.errors.0 }}
- {% endif %}
-
-
-
Discharge Time *
- {{ form.discharge_time }}
- {% if form.discharge_time.errors %}
-
{{ form.discharge_time.errors.0 }}
- {% endif %}
-
-
-
Status
- {{ form.discharge_status }}
- {% if form.discharge_status.errors %}
-
{{ form.discharge_status.errors.0 }}
- {% endif %}
-
-
+
+
+
+
+
{% trans "Basic Information" %}
+ Admission and discharge details
+
+
-
-
-
-
Discharge Destination
- {{ form.discharge_destination }}
- {% if form.discharge_destination.errors %}
-
{{ form.discharge_destination.errors.0 }}
- {% endif %}
-
-
-
Attending Physician
- {{ form.attending_physician }}
- {% if form.attending_physician.errors %}
-
{{ form.attending_physician.errors.0 }}
- {% endif %}
-
-
+
+
+
+
{% trans "Admission Details" %}
+
+
{% trans "Admission" %}
+ {{ form.admission }}
+ {% if form.admission.errors %}
+
{{ form.admission.errors }}
+ {% endif %}
+
+
+
{% trans "Discharging Physician" %}
+ {{ form.discharging_physician }}
+ {% if form.discharging_physician.errors %}
+
{{ form.discharging_physician.errors }}
+ {% endif %}
+
+
+
+
+
+
{% trans "Discharge Details" %}
+
+
+
+
{% trans "Discharge Date" %}
+ {{ form.discharge_date }}
+ {% if form.discharge_date.errors %}
+
{{ form.discharge_date.errors }}
+ {% endif %}
+
+
+
+
+
{% trans "Discharge Time" %}
+ {{ form.discharge_time }}
+ {% if form.discharge_time.errors %}
+
{{ form.discharge_time.errors }}
+ {% endif %}
+
+
+
+
+
{% trans "Length of Stay (days)" %}
+ {{ form.length_of_stay }}
+ {% if form.length_of_stay.errors %}
+
{{ form.length_of_stay.errors }}
+ {% endif %}
+
+
+
+
-
- Clinical Information
-
-
-
Primary Diagnosis
- {{ form.primary_diagnosis }}
- {% if form.primary_diagnosis.errors %}
-
{{ form.primary_diagnosis.errors.0 }}
- {% endif %}
-
-
-
Secondary Diagnoses
- {{ form.secondary_diagnoses }}
- {% if form.secondary_diagnoses.errors %}
-
{{ form.secondary_diagnoses.errors.0 }}
- {% endif %}
-
-
+
+
+
+
+
{% trans "Status & Documentation" %}
+ Completion status and documentation
+
+
-
-
Discharge Summary
- {{ form.discharge_summary }}
- {% if form.discharge_summary.errors %}
-
{{ form.discharge_summary.errors.0 }}
- {% endif %}
-
Comprehensive summary of the patient's stay and treatment
-
+
+
+
+ {{ form.summary_completed }}
+
+ {% trans "Summary Completed" %}
+
+
+
+
+
+ {{ form.summary_signed }}
+
+ {% trans "Summary Signed" %}
+
+
+
+
+
+ {{ form.patient_copy_provided }}
+
+ {% trans "Patient Copy Provided" %}
+
+
+
+
-
- Discharge Instructions
-
-
Discharge Medications
- {{ form.discharge_medications }}
- {% if form.discharge_medications.errors %}
-
{{ form.discharge_medications.errors.0 }}
- {% endif %}
-
List all medications the patient should continue at home
-
+
-
-
Patient Instructions
- {{ form.discharge_instructions }}
- {% if form.discharge_instructions.errors %}
-
{{ form.discharge_instructions.errors.0 }}
- {% endif %}
-
Detailed instructions for patient care at home
-
+
+
+
+
+
{% trans "Clinical Summary" %}
+ Medical diagnosis and hospital course details
+
+
-
-
Follow-up Instructions
- {{ form.follow_up_instructions }}
- {% if form.follow_up_instructions.errors %}
-
{{ form.follow_up_instructions.errors.0 }}
- {% endif %}
-
When and where the patient should follow up
-
+
+
+
+
{% trans "Diagnoses" %}
+
+
{% trans "Admission Diagnosis" %}
+ {{ form.admission_diagnosis }}
+ {% if form.admission_diagnosis.errors %}
+
{{ form.admission_diagnosis.errors }}
+ {% endif %}
+
+
+
{% trans "Final Diagnosis" %}
+ {{ form.final_diagnosis }}
+ {% if form.final_diagnosis.errors %}
+
{{ form.final_diagnosis.errors }}
+ {% endif %}
+
+
+
{% trans "Secondary Diagnoses (JSON list)" %}
+ {{ form.secondary_diagnoses }}
+ {% if form.secondary_diagnoses.errors %}
+
{{ form.secondary_diagnoses.errors }}
+ {% endif %}
+
+
+
+
+
+
{% trans "Procedures & Course" %}
+
+
{% trans "Procedures Performed (JSON list)" %}
+ {{ form.procedures_performed }}
+ {% if form.procedures_performed.errors %}
+
{{ form.procedures_performed.errors }}
+ {% endif %}
+
+
+
{% trans "Hospital Course" %}
+ {{ form.hospital_course }}
+ {% if form.hospital_course.errors %}
+
{{ form.hospital_course.errors }}
+ {% endif %}
+
+
+
{% trans "Complications" %}
+ {{ form.complications }}
+ {% if form.complications.errors %}
+
{{ form.complications.errors }}
+ {% endif %}
+
+
+
+
-
- Activity and Diet Restrictions
-
-
-
Activity Restrictions
- {{ form.activity_restrictions }}
- {% if form.activity_restrictions.errors %}
-
{{ form.activity_restrictions.errors.0 }}
- {% endif %}
-
-
-
Diet Restrictions
- {{ form.diet_restrictions }}
- {% if form.diet_restrictions.errors %}
-
{{ form.diet_restrictions.errors.0 }}
- {% endif %}
-
-
+
-
-
-
-
- {{ form.patient_education_provided }}
-
- Patient education provided
-
-
-
-
-
- {{ form.discharge_planning_completed }}
-
- Discharge planning completed
-
-
-
-
+
+
+
+
+
{% trans "Medications and Instructions" %}
+ Discharge medications and patient care instructions
+
+
-
-
Additional Notes
- {{ form.notes }}
- {% if form.notes.errors %}
-
{{ form.notes.errors.0 }}
- {% endif %}
-
+
+
+
+
{% trans "Medications" %}
+
+
{% trans "Discharge Medications (JSON list)" %}
+ {{ form.discharge_medications }}
+ {% if form.discharge_medications.errors %}
+
{{ form.discharge_medications.errors }}
+ {% endif %}
+
+
+
{% trans "Medication Changes" %}
+ {{ form.medication_changes }}
+ {% if form.medication_changes.errors %}
+
{{ form.medication_changes.errors }}
+ {% endif %}
+
+
+
+
+
+
{% trans "Patient Instructions" %}
+
+
{% trans "Activity Restrictions" %}
+ {{ form.activity_restrictions }}
+ {% if form.activity_restrictions.errors %}
+
{{ form.activity_restrictions.errors }}
+ {% endif %}
+
+
+
{% trans "Diet Instructions" %}
+ {{ form.diet_instructions }}
+ {% if form.diet_instructions.errors %}
+
{{ form.diet_instructions.errors }}
+ {% endif %}
+
+
+
{% trans "Wound Care" %}
+ {{ form.wound_care }}
+ {% if form.wound_care.errors %}
+
{{ form.wound_care.errors }}
+ {% endif %}
+
+
+
{% trans "Special Instructions" %}
+ {{ form.special_instructions }}
+ {% if form.special_instructions.errors %}
+
{{ form.special_instructions.errors }}
+ {% endif %}
+
+
+
+
-
-
-
- Cancel
-
-
-
- Save as Draft
-
-
- {{ object|yesno:"Update,Complete" }} Discharge
-
-
-
-
-
-
-
-
+
-
-
-
-
-
Discharge Guidelines
-
-
-
-
-
Discharge Checklist
-
- Patient is medically stable for discharge
- All necessary medications prescribed
- Follow-up appointments scheduled
- Patient/family education completed
- Transportation arranged
- Discharge summary completed
-
-
+
+
+
+
+
{% trans "Follow-up and Disposition" %}
+ Post-discharge care and discharge destination
+
+
-
-
Required Documentation
-
- Discharge summary with diagnoses
- Medication reconciliation
- Patient instruction sheet
- Follow-up appointment details
- Emergency contact information
-
-
+
+
+
+
{% trans "Follow-up Care" %}
+
+
{% trans "Follow-up Instructions" %}
+ {{ form.follow_up_instructions }}
+ {% if form.follow_up_instructions.errors %}
+
{{ form.follow_up_instructions.errors }}
+ {% endif %}
+
+
+
{% trans "Follow-up Appointments (JSON list)" %}
+ {{ form.follow_up_appointments }}
+ {% if form.follow_up_appointments.errors %}
+
{{ form.follow_up_appointments.errors }}
+ {% endif %}
+
+
+
+
+
+
{% trans "Warning Signs" %}
+
+
{% trans "Warning Signs" %}
+ {{ form.warning_signs }}
+ {% if form.warning_signs.errors %}
+
{{ form.warning_signs.errors }}
+ {% endif %}
+
+
+
{% trans "When to Call" %}
+ {{ form.when_to_call }}
+ {% if form.when_to_call.errors %}
+
{{ form.when_to_call.errors }}
+ {% endif %}
+
+
+
+
-
-
Discharge Types
-
- Home: Patient returns to home environment
- Transfer: Transfer to another facility
- AMA: Against medical advice
- Expired: Patient deceased during stay
-
-
+
+
+
+
{% trans "Discharge Disposition" %}
+
+
{% trans "Discharge Disposition" %}
+ {{ form.discharge_disposition }}
+ {% if form.discharge_disposition.errors %}
+
{{ form.discharge_disposition.errors }}
+ {% endif %}
+
+
+
{% trans "Discharge Location" %}
+ {{ form.discharge_location }}
+ {% if form.discharge_location.errors %}
+
{{ form.discharge_location.errors }}
+ {% endif %}
+
+
+
+
+
+
{% trans "Equipment & Supplies" %}
+
+
{% trans "Durable Medical Equipment (JSON list)" %}
+ {{ form.durable_medical_equipment }}
+ {% if form.durable_medical_equipment.errors %}
+
{{ form.durable_medical_equipment.errors }}
+ {% endif %}
+
+
+
{% trans "Supplies Provided (JSON list)" %}
+ {{ form.supplies_provided }}
+ {% if form.supplies_provided.errors %}
+
{{ form.supplies_provided.errors }}
+ {% endif %}
+
+
+
+
- {% if object and object.admission %}
-
-
Patient Information
-
- Patient: {{ object.admission.patient.get_full_name }}
- MRN: {{ object.admission.patient.medical_record_number }}
- Admission Date: {{ object.admission.admission_date|date:"M d, Y" }}
- Length of Stay: {{ object.admission.get_length_of_stay }} days
-
-
- {% endif %}
-
-
-
+
- {% if object and object.admission %}
-
-
-
-
-
-
- Admission Reason:
- {{ object.admission.admission_reason|default:"Not specified" }}
-
-
-
- Attending Physician:
- {{ object.admission.attending_physician.get_full_name|default:"Not assigned" }}
-
-
-
- Current Bed:
- {{ object.admission.bed|default:"Not assigned" }}
-
-
-
- Admission Type:
- {{ object.admission.get_admission_type_display }}
-
-
-
- Insurance:
- {{ object.admission.insurance_information|default:"Not provided" }}
-
+
+
+
+
+
{% trans "Additional Information" %}
+ Patient education and assessment data
+
+
+
+
+
+
+
{% trans "Patient Education" %}
+
+
{% trans "Education Provided (JSON list)" %}
+ {{ form.education_provided }}
+ {% if form.education_provided.errors %}
+
{{ form.education_provided.errors }}
+ {% endif %}
+
+
+
{% trans "Patient Understanding" %}
+ {{ form.patient_understanding }}
+ {% if form.patient_understanding.errors %}
+
{{ form.patient_understanding.errors }}
+ {% endif %}
+
+
+
+
+
+
{% trans "Assessment & Satisfaction" %}
+
+
{% trans "Readmission Risk" %}
+ {{ form.readmission_risk }}
+ {% if form.readmission_risk.errors %}
+
{{ form.readmission_risk.errors }}
+ {% endif %}
+
+
+
{% trans "Patient Satisfaction (1-10)" %}
+ {{ form.patient_satisfaction }}
+ {% if form.patient_satisfaction.errors %}
+
{{ form.patient_satisfaction.errors }}
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+ {% trans "Save Discharge Summary" %}
+
+
+ {% trans "Cancel" %}
+
+
+
-
- {% endif %}
{% endblock %}
-
-{% block js %}
-
-
-
-
-
-{% endblock %}
-
diff --git a/inpatients/templates/inpatients/discharges/discharge_list.html b/inpatients/templates/inpatients/discharges/discharge_list.html
new file mode 100644
index 00000000..4687b18f
--- /dev/null
+++ b/inpatients/templates/inpatients/discharges/discharge_list.html
@@ -0,0 +1,160 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Discharge Summaries" %}{% endblock %}
+
+{% block content %}
+
+
+
+ Home
+ Inpatients
+ Discharges
+ Discharge Summaries
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Discharge Summaries
+
+
+
+
+
+
+
+
+ {% trans "All Status" %}
+ {% trans "Completed" %}
+ {% trans "Incomplete" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% trans "Patient" %}
+ {% trans "Discharge Date" %}
+ {% trans "Physician" %}
+ {% trans "Status" %}
+ {% trans "Actions" %}
+
+
+
+ {% for summary in discharge_summaries %}
+
+
+
+
+
+ {{ summary.discharge_date|date:"M d, Y" }}
+ {{ summary.discharge_time|time:"g:i A" }}
+
+
+ {{ summary.discharging_physician.get_full_name }}
+
+
+ {% if summary.summary_completed %}
+
+ {% trans "Completed" %}
+
+ {% if summary.summary_signed %}
+
+ {% trans "Signed" %}
+
+ {% endif %}
+ {% else %}
+
+ {% trans "Incomplete" %}
+
+ {% endif %}
+
+
+
+
+
+ {% empty %}
+
+
+
+ {% trans "No discharge summaries found." %}
+ {% trans "Try adjusting your search criteria or create a new discharge summary." %}
+
+
+ {% endfor %}
+
+
+
+
+
+ {% if is_paginated %}
+ {% include 'partial/pagination.html' %}
+ {% endif %}
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/inpatients/templates/inpatients/discharges/discharge_planning.html b/inpatients/templates/inpatients/discharges/discharge_planning.html
index f914b8ce..0f8f9437 100644
--- a/inpatients/templates/inpatients/discharges/discharge_planning.html
+++ b/inpatients/templates/inpatients/discharges/discharge_planning.html
@@ -1,555 +1,752 @@
{% extends 'base.html' %}
{% load static %}
-{% block title %}Discharge Planning - {{ block.super }}{% endblock %}
+{% block title %}Discharge Planning - {{ admission.patient.get_full_name }}{% endblock %}
{% block css %}
-
+
+
{% endblock %}
{% block content %}
-
-
-
- DischargePlanning
-
-
Comprehensive discharge planning and coordination.
-
-