'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const InfoSchema = 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', }, userid: { type: Schema.Types.ObjectId, ref: 'sysUser', }, // userName: { type: String }, // 采集员 status: { type: String, default: '0' }, // 状态 fid: { type: Schema.Types.ObjectId, ref: 'Family' }, // 户id time: { type: Date, default: Date.now }, // 采集信息----老人,子女,赡养人信息,巡访联系人信息 name: { type: String }, // 姓名 sex: { type: String }, // 性别 nation: { type: String }, // 民族 idNumber: { type: String }, // 身份证号 birthday: { type: String }, // 生日 phone: { type: String }, // 联系电话 address: { type: String }, // 现居地址 必填 addressId: { type: String }, // 现居地址对应的id 必填 addressExt: { type: String }, // 现居地址详细 -- 非必填 isSameWithAddress: { type: String }, // 是否户籍地址和现居地址一致 //去掉了 nativePlace: { type: String }, // 户籍地址 必填 nativePlaceId: { type: String }, // 户籍地址对应的id 必填 nativePlaceExt: { type: String }, // 户籍地址详细 -- 非必填 partnerState: { type: String }, // 婚姻及配偶情况 已婚:必填 配偶姓名 配偶身份证号 partnerName: { type: String }, // 配偶姓名 partnerIdNumber: { type: String }, // 配偶身份证号 isLoss: { type: String }, // 是否为失独家庭 health: { type: Array }, // 健康状况 如果这个是残疾 残疾类别 残疾等级必填 多选 majorDiseases: { type: Array }, // 重特大疾病类别 disabilityCategory: { type: Array }, // 残疾类别 多选 disabilityLevel: { type: String }, // 残疾等级 ability: { type: String }, // 老年人能力状况 --必选 livingCondition: { type: String }, // 生活经济状况 sourceOfIncome: { type: Array }, // 收入来源 收入来源里如果有其它 那么收入来源---其他必填 多选 sourceOfIncomeExt: { type: String }, // 收入来源---其他 income: { type: String }, // 本人上年度可支配收入 rescueState: { type: Array }, // 家庭救助帮扶情况 多选 rescueStateExt: { type: String }, // 家庭救助帮扶情况---其他 非必填 accompany: { type: Array }, // 陪伴居住情况 陪伴居住情况如果有其他 那么陪伴居住情况---其他必填 无人陪伴居住 多选 accompanyExt: { type: String }, // 陪伴居住情况-其他 lookAfter: { type: Array }, // 日常生活照料人 多选 // 1.日常生活照料人如果有其他 那么日常生活照料人 ---其他必填 , // 2.如果日常生活照料人不是无人照料 主要照料人姓名,主要照料人性别,主要照料人电话 必填 lookAfterExt: { type: String }, // 日常生活照料人---其他 mainLookName: { type: String }, // 主要照料人姓名 mainLookSex: { type: String }, // 主要照料人性别 mainLookPhone: { type: String }, // 主要照料人电话 demand: { type: Array }, // 关爱服务需求 关爱服务需求如果有其它 那么关爱服务需求---其他必填 demandExt: { type: String }, // 关爱服务需求---其他 // oldType: { type: String }, // 老年人类别 oldType: { type: Array }, // 老年人类别 photo: { type: String }, // 老人照片 photoAndLocation: { type: String }, // 老人定位 childrenNum: { type: String }, // 子女数量 当数量不是0的时候 子女信息必填 childInfo: { type: String }, // 子女信息 以json形式存储 // 1.[{ // name: 姓名, // phone:常用联系电话, // isHasGoOut:子女是否外出 // outgoingplace:外出地点 // isHasPartner:是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0:是 1:否 // name2:子女配偶姓名 // phone2:子女配偶电话 // outgoingTime:最后一次离家时间 // outgoingCause:外出原因 // visit:平均一年探望次数 // }] // isHasOther: { type: String }, // 是否有其他赡养人 是的时候 其他赡养人必填 otherInfo: { type: String }, // 其他赡养人 信息 以json形式存储 // 1.{ // name: 其他赡养人姓名, // sex:其他赡养人性别 // phone:其他赡养人电话, // relation:与被赡养人关系 如果选了其他也是必填 单选 // relationExt 与被赡养人关系--其他 // outgoingplace:外出地点 // outgoingTime:最后一次离家时间 // visit:平均一年探望次数 // } regularsInfo: { type: String }, // 巡访联系人信息 以json形式存储 // 1.{ // visitMode:巡访方式 如果选了其他也是必填 多选 // visitModeExt: 巡访方式--其它 // visitCount:巡访频次,如果选了其他也是必填 单选 // visitCountExt:巡访频次--其它 // } pic: { type: String }, // 二维码地址 remark: { type: String }, // 审核备注 syncStatus: { type: Number }, // 同步状态 eightType: { type: Number, default: 0 }, // 是否为八类老年人-CH-新增 online: { type: String }, // 离线状态 // 默认false 离线状态 isDeath: { type: Number, default: 0 }, partyMember: { type: Number, default: 0 }, // 党员 2022-3-3 添加 ownerId: { type: String }, // 自主填报用户的openid // openId: { type: Array }, // 赡养人微信openid }); InfoSchema.index({ dept3: 1 }, { background: true, name: 'info_dept3_1' }); InfoSchema.index({ fid: 1 }, { background: true, name: 'info_fid_1' }); InfoSchema.index({ userid: -1 }, { background: true, name: 'info_userid_-1' }); InfoSchema.index({ name: 1 }, { background: true, name: 'info_name_1' }); InfoSchema.index({ idNumber: 1 }, { background: true, name: 'info_idNumber_1' }); InfoSchema.index({ phone: 1 }, { background: true, name: 'info_phone_1' }); return mongoose.model('Info', InfoSchema, 'info'); };