Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- $match: {
- $and: [
- {"daysToDeadline": {$exists: true}},
- {"currStatus": {$exists: true}},
- { "customClaimNumber" : {$exists: true}},
- {"service.name" : {$exists: true}},
- {"consultation": false},
- {"creatorDeptId": {$exists: true}},
- {"senderCode": {$exists: true}},
- {"currStatus": {$exists: true}},
- {"service.srguServiceId": {$exists: true}},
- { "oktmo": { $regex: "^46" } }
- ],
- $or: [
- {"claimCreate" : { $lte: { $date:"2016-08-31T23:59:59Z" }, $gte: { $date: "2016-08-01T00:00:00Z" } }},
- {"docSendDate" : { $lte: { $date:"2016-08-31T23:59:59Z" }, $gte: { $date: "2016-08-01T00:00:00Z" } }}
- ]
- }
- },
- {
- $project: {
- "creatorDeptId" : "$creatorDeptId",
- "senderCode" : "$senderCode",
- "srguServiceId":"$service.srguServiceId",
- "oktmo": { $substr: [ "$oktmo", 0, 5 ] },
- "provLevel": { $ifNull: [ "$provLevel" , "" ] },
- "resultStatus": { $ifNull: [ "$resultStatus" , "" ] },
- "daysToDeadline": "$daysToDeadline",
- "OMSU" : { $substr: [ "$creatorDeptId", 0, 4 ] },
- "in_Close": { $and: [
- { $lte: [ "$docSendDate", { $date: "2016-08-31T23:59:59Z" } ] },
- { $gte: [ "$docSendDate", { $date: "2016-08-01T00:00:00Z" } ] } ] },
- "in_Create": { $and: [
- { $lte: [ "$claimCreate", { $date: "2016-08-31T23:59:59Z" } ] },
- { $gte: [ "$claimCreate", { $date: "2016-08-01T00:00:00Z" } ] } ] }
- }
- },
- {
- $group: {
- _id: { "oktmo": "$oktmo" ,"srguServiceId": "$srguServiceId"},
- a_completed : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] } ] }, 1, 0 ] } },
- a_completed_neg : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] }, {$eq: ["$resultStatus", "4" ]} ] }, 1, 0 ] } },
- a_completed_pos : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] }, {$eq: ["$resultStatus", "3" ]} ] }, 1, 0 ] } },
- a_completed_exp : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] }, {$lt: ["$daysToDeadline", 0 ]} ] }, 1, 0 ] } },
- a_completed_MFC : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] }, {$eq: ["$OMSU", "mfc-" ]}, {$ne: ["$senderCode", "IPGU01001" ]} ] }, 1, 0 ] } },
- a_completed_RPGU : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] }, {$eq: ["$senderCode", "IPGU01001" ]} ] }, 1, 0 ]} },
- a_completed_OMSU : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Close", true] }, {$eq: ["$OMSU", "omsu" ]}, {$ne: ["$senderCode", "IPGU01001" ]} ] }, 1, 0 ] } },
- b_completed : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] } ] }, 1, 0 ] } },
- b_completed_exp : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$lt: ["$daysToDeadline", 0 ]} ] }, 1, 0 ] } },
- b_completed_MFC : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$eq: ["$OMSU", "mfc-" ]}, {$ne: ["$senderCode", "IPGU01001" ]} ] }, 1, 0 ]} },
- b_completed_MFC_exp : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$eq: ["$OMSU", "mfc-" ]}, {$ne: ["$senderCode", "IPGU01001" ]}, {$lt: ["$daysToDeadline", 0 ]} ] }, 1, 0 ]} },
- b_completed_RPGU : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$eq: ["$senderCode", "IPGU01001" ]} ] }, 1, 0 ]} },
- b_completed_RPGU_exp : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$eq: ["$senderCode", "IPGU01001" ]}, {$lt: ["$daysToDeadline", 0 ]} ] }, 1, 0 ]} },
- b_completed_OMSU : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$eq: ["$OMSU", "omsu" ]},{$ne: ["$senderCode", "IPGU01001" ]} ] }, 1, 0 ] } },
- b_completed_OMSU_exp : { $sum: { $cond: [ { $and: [ { $eq: ["$in_Create", true] }, {$eq: ["$OMSU", "omsu" ]},{$ne: ["$senderCode", "IPGU01001" ]}, {$lt: ["$daysToDeadline", 0 ]} ] }, 1, 0 ] } }
- }
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement