doctormoney.js 1.0 KB

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 打赏信息表
  5. const DoctormoneySchema = {
  6. doctorid: { type: String, required: true, maxLength: 200 }, // 医生id
  7. doctorname: { type: String, required: true, maxLength: 500 }, // 医生名称
  8. patientid: { type: String, required: true, maxLength: 200 }, // 患者ID
  9. patientname: { type: String, required: true, maxLength: 200 }, // 患者名称
  10. sendtime: { type: String, required: false }, // 发送时间
  11. money: { type: String, required: false, maxLength: 200 }, // 打赏金额
  12. orderno: { type: String, required: false, maxLength: 200 }, // 订单号
  13. content: { type: String, required: false }, // 内容
  14. };
  15. const schema = new Schema(DoctormoneySchema, { toJSON: { virtuals: true } });
  16. schema.index({ doctorid: 1 });
  17. schema.index({ 'meta.createdAt': 1 });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('Doctormoney', schema, 'doctormoney');
  22. };