This is a project made using Node.js , Express.js , MongoDB and Mongoose. The main AIM of this project was to connect all the pages using express.js and execute different queries.
We have 7 buttons in Home Page. If the Patient is suffering from some common disease and is not serious, then he/she is taken to OPD. If the person is serious and needs to be admitted, then he/she is taken to Casualty-Department.
IN OPD, the person is supposed to fill the details and according to the symtoms, he/she is assigned a particular doctor.All these details are stored in MongoDB.Then, the patient is send to the particular department and if treated, the ACTIVE mark is set to false. Else, ACTIVE is set to false.Similarly, ADMITTED and DEATH mark is set.
IN CASUALTY-DEPARTMENT, again the details are entered and stored in Database. The main difference between the OPD and CASUALTY is, in Casualty department, patient is directly admitted with the fees of 200 while in OPD, patient can be treated with the fees of 100 but if he/she is serious, then the patient is admitted and a extra fees of Rs.100 is charged.
We can Register new Doctors.
we can see the Details of Patient and Doctors and Update/Delete them.
Finally, we can see the stats.
Mongoose function :
- Find() :
await Doctor.find({symtoms:sym})
- FindAndUpdate() :
await Doctor.findByIdAndUpdate(data[0]._id,data[0])
- FindById():
await OpdSchema.findById(req.params.id)
- Sort():
const displayOpdPatient =await OpdSchema.find().sort({name:1});
- FindByIdAndDelete():
const result=await OpdSchema.findByIdAndDelete(req.params.id)
- Aggregate() with $match:
//doctors whose earning is greater than 1000
let docs = await Doctor.aggregate([{ $match: filter }]);
- Aggregate() with $group:
//sum of Patients wrt age
let docs1_a = await OpdSchema.aggregate([{$group: {_id: '$age',count: { $sum: 1 }}}])
let docs1_b = await CasualtySchema.aggregate([{$group: {_id: '$age', count: { $sum: 1 } } }])
- Aggregate to find total earning of all doctors
//sum of earning of all doctors
let docs2 = await Doctor.aggregate([
{$group: {
_id: 'total',
total: {$sum:'$earning'}
}
}])
- Aggregate() with $group, $sort, $project :
//All the doctors
let docs3 = await Doctor.aggregate([
{$group: {_id: '$_id',name:{"$first":'$name'}}},
{$sort: {"name":1}},
{$project:{"_id":0}}
])