Skip to content

Estadisticas

Mariano Botta edited this page Aug 20, 2019 · 1 revision

Estadisticas básicas para Castro Rendom

Se pued cambiar el ObjectId para otro efector

Cantidad de especialidades

db.getCollection('agenda').aggregate([
{ $match:  {  'organizacion._id' : ObjectId("57e9670e52df311059bc8964") } },
{ $unwind: '$tipoPrestaciones' },
{ $group: { _id: '$tipoPrestaciones.conceptId' } },
{ $group: { _id: null, 'total': {$sum: 1} } }
])

Cantidad de pacientes atendidos

db.getCollection('prestaciones').aggregate([
{ $match: { 'solicitud.organizacion.id': ObjectId("57e9670e52df311059bc8964") } },
 { $group: { _id: '$paciente.id' } },
    { $group: { _id: null, total: { $sum: 1 }  } }
])

Cantidad de consultas

db.getCollection('prestaciones').aggregate([
{ $match: { 'solicitud.organizacion.id': ObjectId("57e9670e52df311059bc8964"),
   'estados.tipo': 'validada'
   
    } },
    { $group: { _id: null, total: { $sum: 1 }  } }
])

Cantidad de usuarios

db.getCollection('authUsers').find({'organizaciones._id': ObjectId("57e9670e52df311059bc8964")}).count()

Cantidad de registros

db.getCollection('prestaciones').aggregate([
{ $match: { 'solicitud.organizacion.id': ObjectId("57e9670e52df311059bc8964"),
   'estados.tipo': 'validada'
   
    } },
    { $unwind: '$ejecucion.registros' },
    { $group: { _id: null, total: { $sum: 1 }  } }
])