12345678910111213141516171819202122 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 群聊信息表
- const RoomSchema = {
- patientid: { type: String, required: false, maxLength: 200 }, // 患者ID
- patientname: { type: String, required: false, maxLength: 200 }, // 患者姓名
- doctorid: { type: String, required: false, maxLength: 200 }, // 医生ID
- doctorname: { type: String, required: false, maxLength: 200 }, // 医生姓名
- };
- const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
- schema.index({ patientid: 1 });
- schema.index({ doctorid: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Room', schema, 'room');
- };
|