student.js 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 学生表
  5. const StudentSchema = {
  6. name: { type: String, required: true, maxLength: 200, zh: '姓名' }, // 姓名
  7. number: { type: String, required: false, maxLength: 200, zh: '序号' }, // 序号
  8. id_number: { type: String, required: true, maxLength: 200, zh: '身份证号' }, // 身份证号
  9. phone: { type: String, required: true, maxLength: 200, zh: '手机号' }, // 手机号
  10. gender: { type: String, required: false, maxLength: 200, zh: '性别' }, // 性别
  11. nation: { type: String, required: false, maxLength: 200, zh: '民族' }, // 民族
  12. insurance: { type: String, required: false, maxLength: 200, zh: '拓训时间' }, // 拓训时间
  13. school_name: { type: String, required: false, maxLength: 200, zh: '学校名称' }, // 学校名称
  14. isComming: { type: String, default: '0', zh: '是否参培' }, // 是否签到0否,1是; 2退出
  15. faculty: { type: String, required: false, maxLength: 200, zh: '院系' }, // 院系
  16. major: { type: String, required: false, maxLength: 200, zh: '专业' }, // 专业
  17. edua_level: { type: String, required: false, maxLength: 200, zh: '学历层次' }, // 学历层次
  18. edua_system: { type: String, required: false, maxLength: 200, zh: '学制' }, // 学制
  19. entry_year: { type: String, required: false, maxLength: 200, zh: '入学年份' }, // 入学年份
  20. finish_year: { type: String, required: false, maxLength: 200, zh: '毕业年份' }, // 毕业年份
  21. school_job: { type: String, required: false, maxLength: 200, zh: '在校担任何种职务' }, // 在校担任何种职务
  22. bedroom: { type: String, required: false, maxLength: 200, zh: '寝室号' }, // 寝室号
  23. is_fine: { type: String, required: false, maxLength: 200, default: '0', zh: '是否优秀' }, // 是否优秀,0-否,1-是,2-无资格
  24. selfscore: { type: String, required: false, maxLength: 200, zh: '个人分' }, // 个人分
  25. score: { type: String, required: false, maxLength: 200, zh: '总分' }, // 总分
  26. qq: { type: String, required: false, maxLength: 200, zh: 'QQ号' }, // QQ号
  27. email: { type: String, required: false, maxLength: 200, zh: '邮箱' }, // 邮箱
  28. family_place: { type: String, required: false, maxLength: 200, zh: '家庭所在地' }, // 家庭所在地
  29. family_is_hard: { type: String, required: false, maxLength: 200, zh: '家庭是否困难' }, // 家庭是否困难,0-否,1-是
  30. have_grant: { type: String, required: false, maxLength: 200, zh: '是否获得过助学金' }, // 是否获得过助学金,0-否,1-是
  31. job: { type: String, required: false, maxLength: 200, default: '普通学生', zh: '职务' }, // 职务
  32. schid: { type: String, required: false, maxLength: 200, zh: '学校' }, // 学校id
  33. planyearid: { type: String, required: false, maxLength: 200 }, // 年度计划id
  34. planid: { type: String, required: false, maxLength: 200 }, // 计划id
  35. termid: { type: String, required: false, maxLength: 200, zh: '期' }, // 期id
  36. batchid: { type: String, required: false, maxLength: 200, zh: '批次' }, // 批次id
  37. classid: { type: String, required: false, maxLength: 200, zh: '班级' }, // 班级id
  38. bedroomid: { type: String, required: false, maxLength: 200, zh: '寝室' }, // 寝室id
  39. openid: { type: String, required: false, maxLength: 200, zh: '微信openid' }, // 微信openid
  40. diy: { type: { Object }, required: false, zh: '自定义' }, // 自定义
  41. type: { type: String, required: false, maxLength: 200, default: '0' }, // 类型:0-正常,1-特殊
  42. status: { type: String, required: false, maxLength: 200, default: '1' }, // 0:待确定。1:确定,2:失败
  43. cert: { type: String, required: false, default: '0' }, // 证书状态,0=>未打印;1=已打印
  44. };
  45. const schema = new Schema(StudentSchema, { toJSON: { virtuals: true } });
  46. schema.index({ id: 1, termid: 1, batchid: 1, schid: 1 });
  47. schema.plugin(metaPlugin);
  48. module.exports = app => {
  49. const { mongoose } = app;
  50. return mongoose.model('Student', schema, 'student');
  51. };