Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- $match: {
- "creatorDeptId": {$exists: true},
- "claimCreate" : {$exists: true},
- "customClaimNumber" : {$exists: true},
- "currStatus.statusCode" : {$exists: true},
- "daysToDeadline" : {$exists: true},
- "service.name" : {$exists: true},
- "service.srguServicePassportId" : {$exists: true},
- "service.srguDepartmentName" : {$exists: true},
- "oktmo": { $regex: "^46" } ,
- "creatorDeptId": "mfc-odincovo",
- "claimCreate" : { $lte: { $date: "2016-10-07T23:59:59Z" }, $gte: { $date: "2016-10-01T00:00:00Z" } }
- }
- },
- {
- $project: {
- "claimCreate" : "$claimCreate",
- "customClaimNumber" : "$customClaimNumber",
- "guid": "$_id",
- "creatorDeptId": "$creatorDeptId",
- "service.srguServicePassportId" : "$service.srguServicePassportId",
- "currStatus.statusCode" : "$currStatus.statusCode",
- "person.fio": { $ifNull: [ "$person.fio" , "" ] },
- "person.orgName": { $ifNull: [ "$person.orgName" , "" ] },
- "service.srguDepartmentName":"$service.srguDepartmentName",
- "providerName" : "$providerName",
- "operatorFio" : "$operatorFio",
- "service.serviceType":"$service.serviceType",
- "placeOfIssue": "$placeOfIssue",
- "provLevel": "$provLevel",
- "serviceOrg":"$serviceOrg",
- "cons_true": { $cond: {if: { $eq: ["$consultation", true ] } , then: 1,else: 0} },
- "claim_true": { $cond: {if: { $eq: ["$consultation", false] } , then: 1,else: 0} },
- "urmName": { $ifNull: [ "$urmName" , "" ] },
- "urmNumber": { $ifNull: [ "$urmNumber" , "" ] },
- "currStatus.operatorFio": { $ifNull: [ "$currStatus.operatorFio" , "" ] },
- "total_takeClaimant" : { $cond: {if: {$or: [ {$eq:["$currStatus.statusCode", "24"]},{$eq:["$currStatus_statusCode", "24"]}] }, then: 1, else: 0}},
- "total_done" : { $cond: {if: {$or: [ {$eq:["$currStatus.statusCode", "4"]},{$eq:["$currStatus_statusCode", "3"]}] }, then: 1, else: 0}},
- "total_email" : { $cond: {if: {$eq:["$personsInfo.contacts.type", "EML"] }, then: 1, else: 0}},
- "total_deadline7" : { $cond: [ { $and: [ { $lt: ["$daysToDeadline", 0] }, { $gt: ["$daysToDeadline", -7] }, { $eq: ["$consultation", false] } ] }, 1, 0 ] },
- "total_deadline7_14" : { $cond: [ { $and: [ { $lt: ["$daysToDeadline", -7] }, { $gt: ["$daysToDeadline", -14] } , { $eq: ["$consultation", false] }] }, 1, 0 ] },
- "total_deadline14" : { $cond: [ { $and: [ { $lt: ["$daysToDeadline", -14] }, { $eq: ["$consultation", false] }] }, 1, 0 ]}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement