-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#348 Relatório de agendamentos de pacientes
- Loading branch information
1 parent
7d86276
commit 56e2ccb
Showing
24 changed files
with
836 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
package br.com.nivlabs.cliniv.controller; | ||
|
||
import br.com.nivlabs.cliniv.models.dto.*; | ||
import br.com.nivlabs.cliniv.repository.custom.CustomFilters; | ||
import br.com.nivlabs.cliniv.service.report.ReportService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.domain.Pageable; | ||
|
@@ -8,30 +13,12 @@ | |
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import br.com.nivlabs.cliniv.models.dto.DigitalDocumentDTO; | ||
import br.com.nivlabs.cliniv.models.dto.FileDTO; | ||
import br.com.nivlabs.cliniv.models.dto.ReportGenerationRequestDTO; | ||
import br.com.nivlabs.cliniv.models.dto.ReportLayoutDTO; | ||
import br.com.nivlabs.cliniv.models.dto.ReportLayoutInfoDTO; | ||
import br.com.nivlabs.cliniv.repository.custom.CustomFilters; | ||
import br.com.nivlabs.cliniv.service.report.ReportService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
/** | ||
* Classe ReportController.java | ||
* | ||
* | ||
* @author <a href="mailto:[email protected]">Caroline Aguiar</a> | ||
* | ||
* @since 24 de janeiro de 2021 | ||
*/ | ||
@Tag(name = "Relatórios", description = "Endpoint - Gerador de relatórios") | ||
|
@@ -44,7 +31,7 @@ public class ReportController extends BaseController<ReportService> { | |
@PreAuthorize("hasAnyRole('RELATORIO_ESCRITA', 'RELATORIO_LEITURA', 'ADMIN')") | ||
public ResponseEntity<Page<ReportLayoutDTO>> findList(CustomFilters filters) { | ||
Pageable pageSettings = PageRequest.of(filters.getPage(), filters.getSize(), Direction.valueOf(filters.getDirection()), | ||
filters.getOrderBy()); | ||
filters.getOrderBy()); | ||
return ResponseEntity.ok(service.findPageOfReportLayout(pageSettings)); | ||
} | ||
|
||
|
@@ -68,7 +55,7 @@ public ResponseEntity<ReportLayoutInfoDTO> persist(@Validated @RequestBody(requi | |
public ResponseEntity<DigitalDocumentDTO> generateReport(@Validated @RequestBody(required = true) ReportGenerationRequestDTO reportParam, | ||
@PathVariable("id") Long id) { | ||
|
||
return ResponseEntity.status(HttpStatus.CREATED).body(service.generateDocumentFromReportLayout(id, reportParam)); | ||
return ResponseEntity.status(HttpStatus.CREATED).body(service.generateDocumentFromReportLayout(id, true, reportParam)); | ||
} | ||
|
||
@Operation(summary = "report-layout-delete", description = "Deleta um layout de relatório baseado no identificador") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,31 @@ | ||
package br.com.nivlabs.cliniv.controller.patient; | ||
|
||
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import br.com.nivlabs.cliniv.controller.BaseController; | ||
import br.com.nivlabs.cliniv.controller.filters.PatientFilters; | ||
import br.com.nivlabs.cliniv.enums.DocumentType; | ||
import br.com.nivlabs.cliniv.event.CreatedResourceEvent; | ||
import br.com.nivlabs.cliniv.exception.HttpException; | ||
import br.com.nivlabs.cliniv.models.dto.DigitalDocumentDTO; | ||
import br.com.nivlabs.cliniv.models.dto.PatientAppointmentsReportRequestDTO; | ||
import br.com.nivlabs.cliniv.models.dto.PatientDTO; | ||
import br.com.nivlabs.cliniv.models.dto.PatientInfoDTO; | ||
import br.com.nivlabs.cliniv.service.patient.PatientService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
/** | ||
* | ||
* Classe PatientController.java | ||
* | ||
* @author <a href="[email protected]">Caroline Aguiar</a> | ||
* | ||
* @since 8 de set de 2019 | ||
*/ | ||
@Tag(name = "Paciente", description = "Endpoint - Operações com Paciente") | ||
|
@@ -61,7 +53,6 @@ public ResponseEntity<PatientInfoDTO> persist(@Validated @RequestBody(required = | |
publisher.publishEvent(new CreatedResourceEvent(this, response, createdPatient.getId())); | ||
|
||
return ResponseEntity.status(HttpStatus.CREATED).body(createdPatient); | ||
|
||
} | ||
|
||
@Operation(summary = "patient-put", description = "Atualiza um paciente na aplicação") | ||
|
@@ -80,7 +71,7 @@ public ResponseEntity<PatientInfoDTO> findById(@PathVariable("id") Long id) { | |
} | ||
|
||
@Operation(summary = "patient-get-by-document", description = "Busca um paciente pelo documento") | ||
@GetMapping("{documentType}/{document}") | ||
@GetMapping("/{documentType}/{document}") | ||
@PreAuthorize("hasAnyRole('PACIENTE_LEITURA', 'PACIENTE_ESCRITA', 'ATENDIMENTO_ESCRITA', 'ATENDIMENTO_LEITURA', 'ADMIN')") | ||
public ResponseEntity<PatientInfoDTO> findByDocument(@PathVariable("documentType") DocumentType documentType, | ||
@PathVariable("document") String document) { | ||
|
@@ -93,4 +84,13 @@ public ResponseEntity<PatientInfoDTO> findByDocument(@PathVariable("documentType | |
throw new HttpException(HttpStatus.UNPROCESSABLE_ENTITY, "Tipo de documento desconhecido, esperados: [CPF | SUS]"); | ||
} | ||
} | ||
|
||
@Operation(summary = "patient-appointments-report-post", description = "Gera um documento digital com todos os agendamentos do paciente em um intervalo entre datas") | ||
@PostMapping("/{patientId}/reports/appointments") | ||
@PreAuthorize("hasAnyRole('PACIENTE_LEITURA', 'ATENDIMENTO_LEITURA', 'ADMIN')") | ||
public ResponseEntity<DigitalDocumentDTO> generateAppointmentsReport(@Validated @RequestBody(required = true) PatientAppointmentsReportRequestDTO request, | ||
@PathVariable("patientId") Long patientId) { | ||
return ResponseEntity.status(HttpStatus.OK).body(service.generateAppointmentsReport(patientId, request)); | ||
} | ||
|
||
} |
46 changes: 38 additions & 8 deletions
46
src/main/java/br/com/nivlabs/cliniv/enums/AppointmentStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,46 @@ | ||
package br.com.nivlabs.cliniv.enums; | ||
|
||
import br.com.nivlabs.cliniv.exception.HttpException; | ||
import br.com.nivlabs.cliniv.util.StringUtils; | ||
import org.springframework.http.HttpStatus; | ||
|
||
/** | ||
* Enumerado para situação do agendamento | ||
* | ||
* @author viniciosarodrigues | ||
* | ||
* @author viniciosarodrigues | ||
*/ | ||
public enum AppointmentStatus { | ||
WAITING_CONFIRMATION, // Aguardando confirmação do paciente | ||
CONFIRMED, // Paciente confirmou | ||
COMPLETED, // Paciente compareceu | ||
CANCELED, // Paciente cancelou | ||
MISSED, // Paciente faltou | ||
RESCHEDULED // Paciente remarcou | ||
WAITING_CONFIRMATION("WAITING_CONFIRMATION", "Aguardando confirmação do paciente"), | ||
CONFIRMED("CONFIRMED", "Paciente confirmou"), | ||
COMPLETED("COMPLETED", "Paciente compareceu"), | ||
CANCELED("CANCELED", "Paciente cancelou"), | ||
MISSED("MISSED", "Paciente faltou"), | ||
RESCHEDULED("RESCHEDULED", "Paciente remarcou"); | ||
|
||
final private String name; | ||
final private String description; | ||
|
||
private AppointmentStatus(String name, String description) { | ||
this.name = name; | ||
this.description = description; | ||
} | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
public AppointmentStatus toEnum(String statusName) { | ||
if (StringUtils.isNullOrEmpty(statusName)) | ||
return null; | ||
else | ||
for (AppointmentStatus status : AppointmentStatus.values()) | ||
if (status.name.equalsIgnoreCase(statusName)) | ||
return status; | ||
throw new HttpException(HttpStatus.BAD_REQUEST, "Situação não encontrada: ".concat(statusName)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,47 @@ | ||
package br.com.nivlabs.cliniv.enums; | ||
|
||
import br.com.nivlabs.cliniv.exception.HttpException; | ||
import br.com.nivlabs.cliniv.util.StringUtils; | ||
import org.springframework.http.HttpStatus; | ||
|
||
/** | ||
* Tipos sanguíneos conhecidos | ||
* | ||
* @author viniciosarodrigues | ||
* | ||
* @author viniciosarodrigues | ||
*/ | ||
public enum BloodType { | ||
|
||
A_POSITIVE, | ||
B_POSITIVE, | ||
AB_POSITIVE, | ||
O_POSITIVE, | ||
A_NEGATIVE, | ||
B_NEGATIVE, | ||
AB_NEGATIVE, | ||
O_NEGATIVE | ||
A_POSITIVE("A_POSITIVE", "A+"), | ||
B_POSITIVE("B_POSITIVE", "B+"), | ||
AB_POSITIVE("AB_POSITIVE", "AB+"), | ||
O_POSITIVE("O_POSITIVE", "O+"), | ||
A_NEGATIVE("A_NEGATIVE", "A-"), | ||
B_NEGATIVE("B_NEGATIVE", "B-"), | ||
AB_NEGATIVE("AB_NEGATIVE", "AB-"), | ||
O_NEGATIVE("O_NEGATIVE", "O-"); | ||
final private String name; | ||
final private String description; | ||
|
||
private BloodType(String name, String description) { | ||
this.name = name; | ||
this.description = description; | ||
} | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
public BloodType toEnum(String bloodType) { | ||
if (StringUtils.isNullOrEmpty(bloodType)) | ||
return null; | ||
else | ||
for (BloodType type : BloodType.values()) | ||
if (type.name.equalsIgnoreCase(bloodType)) | ||
return type; | ||
throw new HttpException(HttpStatus.BAD_REQUEST, "Tipo sanguíneo não encontrada: ".concat(bloodType)); | ||
} | ||
} |
45 changes: 35 additions & 10 deletions
45
src/main/java/br/com/nivlabs/cliniv/enums/EthnicGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,39 @@ | ||
package br.com.nivlabs.cliniv.enums; | ||
|
||
import br.com.nivlabs.cliniv.exception.HttpException; | ||
import br.com.nivlabs.cliniv.util.StringUtils; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public enum EthnicGroup { | ||
// Branco | ||
WHITE, | ||
// Pardo | ||
MULTIRACIAL, | ||
// Preto | ||
BLACK, | ||
// Índio | ||
INDIANS, | ||
// Amarelo - Asiático | ||
YELLOW | ||
WHITE("WHITE", "Branco"), | ||
MULTIRACIAL("MULTIRACIAL", "Pardo"), | ||
BLACK("BLACK", "Preto"), | ||
INDIANS("INDIANS", "Índio"), | ||
YELLOW("YELLOW", "Amarelo - Asiático"); | ||
|
||
final private String name; | ||
final private String description; | ||
|
||
private EthnicGroup(String name, String description) { | ||
this.name = name; | ||
this.description = description; | ||
} | ||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
public EthnicGroup toEnum(String ethnicGroup) { | ||
if (StringUtils.isNullOrEmpty(ethnicGroup)) | ||
return null; | ||
else | ||
for (EthnicGroup group : EthnicGroup.values()) | ||
if (group.name.equalsIgnoreCase(ethnicGroup)) | ||
return group; | ||
throw new HttpException(HttpStatus.BAD_REQUEST, "Grupo étnico não encontrada: ".concat(ethnicGroup)); | ||
} | ||
} |
Oops, something went wrong.