mypetbook-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -0
- package/package.json +23 -0
- package/utility/AppPaymentReportEntity.js +28 -0
- package/utility/AppointmentEntity.js +85 -0
- package/utility/BillingReportEntity.js +38 -0
- package/utility/DataReportEntity.js +92 -0
- package/utility/DisableSlotEntity.js +48 -0
- package/utility/DoctorEntity.js +62 -0
- package/utility/MedicalCardUploadEntity.js +52 -0
- package/utility/NotificationEntity.js +29 -0
- package/utility/NotificationUploadEntity.js +24 -0
- package/utility/ParentDoctorEntity.js +31 -0
- package/utility/ParentEntity.js +72 -0
- package/utility/ParentReportEntity.js +46 -0
- package/utility/PetEntity.js +74 -0
- package/utility/PrescriptionUploadEntity.js +52 -0
- package/utility/ProductEntity.js +77 -0
- package/utility/RecordingEntity.js +17 -0
- package/utility/ReportUploadEntity.js +54 -0
- package/utility/SystemSettingEntity.js +34 -0
- package/utility/TimeSlotEntity.js +59 -0
- package/utility/TreatmentEntity.js +120 -0
- package/utility/TreatmentRecordingEntity.js +18 -0
- package/utility/TreatmentReportEntity.js +40 -0
- package/utility/UserEntity.js +26 -0
- package/utility/storageblob.js +633 -0
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mypetbook-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "This contain all the entity model for the mypetbook",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://4linesinfotech@bitbucket.org/workeye/mypetbook-core.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "Ashish Kumar",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://bitbucket.org/workeye/mypetbook-core/issues"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"mongodb": "^6.3.0",
|
|
20
|
+
"mongoose": "^8.0.1"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://bitbucket.org/workeye/mypetbook-core#readme"
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
const appPaymentReportSchema = new Schema({
|
|
5
|
+
doctor: {
|
|
6
|
+
type: mongoose.Schema.ObjectId,
|
|
7
|
+
ref: "Doctor",
|
|
8
|
+
index: true,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
year: { type: Number },
|
|
12
|
+
month: { type: Number },
|
|
13
|
+
billCreated: { type: Number },
|
|
14
|
+
paymentIncludGst: { type: Number },
|
|
15
|
+
status: { type: String },
|
|
16
|
+
date: { type: Date },
|
|
17
|
+
type: { type: Number },
|
|
18
|
+
razorPayId: { type: String }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const AppPaymentReport = mongoose.model(
|
|
22
|
+
"AppPaymentReport",
|
|
23
|
+
appPaymentReportSchema
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
module.exports = {
|
|
27
|
+
AppPaymentReport,
|
|
28
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const cate = {
|
|
7
|
+
GOODS: 'GOODS',
|
|
8
|
+
SERVICE: 'SERVICE',
|
|
9
|
+
OTHER: 'OTHER'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const CategoryType = [
|
|
13
|
+
cate.GOODS,
|
|
14
|
+
cate.SERVICE,
|
|
15
|
+
cate.OTHER
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const AppointmentStatus = {
|
|
20
|
+
APPOINTMENT_BOOKED: 'APPOINTMENT_BOOKED',
|
|
21
|
+
CHECKED_INTO_CLINIC: 'CHECKED_INTO_CLINIC',
|
|
22
|
+
IN_PROGRESS: 'IN_PROGRESS',
|
|
23
|
+
TREATMENT_DONE: 'TREATMENT_DONE'
|
|
24
|
+
};
|
|
25
|
+
const AppointmentEnum = [
|
|
26
|
+
AppointmentStatus.APPOINTMENT_BOOKED,
|
|
27
|
+
AppointmentStatus.CHECKED_INTO_CLINIC,
|
|
28
|
+
AppointmentStatus.IN_PROGRESS,
|
|
29
|
+
AppointmentStatus.TREATMENT_DONE
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const appointmentSchema = new Schema({
|
|
34
|
+
sysCurrentDate: { type: Date, default: Date.now },
|
|
35
|
+
appointmentDate: Date,
|
|
36
|
+
checkedIntoClinic: Boolean,
|
|
37
|
+
status: {
|
|
38
|
+
type: String,
|
|
39
|
+
index: true,
|
|
40
|
+
enum : AppointmentEnum,
|
|
41
|
+
default : AppointmentStatus.APPOINTMENT_BOOKED,
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
timeslot: String,
|
|
45
|
+
doctorSlot: { type:mongoose.Schema.ObjectId,ref:'DoctorSlot',index: true,},
|
|
46
|
+
checkedIntoClinicTime: String,
|
|
47
|
+
treatmentDoneTime: String,
|
|
48
|
+
doctor:{type:mongoose.Schema.ObjectId,ref:'Doctor',
|
|
49
|
+
index: true,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
pets:[{type:mongoose.Schema.ObjectId,ref:'Pet'}],
|
|
53
|
+
parent:{type:mongoose.Schema.ObjectId,ref:'Parent',
|
|
54
|
+
index: true,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
treatment:{type:mongoose.Schema.ObjectId,ref:'Treatment',
|
|
58
|
+
index: true,
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
summary:{
|
|
62
|
+
address: String,
|
|
63
|
+
lastVisit: Date,
|
|
64
|
+
totalVisit: Number,
|
|
65
|
+
totalTransaction:Number,
|
|
66
|
+
averageTransaction:Number,
|
|
67
|
+
appointmentDraft:Boolean
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
appointmentSchema.methods.customeMethod = function (){
|
|
73
|
+
console.info("customeMethod")
|
|
74
|
+
}
|
|
75
|
+
appointmentSchema.statics.customeStatiscMethod= function (){
|
|
76
|
+
console.info("customeStatiscMethod")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const Appointment = mongoose.model("Appointment", appointmentSchema);
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
module.exports = {
|
|
83
|
+
Appointment,
|
|
84
|
+
AppointmentStatus
|
|
85
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
const billingReportSchema = new Schema({
|
|
5
|
+
doctor: {
|
|
6
|
+
type: mongoose.Schema.ObjectId,
|
|
7
|
+
ref: "Doctor",
|
|
8
|
+
index: true,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
year: { type: Number },
|
|
12
|
+
month: { type: Number },
|
|
13
|
+
|
|
14
|
+
parents: { type: Number },
|
|
15
|
+
total: { type: Number },
|
|
16
|
+
pets: { type: Number },
|
|
17
|
+
cats: { type: Number },
|
|
18
|
+
dogs: { type: Number },
|
|
19
|
+
others: { type: Number },
|
|
20
|
+
vaccines: { type: Number },
|
|
21
|
+
medicines: { type: Number },
|
|
22
|
+
petproducts: { type: Number },
|
|
23
|
+
grooming: { type: Number },
|
|
24
|
+
surgeries: { type: Number },
|
|
25
|
+
labTests: { type: Number },
|
|
26
|
+
consultations: { type: Number },
|
|
27
|
+
inClinicVaccines: { type: Number },
|
|
28
|
+
atHomeVaccines: { type: Number },
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const BillingReport = mongoose.model(
|
|
32
|
+
"BillingReport",
|
|
33
|
+
billingReportSchema
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
BillingReport,
|
|
38
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
const yearlyDataSchema = new Schema({
|
|
6
|
+
January: Number,
|
|
7
|
+
February: Number,
|
|
8
|
+
March: Number,
|
|
9
|
+
April: Number,
|
|
10
|
+
May: Number,
|
|
11
|
+
June: Number,
|
|
12
|
+
July: Number,
|
|
13
|
+
August: Number,
|
|
14
|
+
September: Number,
|
|
15
|
+
October: Number,
|
|
16
|
+
November: Number,
|
|
17
|
+
December: Number,
|
|
18
|
+
},{
|
|
19
|
+
virtuals: {
|
|
20
|
+
total: {
|
|
21
|
+
get() {
|
|
22
|
+
let total =0;
|
|
23
|
+
if(this.January){
|
|
24
|
+
total =total+this.January;
|
|
25
|
+
}
|
|
26
|
+
if(this.February){
|
|
27
|
+
total =total+this.February;
|
|
28
|
+
}
|
|
29
|
+
if(this.March){
|
|
30
|
+
total =total+this.March;
|
|
31
|
+
}
|
|
32
|
+
if(this.April){
|
|
33
|
+
total =total+this.April;
|
|
34
|
+
}
|
|
35
|
+
if(this.May){
|
|
36
|
+
total =total+this.May;
|
|
37
|
+
}
|
|
38
|
+
if(this.June){
|
|
39
|
+
total =total+this.June;
|
|
40
|
+
}
|
|
41
|
+
if(this.July){
|
|
42
|
+
total =total+this.July;
|
|
43
|
+
}
|
|
44
|
+
if(this.August){
|
|
45
|
+
total =total+this.August;
|
|
46
|
+
}
|
|
47
|
+
if(this.September){
|
|
48
|
+
total =total+this.September;
|
|
49
|
+
}
|
|
50
|
+
if(this.October){
|
|
51
|
+
total =total+this.October;
|
|
52
|
+
}
|
|
53
|
+
if(this.November){
|
|
54
|
+
total =total+this.November;
|
|
55
|
+
}
|
|
56
|
+
if(this.December){
|
|
57
|
+
total =total+this.December;
|
|
58
|
+
}
|
|
59
|
+
return total;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
},
|
|
64
|
+
toJSON: { virtuals: true },
|
|
65
|
+
});
|
|
66
|
+
const YearlyData = mongoose.model("YearlyData", yearlyDataSchema);
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const billingSchema = new Schema({
|
|
70
|
+
totalBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
71
|
+
dogsBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
72
|
+
catsBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
73
|
+
othersBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
74
|
+
parentAvg:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
75
|
+
vaccinesBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
76
|
+
medicinesBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
77
|
+
productsBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
78
|
+
groomingBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
79
|
+
surgeriesBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
80
|
+
labTestBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
81
|
+
consultationsBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
82
|
+
inClincVaccinesBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
83
|
+
atHomeVaccinesBilled:{type:mongoose.Schema.ObjectId,ref:'YearlyData'},
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const Billing = mongoose.model("Billing", billingSchema);
|
|
88
|
+
|
|
89
|
+
module.exports = {
|
|
90
|
+
Billing,
|
|
91
|
+
YearlyData
|
|
92
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
const { DoctorSlot, SlotTypeEnum, SlotType } = require("./TimeSlotEntity");
|
|
3
|
+
|
|
4
|
+
const Schema = mongoose.Schema;
|
|
5
|
+
const ServiceLocation={
|
|
6
|
+
CLINIC : "clinic",
|
|
7
|
+
HOME : "home"
|
|
8
|
+
}
|
|
9
|
+
const ServiceLocationEnum=[ServiceLocation.CLINIC,ServiceLocation.HOME];
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const disableSlotSchema = new Schema({
|
|
13
|
+
date: { type: Date, default: Date.now },
|
|
14
|
+
createdon: { type: Date},
|
|
15
|
+
updatedon: { type: Date },
|
|
16
|
+
service_location:{
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
enum: ServiceLocationEnum,
|
|
20
|
+
default: ServiceLocation.CLINIC
|
|
21
|
+
},
|
|
22
|
+
doctor: {
|
|
23
|
+
type:mongoose.Schema.ObjectId,
|
|
24
|
+
ref: "Doctor",
|
|
25
|
+
index: true,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
slotDate: { type: Date},
|
|
29
|
+
disableAll: { type: Boolean},
|
|
30
|
+
doctorSlotList:[{ type:mongoose.Schema.ObjectId, ref: DoctorSlot }],
|
|
31
|
+
slotType :{
|
|
32
|
+
type: String ,
|
|
33
|
+
index: true,
|
|
34
|
+
required: true,
|
|
35
|
+
enum: SlotTypeEnum,
|
|
36
|
+
default: SlotType.NONE
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const DisableSlot = mongoose.model("DisableSlot", disableSlotSchema);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
module.exports = {
|
|
46
|
+
DisableSlot,
|
|
47
|
+
ServiceLocation
|
|
48
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const imagesDrSchema = Schema(
|
|
7
|
+
{
|
|
8
|
+
sysCurrentDate: { type: Date, default: Date.now },
|
|
9
|
+
fileName: String,
|
|
10
|
+
uploadName: String,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
virtuals: {
|
|
14
|
+
uploadImageUrl: {
|
|
15
|
+
get() {
|
|
16
|
+
return process.env.MYPETBOOK_OWNER_IMAGE_BLOCK + this.uploadName;
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
toJSON: { virtuals: true },
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const doctorSchema = new Schema(
|
|
25
|
+
{
|
|
26
|
+
first_name: String,
|
|
27
|
+
last_name: String,
|
|
28
|
+
dob: Date,
|
|
29
|
+
address: String,
|
|
30
|
+
phoneNumber: String,
|
|
31
|
+
clinicName: String,
|
|
32
|
+
area: String,
|
|
33
|
+
landmark: String,
|
|
34
|
+
street: String,
|
|
35
|
+
user_image: String,
|
|
36
|
+
images: [imagesDrSchema],
|
|
37
|
+
user_id: {
|
|
38
|
+
type:mongoose.Schema.ObjectId,
|
|
39
|
+
ref: "User",
|
|
40
|
+
unique: true,
|
|
41
|
+
index: true,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
virtuals: {
|
|
47
|
+
image_base_url: {
|
|
48
|
+
get() {
|
|
49
|
+
return process.env.MYPETBOOK_OWNER_IMAGE_BLOCK + this.images[0]?.uploadName;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
toJSON: { virtuals: true },
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const Doctor = mongoose.model("Doctor", doctorSchema);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
Doctor,
|
|
62
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
const medicalCardUploadSchema = new Schema({
|
|
6
|
+
date: { type: Date},
|
|
7
|
+
appointment: {
|
|
8
|
+
type:mongoose.Schema.ObjectId,
|
|
9
|
+
ref: "Appointment",
|
|
10
|
+
index: true,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
pet: {
|
|
14
|
+
type:mongoose.Schema.ObjectId,
|
|
15
|
+
ref: "Pet",
|
|
16
|
+
index: true,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
treatment: {
|
|
20
|
+
type:mongoose.Schema.ObjectId,
|
|
21
|
+
ref: "Treatment",
|
|
22
|
+
index: true,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
parent: {
|
|
26
|
+
type:mongoose.Schema.ObjectId,
|
|
27
|
+
ref: "Parent",
|
|
28
|
+
index: true,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
fileName:{ type: String},
|
|
32
|
+
contentType: { type: String},
|
|
33
|
+
uploadName:{ type: String},
|
|
34
|
+
uploadImageUrl:{ type: String},
|
|
35
|
+
|
|
36
|
+
},{
|
|
37
|
+
virtuals: {
|
|
38
|
+
image_base_url: {
|
|
39
|
+
get() {
|
|
40
|
+
return "/api/medicalcard/download/"+this.id+"/";
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
},
|
|
45
|
+
toJSON: { virtuals: true },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const MedicalCardUpload = mongoose.model("MedicalCardUpload", medicalCardUploadSchema);
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
MedicalCardUpload
|
|
52
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
const { DoctorSlot } = require("./TimeSlotEntity");
|
|
3
|
+
|
|
4
|
+
const Schema = mongoose.Schema;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const notificationSchema = new Schema({
|
|
8
|
+
date: { type: Date, default: Date.now },
|
|
9
|
+
doctor: {
|
|
10
|
+
type:mongoose.Schema.ObjectId,
|
|
11
|
+
ref: "Doctor",
|
|
12
|
+
index: true,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
title:{ type: String},
|
|
16
|
+
description:{ type: String},
|
|
17
|
+
isImage: { type:Boolean, default: false },
|
|
18
|
+
createdon: { type: Date },
|
|
19
|
+
updatedon: { type: Date },
|
|
20
|
+
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const Notification = mongoose.model("Notification", notificationSchema);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
module.exports = {
|
|
28
|
+
Notification
|
|
29
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
const notificationUploadSchema = new Schema({
|
|
6
|
+
date: { type: Date, default: Date.now },
|
|
7
|
+
notification: {
|
|
8
|
+
type:mongoose.Schema.ObjectId,
|
|
9
|
+
ref: "Notification",
|
|
10
|
+
index: true,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
fileName:{ type: String},
|
|
14
|
+
contentType: { type: String},
|
|
15
|
+
uploadName:{ type: String},
|
|
16
|
+
uploadImageUrl:{ type: String},
|
|
17
|
+
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const NotificationUpload = mongoose.model("NotificationUpload", notificationUploadSchema);
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
NotificationUpload
|
|
24
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const parentDoctorSchema = new Schema({
|
|
9
|
+
doctor:{type:mongoose.Schema.ObjectId,ref:'Doctor',
|
|
10
|
+
index: true,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
parent:{type:mongoose.Schema.ObjectId,ref:'Parent',
|
|
14
|
+
index: true,
|
|
15
|
+
required: true,
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
parentDoctorSchema.methods.customeMethod = function (){
|
|
20
|
+
console.info("customeMethod")
|
|
21
|
+
}
|
|
22
|
+
parentDoctorSchema.statics.customeStatiscMethod= function (){
|
|
23
|
+
console.info("customeStatiscMethod")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ParentDoctor = mongoose.model("ParentDoctorMap", parentDoctorSchema);
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
ParentDoctor
|
|
31
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
|
|
5
|
+
const imagesSchema = Schema(
|
|
6
|
+
{
|
|
7
|
+
sysCurrentDate: { type: Date, default: Date.now },
|
|
8
|
+
fileName: String,
|
|
9
|
+
uploadName: String,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
virtuals: {
|
|
13
|
+
uploadImageUrl: {
|
|
14
|
+
get() {
|
|
15
|
+
return process.env.MYPETBOOK_OWNER_IMAGE_BLOCK + this.uploadName;
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
toJSON: { virtuals: true },
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const parentSchema = new Schema(
|
|
24
|
+
{
|
|
25
|
+
full_name: String,
|
|
26
|
+
email: String,
|
|
27
|
+
dob: Date,
|
|
28
|
+
gender: String,
|
|
29
|
+
phoneNumber: String,
|
|
30
|
+
address: String,
|
|
31
|
+
city: String,
|
|
32
|
+
pincode: String,
|
|
33
|
+
user_image: String,
|
|
34
|
+
images: [imagesSchema],
|
|
35
|
+
user_id: {
|
|
36
|
+
type:mongoose.Schema.ObjectId,
|
|
37
|
+
ref: "User",
|
|
38
|
+
unique: true,
|
|
39
|
+
index: true,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
pets: [{ type:mongoose.Schema.ObjectId, ref: "Pet" }],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
virtuals: {
|
|
46
|
+
image_base_url: {
|
|
47
|
+
get() {
|
|
48
|
+
if(this.images && this.images.length>0){
|
|
49
|
+
return this.images[0].uploadImageUrl;
|
|
50
|
+
}else{
|
|
51
|
+
return process.env.MYPETBOOK_OWNER_IMAGE_BLOCK + this.user_image;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
image_base_url2: {
|
|
58
|
+
get() {
|
|
59
|
+
return process.env.MYPETBOOK_HOME_URL+"/api/download/owner/" + this.id;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
toJSON: { virtuals: true },
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const Parent = mongoose.model("Parent", parentSchema);
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
module.exports = {
|
|
71
|
+
Parent,
|
|
72
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
|
|
3
|
+
const Schema = mongoose.Schema;
|
|
4
|
+
const parentReportSchema = new Schema({
|
|
5
|
+
parent: {
|
|
6
|
+
type: mongoose.Schema.ObjectId,
|
|
7
|
+
ref: "Parent",
|
|
8
|
+
index: true,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
doctor: {
|
|
12
|
+
type: mongoose.Schema.ObjectId,
|
|
13
|
+
ref: "Doctor",
|
|
14
|
+
index: true,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
totalVisits: { type: Number },
|
|
18
|
+
lastVisitDate: { type: Date },
|
|
19
|
+
totalTransaction: { type: Number },
|
|
20
|
+
totalDiscount :{type : Number}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
virtuals: {
|
|
24
|
+
averageTransaction: {
|
|
25
|
+
get() {
|
|
26
|
+
if(this.totalTransaction && this.totalVisits && this.totalTransaction>0 && this.totalVisits>0){
|
|
27
|
+
return (this.totalTransaction/this.totalVisits);
|
|
28
|
+
}else{
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
toJSON: { virtuals: true },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const ParentReport = mongoose.model(
|
|
40
|
+
"ParentReport",
|
|
41
|
+
parentReportSchema
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
ParentReport,
|
|
46
|
+
};
|