Skip to content

Conversation

@hugofranca06
Copy link
Contributor

PR: Estatísticas de Pacientes por Estado

📋 Descrição

Novo endpoint /statistics/patients-by-state que retorna distribuição de pacientes por UF, filtrando apenas pacientes com encaminhamentos destinados.

🔗 Endpoint

GET /statistics/patients-by-state
Roles: manager, nurse

📊 Parâmetros

Parâmetro Tipo Default Descrição
period string - last-year, last-month, last-week, last_30_days
limit number 10 Limite de resultados
order string DESC ASC ou DESC
withPercentage boolean false Incluir % na resposta

🚀 Mudanças Principais

  • Schema: Adicionado state ao enum PATIENTS_STATISTIC_FIELDS
  • DTO: Criado GetPatientsByStateDto
  • Repository: Método getPatientsByState() com filtro referred_to IS NOT NULL
  • Service: Implementado getPatientsByState() no StatisticsService
  • Controller: Novo endpoint com documentação Swagger
  • Utils: Suporte para período last_30_days

✅ Exemplo de Response

{
  "success": true,
  "message": "Estatísticas de pacientes por estado retornada com sucesso.",
  "data": {
    "states": [
      { "state": "SP", "total": 45, "percentage": 32.1 }
    ],
    "total": 140
  }
}

@julianosill julianosill merged commit 3bd6aac into dev Dec 7, 2025
2 checks passed
@julianosill julianosill deleted the feature/create-location-statistics-by-state branch December 7, 2025 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants