47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
/**
|
|
* PharmacyManager: Handles inventory, prescriptions, and billing.
|
|
*/
|
|
|
|
class PharmacyManager {
|
|
constructor() {
|
|
this.inventory = [
|
|
{ id: 'M01', name: 'Paracetamol 500mg', stock: 120, price: 5 },
|
|
{ id: 'M02', name: 'Amoxicillin 250mg', stock: 45, price: 12 },
|
|
{ id: 'M03', name: 'Cough Syrup', stock: 4, price: 85 },
|
|
{ id: 'M04', name: 'Vitamin C', stock: 200, price: 3 },
|
|
{ id: 'M05', name: 'Azithromycin', stock: 30, price: 150 },
|
|
{ id: 'M06', name: 'Insulin Glargine', stock: 12, price: 450 }
|
|
];
|
|
this.pendingOrders = [
|
|
{ id: 'ORD-901', patientName: 'Rahul Verma', medicines: 'Paracetamol, Cough Syrup', status: 'PENDING', timestamp: '2026-05-13T09:15:00Z' },
|
|
{ id: 'ORD-902', patientName: 'Anjali Singh', medicines: 'Amoxicillin', status: 'READY', timestamp: '2026-05-13T09:45:00Z' }
|
|
];
|
|
}
|
|
|
|
getInventory() {
|
|
return this.inventory;
|
|
}
|
|
|
|
addPendingOrder(patientName, medicines) {
|
|
this.pendingOrders.push({
|
|
id: `ORD-${Date.now()}`,
|
|
patientName,
|
|
medicines,
|
|
status: 'PENDING',
|
|
timestamp: new Date().toISOString()
|
|
});
|
|
}
|
|
|
|
processOrder(orderId) {
|
|
const order = this.pendingOrders.find(o => o.id === orderId);
|
|
if (order) {
|
|
order.status = 'READY';
|
|
// In a real app, update inventory stock here
|
|
return { success: true, message: `Order for ${order.patientName} is ready for pickup.` };
|
|
}
|
|
return { success: false, message: "Order not found." };
|
|
}
|
|
}
|
|
|
|
module.exports = new PharmacyManager();
|