refactor: refatorando models de agendamento #334
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Documentação Completa do Novo Modelo de Agendamento
1. Visão Geral do Domínio
Modelo de Dados (ER)
erDiagram cadastro_anual ||--o{ agendamento : "possui" agendamento ||--o{ agendamento_gerado : "gera" agendamento_gerado ||--o{ falta : "pode ter" profissional { UUID id PK } cadastro_anual { UUID id PK UUID paciente_id Integer ano LocalDate data_inicio LocalDate data_fim UUID profissional_id FK } agendamento { UUID id PK UUID cadastro_anual_id FK Integer frequencia_dias LocalTime hora_consulta Boolean ativo LocalDate data_inicio LocalDate data_fim } agendamento_gerado { UUID id PK UUID agendamento_id FK LocalDateTime data_hora_agendada LocalDateTime data_hora_sobrescrita Boolean realizada Boolean cancelada String motivo_cancelamento UUID paciente_id } falta { UUID id PK UUID agendamento_gerado_id FK LocalDate data_falta String justificativa Boolean notificado }4. Fluxos Principais
4.1 Edição de Agendamento (Frequência ou Horário)
4.2 Edição Individual
data_hora_sobrescrita = nova datacancelada = true, motivo_cancelamentorealizada = trueNão afeta a regra
4.3 Renovação Anual
5. Performance & Estratégia
(paciente_id, data_hora_agendada),(agendamento_id)generateAppointments)Pageable+SliceEXEMPLO DE IMPLEMENTAÇÃO PARA SERVIR DE BASE – Implementação Java + JPA + PostgreSQL
1. Entidades
Professional.java
AnnualRegistration.java
Appointment.java
GeneratedAppointment.java
Absence.java
2. Repositórios
AnnualRegistrationRepository.java
AppointmentRepository.java
GeneratedAppointmentRepository.java
AbsenceRepository.java
3. Service Principal
AppointmentService.java