doctormoney.js 1.3 KB

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