123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const ValueSchema = new Schema({
- dept1: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept2: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept3: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept4: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept5: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- fid: { type: Schema.Types.ObjectId },
- userid: {
- type: Schema.Types.ObjectId,
- ref: 'sysUser',
- },
- // userName: { type: String }, // 采集员
- infoId: {
- type: Schema.Types.ObjectId,
- ref: 'Info' }, // 老人id
- type: { type: String }, // 采集是0 探访是1
- time: { type: Date, default: Date.now },
- });
- ValueSchema.index({ dept5: -1 }, { background: true, name: 'value_dept5_-1' });
- ValueSchema.index({ time: -1 }, { background: true, name: 'value_time_-1' });
- ValueSchema.index({ sysUser: 1 }, { background: true, name: 'value_sysUser_-1' });
- return mongoose.model('Value', ValueSchema, 'value');
- };
|