-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema (1).js
More file actions
46 lines (42 loc) · 1.54 KB
/
Copy pathschema (1).js
File metadata and controls
46 lines (42 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const mongoose = require('mongoose');
const patientSchema = new mongoose.Schema({
name: { type: String, required: true },
age: { type: Number, required: true },
gender: { type: String, enum: ['Male', 'Female', 'Other'] },
contactNumber: { type: String, required: true },
bloodGroup: { type: String },
address: { type: String },
medicalHistory: [{ type: String }] // Array of past conditions
}, { timestamps: true });
const Patient = mongoose.model('Patient', patientSchema);
const doctorSchema = new mongoose.Schema({
name: { type: String, required: true },
specialization: { type: String, required: true },
experience: { type: Number }, // in years
contactNumber: { type: String, required: true },
email: { type: String, unique: true },
availableDays: [{ type: String }], // e.g., ['Monday', 'Wednesday']
consultationFee: { type: Number }
}, { timestamps: true });
const Doctor = mongoose.model('Doctor', doctorSchema);
const appointmentSchema = new mongoose.Schema({
patient: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Patient',
required: true
},
doctor: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Doctor',
required: true
},
appointmentDate: { type: Date, required: true },
status: {
type: String,
enum: ['Scheduled', 'Completed', 'Cancelled'],
default: 'Scheduled'
},
reasonForVisit: { type: String },
notes: { type: String }
}, { timestamps: true });
const Appointment = mongoose.model('Appointment', appointmentSchema);