'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const VisitSchema = new Schema({ userid: { type: Schema.Types.ObjectId, ref: 'sysUser', }, // userName: { type: String }, // 探访员 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 }, // 戶Id infoId: { type: Schema.Types.ObjectId }, // 老人Id oldIdNumber: { type: String }, // 老人身份证 visitMessage: { type: String }, // 探访信息visitMessage visitLocation: { type: String }, // 探访位置(暂用一个字段) visitLocation visitPhoto: { type: String }, // 探访照片 visitTime: { type: Date, default: Date.now }, // 探访时间 oldInfo: { type: String }, // 老人信息 lat: { type: String }, // 纬度 lng: { type: String }, // 经度 health: { type: String }, // 健康 health1: { type: String }, // 健康-表达-新增 health2: { type: String }, // 健康-行动-新增 health3: { type: String }, // 健康-疾病情况-新增 health3Name: { type: String }, // 健康-疾病为严重时的病毒名称-新增 mind: { type: String }, // 精神 qxzt: { type: String }, // 情绪状态-新增 security: { type: String }, // 安全 security1: { type: String }, // 安全-燃气-新增 security2: { type: String }, // 安全-水暖-新增 security3: { type: String }, // 安全-用电-新增 hygiene: { type: String }, // 卫生 hygiene1: { type: String }, // 卫生-个人-新增 hygiene2: { type: String }, // 卫生-家庭-新增 live: { type: String }, // 居住 live1: { type: String }, // 居住-室内环境-新增 demand: { type: String }, // 需求 (探访信息) fwxq_rzylyxq: { type: String }, // 入住养老院需求-新增 fwxq_zyfw: { type: String }, // 助医服务-新增 fwxq_zxfw: { type: String }, // 助行服务-新增 fwxq_zjfw: { type: String }, // 助洁服务-新增 fwxq_zcfw: { type: String }, // 助餐服务-新增 fwxq_xzfw: { type: String }, // 洗澡服务-新增 fwxq_kffw: { type: String }, // 康复服务-新增 fwxq_jtcw: { type: String }, // 家庭床位-新增 fwxq_rzsqyljgxq: { type: String }, // 入住社区养老院需求-新增 fwxq_jkjcxq: { type: String }, // 健康检查需求-新增 fwxq_qtfwxq: { type: String }, // 其他服务需求-新增 fwxq_qtfwxqms: { type: String }, // 其他服务需求描述-新增 fwxq: { type: String }, // 需求-新增 fwjy: { type: String }, // 服务建议-新增 infoOldType: { type: Array }, // 老年人类别 infoOldAbility: { type: String }, // 老年人能力状况 infoDemand: { type: Array }, // 关爱服务需求 urgency: { type: String }, // 紧急程度 visitType: { type: Number, default: 1 }, // 探访方式-新增 familyNum: { type: String }, // 家庭人口-新增 spzj: { type: String }, // 视频主键-新增 }); VisitSchema.index({ dept1: 1 }, { background: true, name: 'visit_dept1_1' }); VisitSchema.index({ dept2: 1 }, { background: true, name: 'visit_dept2_1' }); VisitSchema.index({ dept3: 1 }, { background: true, name: 'visit_dept3_1' }); VisitSchema.index({ dept4: 1 }, { background: true, name: 'visit_dept4_1' }); VisitSchema.index({ dept5: 1 }, { background: true, name: 'visit_dept5_1' }); VisitSchema.index({ infoId: -1 }, { background: true, name: 'visit_infoId_1' }); VisitSchema.index({ visitTime: -1 }, { background: true, name: 'visit_time_1' }); VisitSchema.index({ userid: -1 }, { background: true, name: 'visit_userid_-1' }); VisitSchema.index({ oldIdNumber: -1 }, { background: true, name: 'visit_oldIdNumber_-1' }); return mongoose.model('Visit', VisitSchema, 'visit'); };