visitModel.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const VisitSchema = new Schema({
  6. userid: {
  7. type: Schema.Types.ObjectId,
  8. ref: 'sysUser',
  9. },
  10. // userName: { type: String }, // 探访员
  11. dept1: {
  12. type: Schema.Types.ObjectId,
  13. ref: 'sysDept',
  14. },
  15. dept2: {
  16. type: Schema.Types.ObjectId,
  17. ref: 'sysDept',
  18. },
  19. dept3: {
  20. type: Schema.Types.ObjectId,
  21. ref: 'sysDept',
  22. },
  23. dept4: {
  24. type: Schema.Types.ObjectId,
  25. ref: 'sysDept',
  26. },
  27. dept5: {
  28. type: Schema.Types.ObjectId,
  29. ref: 'sysDept',
  30. },
  31. fid: { type: Schema.Types.ObjectId }, // 戶Id
  32. infoId: { type: Schema.Types.ObjectId }, // 老人Id
  33. oldIdNumber: { type: String }, // 老人身份证
  34. visitMessage: { type: String }, // 探访信息visitMessage
  35. visitLocation: { type: String }, // 探访位置(暂用一个字段) visitLocation
  36. visitPhoto: { type: String }, // 探访照片
  37. visitTime: { type: Date, default: Date.now }, // 探访时间
  38. oldInfo: { type: String }, // 老人信息
  39. lat: { type: String }, // 纬度
  40. lng: { type: String }, // 经度
  41. health: { type: String }, // 健康
  42. mind: { type: String }, // 精神
  43. security: { type: String }, // 安全
  44. hygiene: { type: String }, // 卫生
  45. live: { type: String }, // 居住
  46. demand: { type: String }, // 需求 ( 探访信息)
  47. infoOldType: { type: Array }, // 老年人类别
  48. infoOldAbility: { type: String }, // 老年人能力状况
  49. infoDemand: { type: Array }, // 关爱服务需求
  50. urgency: { type: String }, // 紧急程度
  51. });
  52. VisitSchema.index({ dept1: -1 }, { background: true, name: 'visit_dept1_-1' });
  53. return mongoose.model('Visit', VisitSchema, 'visit');
  54. };