'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const conn = app.mongooseDB.get('etlLocalDB'); // 驾驶行为数据结构 本地清洗 数据结构 const DrivingBehaviorInfoSchema2 = new Schema({ create_date: { type: Number }, // 统计的数据是哪一天的 year: { type: Number }, // 年 统计的数据 month: { type: Number }, // 月 统计的数据 day: { type: Number }, // 日 统计的数据 dateString: { type: String }, // 时间字符串 yyyy-MM-dd start_time: { type: Date }, // 开始统计时间 end_time: { type: Date, default: Date.now }, // 结束统计时间 data: [ { _id: { series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 count: { type: Number }, // 有几辆车 batterySoc: { type: Number }, // 蓄电池电量% engineSpeed: { type: Number }, // 发动机转速rpm insideTemperature: { type: Number }, // 室内温度° outsideTemperature: { type: Number }, // 室外温度° powerBatterySoc: { type: Number }, // 动力电池% chargeDuration: { type: Number }, // 充电时长h chargeCnt: { type: Number }, // 充电次数 skyDuration: { type: Number }, // 天窗时长min headlightCnt: { type: Number }, // 近光次数 highBeamCnt: { type: Number }, // 远光次数 headlightDuration: { type: Number }, // 近光时长min highBeamDuration: { type: Number }, // 远光时长min airDuration: { type: Number }, // 空调使用时长(毫秒) onCompressorDuration: { type: Number }, // 空调状态和压缩机均打开使用时长(毫秒) offCompressorDuration: { type: Number }, // 空调状态开压缩机关使用时长(毫秒) onAutoDuration: { type: Number }, // 激活且空调开启时长(毫秒) offAutoDuration: { type: Number }, // 关闭且空调开启时长(毫秒) blowerRatingOneDuration: { type: Number }, // 吹风等级1时长(毫秒) blowerRatingTwoDuration: { type: Number }, // 吹风等级2时长(毫秒) blowerRatingThreeDuration: { type: Number }, // 吹风等级3时长(毫秒) blowerRatingFourDuration: { type: Number }, // 吹风等级4时长(毫秒) blowerRatingOtherDuration: { type: Number }, // 吹风等级其他时长(毫秒) dsmCnt: { type: Number }, // 疲劳驾驶次数 atNightDriveCnt: { type: Number }, // 深夜出行次数 atNightDriveDuration: { type: Number }, // 深夜出行时长h atNightDriveMileage: { type: Number }, // 深夜出行里程km morningPeakDuration: { type: Number }, // 早高峰时长h morningPeakMileage: { type: Number }, // 早高峰里程km eveningPeakDuration: { type: Number }, // 晚高峰时长h eveningPeakMileage: { type: Number }, // 晚高峰里程km }, ], oilProvince: [{ _id: { _id: { type: String }, // 省code series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 name: { type: String }, // 省名称 oil: { type: Number }, // 总油耗 mileage: { type: Number }, // 总公里 }], // 油耗分布 oilCity: [{ _id: { _id: { type: String }, // 市code fid: { type: String }, // 省code series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 name: { type: String }, // 市名称 oil: { type: Number }, // 总油耗 mileage: { type: Number }, // 总公里 }], // 油耗分布 driveDuration: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 驾驶时长 avgSpeed: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 平均车速 mileageCnt2: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆行程次数 用于 周末和工作日统计 mileage2: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 日行驶里程 mileageAvg: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 平均行驶里程 supplementaryCnt: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 补传次数 batterySoc: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 蓄电池电量 engineSpeed: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 发动机转速 insideTemperature: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 室内温度 outsideTemperature: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 室外温度 powerBatterySoc: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 动力电池 chargeDuration: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电时长 chargeStartSoc: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电初始SOC chargeEndSoc: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电结束SOC chargePreStartMileage: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电时车辆可行驶里程 chargeStartTime: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电初始时刻 chargeType: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电模式分布 chargeMileage: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 两次充电间行驶里程分布 avgSpeedPower: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 不同车速区间耗电占比 actualMileage: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 实际续航里程分布 mileageCnt: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆行程次数 mileageCntMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆行程月次数 mileageCntYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆行程年次数 mileage: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 行驶里程 mileageMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 月行驶里程 mileageYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 年行驶里程 chargeCnt: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电次数占比分布 chargeCntMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电次数月占比分布 chargeCntYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 充电次数年占比分布 skyDuration: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆天窗时长占比分布 skyDurationMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆天窗时长月占比分布 skyDurationYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 车辆天窗时长年占比分布 headlightCnt: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 近光使用次数占比分布 headlightCntMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 近光使用次数月占比分布 headlightCntYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 近光使用次数年占比分布 highBeamCnt: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 远光使用次数占比分布 highBeamCntMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 远光使用次数月占比分布 highBeamCntYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 远光使用次数年占比分布 headlightDuration: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 近光使用时长占比分布 headlightDurationMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 近光使用时长月占比分布 headlightDurationYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 近光使用时长年占比分布 highBeamDuration: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 远光使用时长占比分布 highBeamDurationMonth: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 远光使用时长月占比分布 highBeamDurationYear: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 远光使用时长年占比分布 mileageStartTimeAndDsm: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 dsmCount: { type: Number }, // 疲劳数量 }, ], // 用户出行时间/用户疲劳驾驶次数 占比 mileageSingle: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 单次行驶里程统计 maxAcce: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 单次行程中最大加速度 maxDece: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 单次行程中最大减速度 sideAcce: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 单次行程最大侧向加速度 continuousDrive: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 持续驾驶 driveStyle: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 驾驶风格 drivingSafetyScore: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 驾驶安全得分 energyConservationScore: [ { _id: { _id: { type: String }, series_code: { type: String }, model_code: { type: String }, }, // 分组 车型 车系 和分段 count: { type: Number }, // 数量 }, ], // 日驾驶行为节能平均得分 }); DrivingBehaviorInfoSchema2.index({ create_date: -1 }); return conn.model('DrivingBehaviorInfo2', DrivingBehaviorInfoSchema2, 'lc_driving_behavior_info'); };