Task #106
Updated by Varsha N 18 days ago
Task: Investigation-wise Patient Medical History Report (Admin Module) Task Objective: Implement an Investigation-wise a Patient Medical History Report in the Admin module that allows the admin to show how many times each investigation has been ordered within search a selected time period. This report helps patient by Patient ID or Mobile Number and view the admin analyze test usage patterns within the hospital. patient’s complete medical history, including diagnosis, investigations, and prescriptions, across visits. The report must support multiple time-based filters such as Today, Monthly, Yearly, and custom date range. ⚠️ No new database tables or columns should be added. All data must be derived retrieved from existing consultation-related tables. Navigation: Navigation Admin Login → Reports → Investigation-wise Report Patient Medical History Report Details,Fields to Display: Serial Search Options Patient ID Mobile Number Investigation Name Category (if available) Total Count (number of times ordered) Summary Section: Total unique investigations Total investigations ordered (At least one search option is mandatory) Filters: Filters Today Monthly Yearly From Date – To Date (custom range) Doctor (Filter based on (Filters apply to consultation / visit date) Report Details Patient Information (Header Section) Patient ID Patient Name Age / Gender Mobile Number Consultation History (Visit-wise) For each visit, display: Visit Date Doctor Name Chief Complaints Diagnosis Details List of diagnoses recorded for the visit Investigation Details List of investigations ordered for the visit Prescription Details For each visit: Medicine Name Dosage Duration Food Relation Follow Instruction Data Source patients visits consultations consultation_diagnosis diagnosis_master consultation_investigations investigation_master consultation_prescriptions prescription_master users (doctor) Features to Implement: Implement Search patient by Patient ID or Mobile Number Load report based patient details on successful search Apply selected time filter Group investigations (Today / Monthly / Yearly / Date range) Display visit-wise medical history Fetch and display diagnosis, investigations, and prescriptions per visit Order visits by date (latest first) Apply hospital-level filtering using GROUP BY investigation_id Count total occurrences using COUNT() Display data in tabular format hospital_id Handle patients with multiple visits Show summary totals below the table Pagination support “No records found” when applicable Read-only report view Pagination for long medical history Excel Download (Optional / Phase 2) Provide “Download Excel” button Excel should include: Patient details Visit-wise diagnosis, investigation, and prescription data Applied filter information Excel generation must be done server-side File name example: Patient_Medical_History_<PatientID>.xlsx Validations & Rules: Rules Either Patient ID or Mobile Number is mandatory From Date must not be greater than To Date Date range required is mandatory for custom filter Only completed consultations included Admin can view access only their hospital’s data Only completed consultations should be shown Disable report button search and download buttons during API call calls Backend Requirements Fetch patient using Patient ID or Mobile Number + hospital_id Apply date filters on visit date or consultation date Join consultation-related tables using visit_id / consultation_id Do not store report results in database Out of Scope Editing patient or consultation data Diagnosis or investigation trend analytics Cross-hospital patient search Completion Criteria: Investigation counts accurate All Criteria Patient search works correctly with ID or mobile number Time-based filters working (Today / Monthly / Yearly / Date range) work correctly Hospital Medical history loads accurately and visit-wise Excel download (if enabled) matches on-screen data No new tables or columns added Hospital-level data isolation maintained No schema changes enforced