'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 打赏信息表 const DoctormoneySchema = { doctorid: { type: String, required: true, maxLength: 200 }, // 医生id doctorname: { type: String, required: true, maxLength: 500 }, // 医生名称 patientid: { type: String, required: true, maxLength: 200 }, // 患者ID patientname: { type: String, required: true, maxLength: 200 }, // 患者名称 sendtime: { type: String, required: false }, // 发送时间 money: { type: String, required: false, maxLength: 200 }, // 打赏金额 orderno: { type: String, required: false, maxLength: 200 }, // 订单号 content: { type: String, required: false }, // 内容 }; const schema = new Schema(DoctormoneySchema, { toJSON: { virtuals: true } }); schema.index({ doctorid: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Doctormoney', schema, 'doctormoney'); };