From 59fe70c7a0f1c012eb6cd5d8bfbbb5cefc173e2e Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Fri, 1 Nov 2024 22:22:58 +0900 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20=EC=B0=A8=ED=8A=B8=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=20request=20=EB=B3=80=EA=B2=BD=20-=20=EA=B8=B0?= =?UTF-8?q?=EC=A1=B4=20recipient=20=EA=B0=9D=EC=B2=B4=EC=97=90=EC=84=9C=20?= =?UTF-8?q?recipientId=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20-=20id=EB=A1=9C=20r?= =?UTF-8?q?ecipient=20=EA=B0=9D=EC=B2=B4=20=EC=B0=BE=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CareWorkerChartController.java | 18 ++++-- .../dbdr/domain/chart/dto/ChartMapper.java | 56 ++++++++++-------- .../chart/dto/request/ChartDetailRequest.java | 35 ++++++----- .../recipient/service/RecipientService.java | 58 +++++++++---------- src/test/java/dbdr/chart/ChartMapperTest.java | 54 ++++++++++------- 5 files changed, 123 insertions(+), 98 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/controller/CareWorkerChartController.java b/src/main/java/dbdr/domain/chart/controller/CareWorkerChartController.java index 2e002b49..837edc61 100644 --- a/src/main/java/dbdr/domain/chart/controller/CareWorkerChartController.java +++ b/src/main/java/dbdr/domain/chart/controller/CareWorkerChartController.java @@ -7,6 +7,8 @@ import dbdr.domain.chart.service.ChartService; import dbdr.global.util.api.ApiUtils; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -33,9 +35,11 @@ public class CareWorkerChartController { private final ChartService chartService; - @Operation(summary = "돌봄대상자 아이디로 차트 정보 조회") + @Operation(summary = "돌봄대상자 아이디로 차트 정보 조회", + security = @SecurityRequirement(name = "JWT")) @GetMapping("/recipient") public ResponseEntity>> getAllChartByRecipientId( + @Parameter(hidden = true) @RequestParam(value = "recipient-id", required = false) Long recipientId, @PageableDefault(size = DEFAULT_PAGE_SIZE, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) { // 환자 정보 접근 권한 확인 로직 필요 -> 요양사가 맡은 환자 정보만 조회 가능 @@ -43,7 +47,8 @@ public ResponseEntity>> getAllChart return ResponseEntity.ok(ApiUtils.success(recipients)); } - @Operation(summary = "차트 아이디로 차트 정보 조회") + @Operation(summary = "차트 아이디로 차트 정보 조회", + security = @SecurityRequirement(name = "JWT")) @GetMapping("/{chartId}") public ResponseEntity> getChartById(@PathVariable("chartId") Long chartId) { // 환자 정보 접근 권한 확인 로직 필요 -> 요양사가 맡은 환자 정보만 조회 가능 @@ -51,7 +56,8 @@ public ResponseEntity> getChartById(@Pat return ResponseEntity.ok(ApiUtils.success(chart)); } - @Operation(summary = "차트 추가") + @Operation(summary = "차트 추가", + security = @SecurityRequirement(name = "JWT")) @PostMapping public ResponseEntity> saveChart(@RequestBody ChartDetailRequest request) { // 환자 정보 접근 권한 확인 로직 필요 -> 요양사가 맡은 환자 정보만 저장 가능 @@ -59,7 +65,8 @@ public ResponseEntity> saveChart(@Reques return ResponseEntity.status(HttpStatus.CREATED).body(ApiUtils.success(chart)); } - @Operation(summary = "차트 아이디로 차트 수정") + @Operation(summary = "차트 아이디로 차트 수정", + security = @SecurityRequirement(name = "JWT")) @PutMapping("/{chartId}") public ResponseEntity> updateChart(@PathVariable("chartId") Long chartId, @RequestBody ChartDetailRequest request) { @@ -68,7 +75,8 @@ public ResponseEntity> updateChart(@Path return ResponseEntity.ok(ApiUtils.success(chart)); } - @Operation(summary = "차트 아이디로 차트 삭제") + @Operation(summary = "차트 아이디로 차트 삭제", + security = @SecurityRequirement(name = "JWT")) @DeleteMapping("/{chartId}") public ResponseEntity> deleteChart(@PathVariable("chartId") Long chartId) { // 환자 정보 접근 권한 확인 로직 필요 -> 요양사가 맡은 환자 정보만 삭제 가능 diff --git a/src/main/java/dbdr/domain/chart/dto/ChartMapper.java b/src/main/java/dbdr/domain/chart/dto/ChartMapper.java index 83fb04a9..0f053647 100644 --- a/src/main/java/dbdr/domain/chart/dto/ChartMapper.java +++ b/src/main/java/dbdr/domain/chart/dto/ChartMapper.java @@ -15,37 +15,47 @@ import dbdr.domain.chart.entity.CognitiveManagement; import dbdr.domain.chart.entity.NursingManagement; import dbdr.domain.chart.entity.RecoveryTraining; +import dbdr.domain.recipient.entity.Recipient; +import dbdr.domain.recipient.service.RecipientService; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; +import org.springframework.beans.factory.annotation.Autowired; @Mapper(componentModel = "spring") -public interface ChartMapper { +public abstract class ChartMapper { + @Autowired + private RecipientService recipientService; + @Mappings({ @Mapping(source = "bodyManagement", target = "bodyManagement"), @Mapping(target = "chartId", source = "id")}) - ChartDetailResponse toResponse(Chart chart); + public abstract ChartDetailResponse toResponse(Chart chart); @Mappings({ - @Mapping(target = "bodyManagement", source = "bodyManagement"), - @Mapping(target = "nursingManagement", source = "nursingManagement"), - @Mapping(target = "cognitiveManagement", source = "cognitiveManagement"), - @Mapping(target = "recoveryTraining", source = "recoveryTraining"), - @Mapping(target = "conditionDisease", source = "conditionDisease"), - @Mapping(target = "recipient", source = "recipient") + @Mapping(target = "bodyManagement", source = "bodyManagement"), + @Mapping(target = "nursingManagement", source = "nursingManagement"), + @Mapping(target = "cognitiveManagement", source = "cognitiveManagement"), + @Mapping(target = "recoveryTraining", source = "recoveryTraining"), + @Mapping(target = "conditionDisease", source = "conditionDisease"), + @Mapping(target = "recipient", source = "recipientId") }) - Chart toEntity(ChartDetailRequest request); + public abstract Chart toEntity(ChartDetailRequest request); + + protected Recipient mapRecipient(Long recipientId) { + return recipientService.findRecipientById(recipientId); + } // BodyManagement 매핑 @Mappings({ - @Mapping(target = "wash", source = "physicalClear.wash"), - @Mapping(target = "bath", source = "physicalClear.bath"), - @Mapping(target = "mealType", source = "physicalMeal.mealType"), - @Mapping(target = "intakeAmount", source = "physicalMeal.intakeAmount"), - @Mapping(target = "has_walked", source = "physicalWalk.hasWalked"), - @Mapping(target = "has_companion", source = "physicalWalk.hasCompanion"), + @Mapping(target = "wash", source = "physicalClear.wash"), + @Mapping(target = "bath", source = "physicalClear.bath"), + @Mapping(target = "mealType", source = "physicalMeal.mealType"), + @Mapping(target = "intakeAmount", source = "physicalMeal.intakeAmount"), + @Mapping(target = "has_walked", source = "physicalWalk.hasWalked"), + @Mapping(target = "has_companion", source = "physicalWalk.hasCompanion"), }) - BodyManagementResponse toResponse(BodyManagement bodyManagement); + public abstract BodyManagementResponse toResponse(BodyManagement bodyManagement); @Mappings({ @Mapping(target = "physicalClear.wash", source = "wash"), @@ -55,28 +65,28 @@ public interface ChartMapper { @Mapping(target = "physicalWalk.hasWalked", source = "has_walked"), @Mapping(target = "physicalWalk.hasCompanion", source = "has_companion") }) - BodyManagement toEntity(BodyManagementRequest request); + public abstract BodyManagement toEntity(BodyManagementRequest request); // NursingManagement 매핑 @Mappings({ @Mapping(target = "systolic", source = "healthBloodPressure.systolic"), @Mapping(target = "diastolic", source = "healthBloodPressure.diastolic") }) - NursingManagementResponse toResponse(NursingManagement nursingManagement); + public abstract NursingManagementResponse toResponse(NursingManagement nursingManagement); @Mappings({ @Mapping(target = "healthBloodPressure.systolic", source = "systolic"), @Mapping(target = "healthBloodPressure.diastolic", source = "diastolic") }) - NursingManagement toEntity(NursingManagementRequest request); + public abstract NursingManagement toEntity(NursingManagementRequest request); // CognitiveManagement 매핑 - CognitiveManagementResponse toResponse(CognitiveManagement cognitiveManagement); + public abstract CognitiveManagementResponse toResponse(CognitiveManagement cognitiveManagement); - CognitiveManagement toEntity(CognitiveManagementRequest request); + public abstract CognitiveManagement toEntity(CognitiveManagementRequest request); // RecoveryTraining 매핑 - RecoveryTrainingResponse toResponse(RecoveryTraining recoveryTraining); + public abstract RecoveryTrainingResponse toResponse(RecoveryTraining recoveryTraining); - RecoveryTraining toEntity(RecoveryTrainingRequest request); + public abstract RecoveryTraining toEntity(RecoveryTrainingRequest request); } diff --git a/src/main/java/dbdr/domain/chart/dto/request/ChartDetailRequest.java b/src/main/java/dbdr/domain/chart/dto/request/ChartDetailRequest.java index 8510fe58..d9e2d2ff 100644 --- a/src/main/java/dbdr/domain/chart/dto/request/ChartDetailRequest.java +++ b/src/main/java/dbdr/domain/chart/dto/request/ChartDetailRequest.java @@ -1,25 +1,24 @@ package dbdr.domain.chart.dto.request; -import dbdr.domain.recipient.entity.Recipient; import io.swagger.v3.oas.annotations.media.Schema; public record ChartDetailRequest( - @Schema(description = "상태", example = "오늘은 상태가 매우 좋으셨다.") - String conditionDisease, - @Schema(description = "돌봄대상자", example = "{\"id\":\"1\"}") - Recipient recipient, - @Schema(description = "신체활동", example = "{\"wash\": true,\"bath\": true,\"mealType\": \"채식\"," - + "\"intakeAmount\": \"3회\",\"physicalRestroom\": 6,\"has_walked\": false," - + "\"has_companion\": false, \"physicalNote\": \"평소보다 컨디션이 좋으셨다.\"}") - BodyManagementRequest bodyManagement, - @Schema(description = "간호관리", example = "{\"systolic\": 300," - + "\"diastolic\": 200," - + "\"healthTemperature\": \"32도\"," - + "\"healthNote\": \"없음\"}") - NursingManagementRequest nursingManagement, - @Schema(description = "인지관리", example = "{\"cognitiveHelp\": true,\"cognitiveNote\": \"없음\"}") - CognitiveManagementRequest cognitiveManagement, - @Schema(description = "기능회복훈련", example = "{\"recoveryProgram\":\"회복\",\"recoveryTraining\": true,\"recoveryNote\": \"없음\"}") - RecoveryTrainingRequest recoveryTraining + @Schema(description = "상태", example = "오늘은 상태가 매우 좋으셨다.") + String conditionDisease, + @Schema(description = "돌봄대상자", example = "{\"id\":\"1\"}") + Long recipientId, + @Schema(description = "신체활동", example = "{\"wash\": true,\"bath\": true,\"mealType\": \"채식\"," + + "\"intakeAmount\": \"3회\",\"physicalRestroom\": 6,\"has_walked\": false," + + "\"has_companion\": false, \"physicalNote\": \"평소보다 컨디션이 좋으셨다.\"}") + BodyManagementRequest bodyManagement, + @Schema(description = "간호관리", example = "{\"systolic\": 300," + + "\"diastolic\": 200," + + "\"healthTemperature\": \"32도\"," + + "\"healthNote\": \"없음\"}") + NursingManagementRequest nursingManagement, + @Schema(description = "인지관리", example = "{\"cognitiveHelp\": true,\"cognitiveNote\": \"없음\"}") + CognitiveManagementRequest cognitiveManagement, + @Schema(description = "기능회복훈련", example = "{\"recoveryProgram\":\"회복\",\"recoveryTraining\": true,\"recoveryNote\": \"없음\"}") + RecoveryTrainingRequest recoveryTraining ) { } diff --git a/src/main/java/dbdr/domain/recipient/service/RecipientService.java b/src/main/java/dbdr/domain/recipient/service/RecipientService.java index 400c4e04..f9ac9c4a 100644 --- a/src/main/java/dbdr/domain/recipient/service/RecipientService.java +++ b/src/main/java/dbdr/domain/recipient/service/RecipientService.java @@ -1,20 +1,18 @@ package dbdr.domain.recipient.service; -import dbdr.domain.recipient.entity.Recipient; +import dbdr.domain.careworker.repository.CareworkerRepository; import dbdr.domain.recipient.dto.request.RecipientRequestDTO; import dbdr.domain.recipient.dto.response.RecipientResponseDTO; +import dbdr.domain.recipient.entity.Recipient; import dbdr.domain.recipient.repository.RecipientRepository; -import dbdr.domain.careworker.repository.CareworkerRepository; import dbdr.global.exception.ApplicationError; import dbdr.global.exception.ApplicationException; +import java.util.List; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; - import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.stream.Collectors; - @Service @RequiredArgsConstructor public class RecipientService { @@ -25,8 +23,8 @@ public class RecipientService { @Transactional(readOnly = true) public List getAllRecipients() { return recipientRepository.findAll().stream() - .map(this::toResponseDTO) - .collect(Collectors.toList()); + .map(this::toResponseDTO) + .collect(Collectors.toList()); } @Transactional(readOnly = true) @@ -39,16 +37,16 @@ public RecipientResponseDTO getRecipientById(Long id) { public RecipientResponseDTO createRecipient(RecipientRequestDTO recipientRequestDTO) { ensureUniqueCareNumber(recipientRequestDTO.getCareNumber()); Recipient recipient = new Recipient( - recipientRequestDTO.getName(), - recipientRequestDTO.getBirth(), - recipientRequestDTO.getGender(), - recipientRequestDTO.getCareLevel(), - recipientRequestDTO.getCareNumber(), - recipientRequestDTO.getStartDate(), - recipientRequestDTO.getInstitution(), - recipientRequestDTO.getInstitutionNumber(), - careworkerRepository.findById(recipientRequestDTO.getCareworkerId()) - .orElseThrow(() -> new ApplicationException(ApplicationError.CAREWORKER_NOT_FOUND)) + recipientRequestDTO.getName(), + recipientRequestDTO.getBirth(), + recipientRequestDTO.getGender(), + recipientRequestDTO.getCareLevel(), + recipientRequestDTO.getCareNumber(), + recipientRequestDTO.getStartDate(), + recipientRequestDTO.getInstitution(), + recipientRequestDTO.getInstitutionNumber(), + careworkerRepository.findById(recipientRequestDTO.getCareworkerId()) + .orElseThrow(() -> new ApplicationException(ApplicationError.CAREWORKER_NOT_FOUND)) ); recipientRepository.save(recipient); return toResponseDTO(recipient); @@ -73,9 +71,9 @@ public void deleteRecipient(Long id) { recipientRepository.delete(recipient); } - private Recipient findRecipientById(Long id) { + public Recipient findRecipientById(Long id) { return recipientRepository.findById(id) - .orElseThrow(() -> new ApplicationException(ApplicationError.RECIPIENT_NOT_FOUND)); + .orElseThrow(() -> new ApplicationException(ApplicationError.RECIPIENT_NOT_FOUND)); } private void ensureUniqueCareNumber(String careNumber) { @@ -86,16 +84,16 @@ private void ensureUniqueCareNumber(String careNumber) { private RecipientResponseDTO toResponseDTO(Recipient recipient) { return new RecipientResponseDTO( - recipient.getId(), - recipient.getName(), - recipient.getBirth(), - recipient.getGender(), - recipient.getCareLevel(), - recipient.getCareNumber(), - recipient.getStartDate(), - recipient.getInstitution(), - recipient.getInstitutionNumber(), - recipient.getCareworker() != null ? recipient.getCareworker().getId() : null + recipient.getId(), + recipient.getName(), + recipient.getBirth(), + recipient.getGender(), + recipient.getCareLevel(), + recipient.getCareNumber(), + recipient.getStartDate(), + recipient.getInstitution(), + recipient.getInstitutionNumber(), + recipient.getCareworker() != null ? recipient.getCareworker().getId() : null ); } } diff --git a/src/test/java/dbdr/chart/ChartMapperTest.java b/src/test/java/dbdr/chart/ChartMapperTest.java index 4189ccce..21459c52 100644 --- a/src/test/java/dbdr/chart/ChartMapperTest.java +++ b/src/test/java/dbdr/chart/ChartMapperTest.java @@ -1,8 +1,7 @@ package dbdr.chart; import static org.assertj.core.api.Assertions.assertThat; - -import java.time.LocalDate; +import static org.mockito.Mockito.when; import dbdr.domain.chart.dto.ChartMapper; import dbdr.domain.chart.dto.request.BodyManagementRequest; @@ -21,13 +20,22 @@ import dbdr.domain.chart.entity.PhysicalMeal; import dbdr.domain.chart.entity.PhysicalWalk; import dbdr.domain.recipient.entity.Recipient; - +import dbdr.domain.recipient.service.RecipientService; +import java.time.LocalDate; import org.junit.jupiter.api.Test; -import org.mapstruct.factory.Mappers; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +@SpringBootTest public class ChartMapperTest { - private final ChartMapper chartMapper = Mappers.getMapper(ChartMapper.class); + @Autowired + private ChartMapper chartMapper; + + @MockBean + private RecipientService recipientService; + @Test void testToResponse_chartToChartDetailResponse() { @@ -45,24 +53,26 @@ void testToResponse_chartToChartDetailResponse() { @Test void testToEntity_chartDetailRequestToChart() { // given + Long recipientId = 1L; Recipient recipient = Recipient.builder() - .name("John Doe") - .birth(LocalDate.of(1950, 1, 1)) - .gender("Male") - .careLevel("Level 1") - .careNumber("12345678") - .startDate(LocalDate.of(2020, 1, 1)) - .institution("HealthCare Institution") - .institutionNumber(100L) - .build(); - + .name("John Doe") + .birth(LocalDate.of(1950, 1, 1)) + .gender("Male") + .careLevel("Level 1") + .careNumber("12345678") + .startDate(LocalDate.of(2020, 1, 1)) + .institution("HealthCare Institution") + .institutionNumber(100L) + .build(); + + when(recipientService.findRecipientById(recipientId)).thenReturn(recipient); ChartDetailRequest request = new ChartDetailRequest( - "Flu", - recipient, - new BodyManagementRequest(true, false, "Lunch", "Full", 3, true, false, "Good"), - new NursingManagementRequest(120, 80, "36.5", "All good"), - new CognitiveManagementRequest(true, "No issues"), - new RecoveryTrainingRequest("Physical Therapy", true, "Completed") + "Flu", + recipientId, + new BodyManagementRequest(true, false, "Lunch", "Full", 3, true, false, "Good"), + new NursingManagementRequest(120, 80, "36.5", "All good"), + new CognitiveManagementRequest(true, "No issues"), + new RecoveryTrainingRequest("Physical Therapy", true, "Completed") ); // when @@ -75,7 +85,7 @@ void testToEntity_chartDetailRequestToChart() { assertThat(chart.getRecipient().getName()).isEqualTo("John Doe"); assertThat(chart.getNursingManagement()).isNotNull(); assertThat(chart.getBodyManagement().getPhysicalMeal().getMealType()).isEqualTo( - request.bodyManagement().mealType()); + request.bodyManagement().mealType()); } @Test From cca79587d71d789d26d61ebdf9242f4055b221db Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 13:19:02 +0900 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20BodyManagement=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbdr/domain/chart/entity/BodyManagement.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/entity/BodyManagement.java b/src/main/java/dbdr/domain/chart/entity/BodyManagement.java index c3e9f45d..f2cf1e7d 100644 --- a/src/main/java/dbdr/domain/chart/entity/BodyManagement.java +++ b/src/main/java/dbdr/domain/chart/entity/BodyManagement.java @@ -22,13 +22,23 @@ public class BodyManagement extends BaseEntity { @Embedded public PhysicalMeal physicalMeal; // 식사 종류와 섭취량 - @Embedded - public PhysicalWalk physicalWalk; // 산책 or 외출 동행 + @Embedded public PhysicalClear physicalClear; // 세면 및 목욕 체크박스 + @Comment("화장실 횟수") private int physicalRestroom; // 화장실 횟수 + @Comment("특이사항") @Column(columnDefinition = "TEXT") private String physicalNote; // 특이사항 입력 + + @Comment("특이사항") + private boolean hasWalked;// 산책 + + @Comment("체위 변경 유무") + private boolean isPositionChangeRequired; // 체위 변경 유무 + + @Comment("이동 도움 유무") + private boolean isMobilityAssistance; // 이동 도움 유무 } From 1e6c880c8e1bdba0136ffd2ba56d329302cd25f7 Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 13:22:03 +0900 Subject: [PATCH 03/11] =?UTF-8?q?feat:=20BodyManagement=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/dbdr/chart/ChartMapperTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/dbdr/chart/ChartMapperTest.java b/src/test/java/dbdr/chart/ChartMapperTest.java index 21459c52..c9965a14 100644 --- a/src/test/java/dbdr/chart/ChartMapperTest.java +++ b/src/test/java/dbdr/chart/ChartMapperTest.java @@ -18,7 +18,6 @@ import dbdr.domain.chart.entity.NursingManagement; import dbdr.domain.chart.entity.PhysicalClear; import dbdr.domain.chart.entity.PhysicalMeal; -import dbdr.domain.chart.entity.PhysicalWalk; import dbdr.domain.recipient.entity.Recipient; import dbdr.domain.recipient.service.RecipientService; import java.time.LocalDate; @@ -93,8 +92,8 @@ void testToResponse_bodyManagementToBodyManagementResponse() { // given PhysicalClear physicalClear = new PhysicalClear(true, false); PhysicalMeal physicalMeal = new PhysicalMeal("Lunch", "Full"); - PhysicalWalk physicalWalk = new PhysicalWalk(true, false); - BodyManagement bodyManagement = new BodyManagement(physicalMeal, physicalWalk, physicalClear, 3, "Good"); + + BodyManagement bodyManagement = new BodyManagement(physicalMeal, physicalClear, 3, "Good", true, true, true); // when BodyManagementResponse response = chartMapper.toResponse(bodyManagement); From d488c8ac4affcfa260533018721ce7fc764fd306 Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 13:24:48 +0900 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20BodyManagement=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?req/res=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbdr/domain/chart/dto/ChartMapper.java | 8 ++--- .../dto/request/BodyManagementRequest.java | 34 ++++++++++--------- .../dto/response/BodyManagementResponse.java | 19 ++++++----- .../domain/chart/entity/BodyManagement.java | 9 ++--- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/dto/ChartMapper.java b/src/main/java/dbdr/domain/chart/dto/ChartMapper.java index 0f053647..eb7de954 100644 --- a/src/main/java/dbdr/domain/chart/dto/ChartMapper.java +++ b/src/main/java/dbdr/domain/chart/dto/ChartMapper.java @@ -51,9 +51,7 @@ protected Recipient mapRecipient(Long recipientId) { @Mapping(target = "wash", source = "physicalClear.wash"), @Mapping(target = "bath", source = "physicalClear.bath"), @Mapping(target = "mealType", source = "physicalMeal.mealType"), - @Mapping(target = "intakeAmount", source = "physicalMeal.intakeAmount"), - @Mapping(target = "has_walked", source = "physicalWalk.hasWalked"), - @Mapping(target = "has_companion", source = "physicalWalk.hasCompanion"), + @Mapping(target = "intakeAmount", source = "physicalMeal.intakeAmount") }) public abstract BodyManagementResponse toResponse(BodyManagement bodyManagement); @@ -61,9 +59,7 @@ protected Recipient mapRecipient(Long recipientId) { @Mapping(target = "physicalClear.wash", source = "wash"), @Mapping(target = "physicalClear.bath", source = "bath"), @Mapping(target = "physicalMeal.mealType", source = "mealType"), - @Mapping(target = "physicalMeal.intakeAmount", source = "intakeAmount"), - @Mapping(target = "physicalWalk.hasWalked", source = "has_walked"), - @Mapping(target = "physicalWalk.hasCompanion", source = "has_companion") + @Mapping(target = "physicalMeal.intakeAmount", source = "intakeAmount") }) public abstract BodyManagement toEntity(BodyManagementRequest request); diff --git a/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java b/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java index 83530526..054a9f22 100644 --- a/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java +++ b/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java @@ -3,21 +3,23 @@ import io.swagger.v3.oas.annotations.media.Schema; public record BodyManagementRequest( - @Schema(description = "세면 유무", example = "true") - boolean wash, // 세면 유무 - @Schema(description = "목욕 유무", example = "true") - boolean bath, // 목욕 유무 - @Schema(description = "식사 종류", example = "채식") - String mealType, // 식사 종류 - @Schema(description = "섭취량", example = "3회") - String intakeAmount, // 섭취량 - @Schema(description = "화장실 횟수", example = "6") - int physicalRestroom, // 화장실 횟수 - @Schema(description = "산책", example = "false") - boolean has_walked, // 산책 - @Schema(description = "외출 동행", example = "false") - boolean has_companion, // 외출 동행 - @Schema(description = "특이사항 입력", example = "평소보다 컨디션이 좋으셨다.") - String physicalNote // 특이사항 입력 + @Schema(description = "세면 유무", example = "true") + boolean wash, // 세면 유무 + @Schema(description = "목욕 유무", example = "true") + boolean bath, // 목욕 유무 + @Schema(description = "식사 종류", example = "채식") + String mealType, // 식사 종류 + @Schema(description = "섭취량", example = "3회") + String intakeAmount, // 섭취량 + @Schema(description = "화장실 횟수", example = "6") + int physicalRestroom, // 화장실 횟수 + @Schema(description = "산책", example = "false") + boolean has_walked, // 산책 + @Schema(description = "산책", example = "false") + boolean isPositionChangeRequired, // 체위 변경 유무 + @Schema(description = "산책", example = "false") + boolean isMobilityAssistance, // 이동 도움 유무 + @Schema(description = "특이사항 입력", example = "평소보다 컨디션이 좋으셨다.") + String physicalNote // 특이사항 입력 ) { } diff --git a/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java b/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java index 2527113a..078dda33 100644 --- a/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java +++ b/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java @@ -3,14 +3,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; public record BodyManagementResponse( - Long id, - @JsonProperty("세면 유무") boolean wash, // 세면 유무 - @JsonProperty("목욕 유무") boolean bath, // 목욕 유무 - @JsonProperty("식사 종류") String mealType, // 식사 종류 - @JsonProperty("섭취량") String intakeAmount, // 섭취량 - @JsonProperty("화장실 횟수") int physicalRestroom, // 화장실 횟수 - @JsonProperty("산책 유무") boolean has_walked, // 산책 - @JsonProperty("외출 동행 유무") boolean has_companion, // 외출 동행 - @JsonProperty("특이사항 입력") String physicalNote // 특이사항 입력 + Long id, + @JsonProperty("세면 유무") boolean wash, // 세면 유무 + @JsonProperty("목욕 유무") boolean bath, // 목욕 유무 + @JsonProperty("식사 종류") String mealType, // 식사 종류 + @JsonProperty("섭취량") String intakeAmount, // 섭취량 + @JsonProperty("화장실 횟수") int physicalRestroom, // 화장실 횟수 + @JsonProperty("산책 유무") boolean has_walked, // 산책 + boolean isPositionChangeRequired, // 체위 변경 유무 + boolean isMobilityAssistance, // 이동 도움 유무 + @JsonProperty("특이사항 입력") String physicalNote // 특이사항 입력 ) { } diff --git a/src/main/java/dbdr/domain/chart/entity/BodyManagement.java b/src/main/java/dbdr/domain/chart/entity/BodyManagement.java index f2cf1e7d..e378241d 100644 --- a/src/main/java/dbdr/domain/chart/entity/BodyManagement.java +++ b/src/main/java/dbdr/domain/chart/entity/BodyManagement.java @@ -25,7 +25,7 @@ public class BodyManagement extends BaseEntity { @Embedded public PhysicalClear physicalClear; // 세면 및 목욕 체크박스 - + @Comment("화장실 횟수") private int physicalRestroom; // 화장실 횟수 @@ -33,12 +33,13 @@ public class BodyManagement extends BaseEntity { @Column(columnDefinition = "TEXT") private String physicalNote; // 특이사항 입력 - @Comment("특이사항") - private boolean hasWalked;// 산책 - @Comment("체위 변경 유무") private boolean isPositionChangeRequired; // 체위 변경 유무 @Comment("이동 도움 유무") private boolean isMobilityAssistance; // 이동 도움 유무 + + @Comment("특이사항") + private boolean hasWalked;// 산책 + } From fc80ead057a6a57d5095e4dc5319e27f90dea403 Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 13:25:45 +0900 Subject: [PATCH 05/11] =?UTF-8?q?docs:=20BodyManagementRequest=20swagger?= =?UTF-8?q?=20=EB=AA=85=EC=84=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbdr/domain/chart/dto/request/BodyManagementRequest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java b/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java index 054a9f22..9cc104a6 100644 --- a/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java +++ b/src/main/java/dbdr/domain/chart/dto/request/BodyManagementRequest.java @@ -15,9 +15,9 @@ public record BodyManagementRequest( int physicalRestroom, // 화장실 횟수 @Schema(description = "산책", example = "false") boolean has_walked, // 산책 - @Schema(description = "산책", example = "false") + @Schema(description = "체위 변경 유므", example = "false") boolean isPositionChangeRequired, // 체위 변경 유무 - @Schema(description = "산책", example = "false") + @Schema(description = "이동 도움 유무", example = "false") boolean isMobilityAssistance, // 이동 도움 유무 @Schema(description = "특이사항 입력", example = "평소보다 컨디션이 좋으셨다.") String physicalNote // 특이사항 입력 From ab141b89b26a2013cbaf23b59ecbe6cc5ea6ab91 Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 13:26:05 +0900 Subject: [PATCH 06/11] =?UTF-8?q?fix:=20res=20jsonProperty=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20-=20=EA=B8=B0=EC=A1=B4=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=EC=9C=BC=EB=A1=9C=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/BodyManagementResponse.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java b/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java index 078dda33..064e9f3b 100644 --- a/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java +++ b/src/main/java/dbdr/domain/chart/dto/response/BodyManagementResponse.java @@ -1,17 +1,15 @@ package dbdr.domain.chart.dto.response; -import com.fasterxml.jackson.annotation.JsonProperty; - public record BodyManagementResponse( Long id, - @JsonProperty("세면 유무") boolean wash, // 세면 유무 - @JsonProperty("목욕 유무") boolean bath, // 목욕 유무 - @JsonProperty("식사 종류") String mealType, // 식사 종류 - @JsonProperty("섭취량") String intakeAmount, // 섭취량 - @JsonProperty("화장실 횟수") int physicalRestroom, // 화장실 횟수 - @JsonProperty("산책 유무") boolean has_walked, // 산책 + boolean wash, // 세면 유무 + boolean bath, // 목욕 유무 + String mealType, // 식사 종류 + String intakeAmount, // 섭취량 + int physicalRestroom, // 화장실 횟수 + boolean has_walked, // 산책 boolean isPositionChangeRequired, // 체위 변경 유무 boolean isMobilityAssistance, // 이동 도움 유무 - @JsonProperty("특이사항 입력") String physicalNote // 특이사항 입력 + String physicalNote // 특이사항 입력 ) { } From e65968aeb771a8d73bcd20bff4f55f6e66de5fde Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 14:04:49 +0900 Subject: [PATCH 07/11] =?UTF-8?q?test:=20chartMapperTest=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20yml=20=ED=8C=8C=EC=9D=BC=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/dbdr/chart/ChartMapperTest.java | 4 +-- src/test/resources/application.yml | 31 ++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/test/java/dbdr/chart/ChartMapperTest.java b/src/test/java/dbdr/chart/ChartMapperTest.java index c9965a14..e634ed99 100644 --- a/src/test/java/dbdr/chart/ChartMapperTest.java +++ b/src/test/java/dbdr/chart/ChartMapperTest.java @@ -68,7 +68,7 @@ void testToEntity_chartDetailRequestToChart() { ChartDetailRequest request = new ChartDetailRequest( "Flu", recipientId, - new BodyManagementRequest(true, false, "Lunch", "Full", 3, true, false, "Good"), + new BodyManagementRequest(true, false, "Lunch", "Full", 3, true, false, true, "Good"), new NursingManagementRequest(120, 80, "36.5", "All good"), new CognitiveManagementRequest(true, "No issues"), new RecoveryTrainingRequest("Physical Therapy", true, "Completed") @@ -110,7 +110,7 @@ void testToResponse_bodyManagementToBodyManagementResponse() { void testToEntity_bodyManagementRequestToBodyManagement() { // given BodyManagementRequest request = new BodyManagementRequest( - true, false, "Lunch", "Full", 3, true, false, "Good" + true, false, "Lunch", "Full", 3, true, false, false, "Good" ); // when diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 918aa915..df858014 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -1,9 +1,24 @@ -spring : - config : - test : - institution : - loginId : "testInstitution" - loginPassword : "passwordInstitution" - institutionNumber : "123" - institutionName : "돌다리요양원" +spring: + config: + test: + institution: + loginId: "testInstitution" + loginPassword: "passwordInstitution" + institutionNumber: "123" + institutionName: "돌다리요양원" + jwt: + secret: test + authheader: header + app: + version: v1 + + data: + redis: + port: 1000 + host: "host" + +line: + bot: + channel-token: "TEST" + From 5a26de512f8af28286e2f73545a5c63e37254667 Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 14:08:03 +0900 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20CognitiveManagement=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20-=20=EB=A7=90=EB=B2=97=20?= =?UTF-8?q?=EB=B0=8F=20=EA=B2=A9=EB=A0=A4=20=EC=82=AC=ED=95=AD=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20-=20req/res=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/dto/request/CognitiveManagementRequest.java | 10 ++++++---- .../dto/response/CognitiveManagementResponse.java | 9 ++++----- .../dbdr/domain/chart/entity/CognitiveManagement.java | 10 ++++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/dto/request/CognitiveManagementRequest.java b/src/main/java/dbdr/domain/chart/dto/request/CognitiveManagementRequest.java index a668a3ac..2b7ca22a 100644 --- a/src/main/java/dbdr/domain/chart/dto/request/CognitiveManagementRequest.java +++ b/src/main/java/dbdr/domain/chart/dto/request/CognitiveManagementRequest.java @@ -3,9 +3,11 @@ import io.swagger.v3.oas.annotations.media.Schema; public record CognitiveManagementRequest( - @Schema(description = "의사소통 도움 여부", example = "true") - boolean cognitiveHelp, // 의사소통 도움 여부 - @Schema(description = "인지 관리 특이사항", example = "없음") - String cognitiveNote // 인지 관리 특이사항 + @Schema(description = "의사소통 도움 여부", example = "true") + boolean cognitiveHelp, // 의사소통 도움 여부 + @Schema(description = "말벗 및 격려 여부", example = "true") + boolean isCompanionshipProvided, + @Schema(description = "인지 관리 특이사항", example = "없음") + String cognitiveNote // 인지 관리 특이사항 ) { } diff --git a/src/main/java/dbdr/domain/chart/dto/response/CognitiveManagementResponse.java b/src/main/java/dbdr/domain/chart/dto/response/CognitiveManagementResponse.java index 78d28473..d13d555c 100644 --- a/src/main/java/dbdr/domain/chart/dto/response/CognitiveManagementResponse.java +++ b/src/main/java/dbdr/domain/chart/dto/response/CognitiveManagementResponse.java @@ -1,10 +1,9 @@ package dbdr.domain.chart.dto.response; -import com.fasterxml.jackson.annotation.JsonProperty; - public record CognitiveManagementResponse( - Long id, - @JsonProperty("의사소통 도움 여부") boolean cognitiveHelp, // 의사소통 도움 여부 - @JsonProperty("인지관리 특이 사항") String cognitiveNote // 인지 관리 특이사항 + Long id, + boolean cognitiveHelp, // 의사소통 도움 여부 + boolean isCompanionshipProvided, + String cognitiveNote // 인지 관리 특이사항 ) { } diff --git a/src/main/java/dbdr/domain/chart/entity/CognitiveManagement.java b/src/main/java/dbdr/domain/chart/entity/CognitiveManagement.java index c29358ea..9beed62a 100644 --- a/src/main/java/dbdr/domain/chart/entity/CognitiveManagement.java +++ b/src/main/java/dbdr/domain/chart/entity/CognitiveManagement.java @@ -1,15 +1,14 @@ package dbdr.domain.chart.entity; -import org.hibernate.annotations.Comment; -import org.hibernate.annotations.SQLDelete; -import org.hibernate.annotations.SQLRestriction; - import dbdr.domain.core.base.entity.BaseEntity; import jakarta.persistence.Column; import jakarta.persistence.Entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import org.hibernate.annotations.Comment; +import org.hibernate.annotations.SQLDelete; +import org.hibernate.annotations.SQLRestriction; @Entity @Getter @@ -21,6 +20,9 @@ public class CognitiveManagement extends BaseEntity { @Comment("의사소통 도움 여부") private boolean cognitiveHelp; // 의사소통 도움 여부 + @Comment("말벗 및 격려 여부") + private boolean isCompanionshipProvided; // 말벗 및 격려 여부 + @Comment("인지 관리 특이사항") @Column(columnDefinition = "TEXT") private String cognitiveNote; // 인지 관리 특이사항 From e704231589932eaa018fb53cbab2cc598c23773d Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 14:15:05 +0900 Subject: [PATCH 09/11] =?UTF-8?q?feat:=20NursingManagement=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20-=20=EA=B1=B4=EA=B0=95=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC,=20=EA=B0=84=ED=98=B8=20=EA=B4=80=EB=A6=AC,?= =?UTF-8?q?=20=EC=9D=91=EA=B8=89=20=EA=B4=80=EB=A6=AC=20=ED=95=84=EB=93=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20-=20req/res=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/NursingManagementRequest.java | 22 ++++++++++++------- .../response/NursingManagementResponse.java | 15 +++++++------ .../chart/entity/NursingManagement.java | 9 ++++++++ 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/dto/request/NursingManagementRequest.java b/src/main/java/dbdr/domain/chart/dto/request/NursingManagementRequest.java index 784fa780..96a83fd6 100644 --- a/src/main/java/dbdr/domain/chart/dto/request/NursingManagementRequest.java +++ b/src/main/java/dbdr/domain/chart/dto/request/NursingManagementRequest.java @@ -3,13 +3,19 @@ import io.swagger.v3.oas.annotations.media.Schema; public record NursingManagementRequest( - @Schema(description = "혈압 최고", example = "300") - int systolic, // 혈압 최고 - @Schema(description = "혈압 최저", example = "200") - int diastolic, // 혈압 최저 - @Schema(description = "체온", example = "32도") - String healthTemperature, // 체온 - @Schema(description = "건강 및 간호관리 특이사항", example = "없음") - String healthNote // 건강 및 간호관리 특이사항 + @Schema(description = "혈압 최고", example = "300") + int systolic, // 혈압 최고 + @Schema(description = "혈압 최저", example = "200") + int diastolic, // 혈압 최저 + @Schema(description = "체온", example = "32도") + String healthTemperature, // 체온 + @Schema(description = "건강 관리 제공 여부", example = "true") + boolean isHealthCareProvided, // 건강 관리 제공 여부 + @Schema(description = "간호 관리 제공 여부", example = "true") + boolean isNursingCareProvided, // 간호 관리 제공 여부 + @Schema(description = "응급 관리 제공 여부", example = "true") + boolean isEmergencyCareProvided, // 응급 관리 제공 여부 + @Schema(description = "건강 및 간호관리 특이사항", example = "없음") + String healthNote // 건강 및 간호관리 특이사항 ) { } diff --git a/src/main/java/dbdr/domain/chart/dto/response/NursingManagementResponse.java b/src/main/java/dbdr/domain/chart/dto/response/NursingManagementResponse.java index a1c6dd38..61d59cf3 100644 --- a/src/main/java/dbdr/domain/chart/dto/response/NursingManagementResponse.java +++ b/src/main/java/dbdr/domain/chart/dto/response/NursingManagementResponse.java @@ -1,12 +1,13 @@ package dbdr.domain.chart.dto.response; -import com.fasterxml.jackson.annotation.JsonProperty; - public record NursingManagementResponse( - Long id, - @JsonProperty("혈압 최고") int systolic, // 혈압 최고 - @JsonProperty("혈압 최저") int diastolic, // 혈압 최저 - @JsonProperty("체온") String healthTemperature, // 체온 - @JsonProperty("건강 및 간호관리 특이사항") String healthNote // 건강 및 간호관리 특이사항 + Long id, + int systolic, // 혈압 최고 + int diastolic, // 혈압 최저 + String healthTemperature, // 체온 + boolean isHealthCareProvided, // 건강 관리 제공 여부 + boolean isNursingCareProvided, // 간호 관리 제공 여부 + boolean isEmergencyCareProvided, + String healthNote // 건강 및 간호관리 특이사항 ) { } diff --git a/src/main/java/dbdr/domain/chart/entity/NursingManagement.java b/src/main/java/dbdr/domain/chart/entity/NursingManagement.java index cad75e66..eaccb94c 100644 --- a/src/main/java/dbdr/domain/chart/entity/NursingManagement.java +++ b/src/main/java/dbdr/domain/chart/entity/NursingManagement.java @@ -26,6 +26,15 @@ public class NursingManagement extends BaseEntity { @Comment("체온") private String healthTemperature; // 체온 + @Comment("건강 관리 제공 여부") + private boolean isHealthCareProvided; // 건강 관리 제공 여부 + + @Comment("간호 관리 제공 여부") + private boolean isNursingCareProvided; // 간호 관리 제공 여부 + + @Comment("응급 관리 제공 여부") + private boolean isEmergencyCareProvided; // 응급 관리 제공 여부 + @Comment("특이사항") @Column(columnDefinition = "TEXT") private String healthNote; // 건강 및 간호관리 특이사항 From 717e8aa3d804463e8f4418d6b04fa2d5c2d6ca9f Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 14:17:52 +0900 Subject: [PATCH 10/11] =?UTF-8?q?test:=20=EB=B0=94=EB=80=90=20chart=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=EC=97=90=20=EB=94=B0=EB=9D=BC=20tes?= =?UTF-8?q?t=20=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/dbdr/chart/ChartMapperTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/dbdr/chart/ChartMapperTest.java b/src/test/java/dbdr/chart/ChartMapperTest.java index e634ed99..dcbb7afb 100644 --- a/src/test/java/dbdr/chart/ChartMapperTest.java +++ b/src/test/java/dbdr/chart/ChartMapperTest.java @@ -69,8 +69,8 @@ void testToEntity_chartDetailRequestToChart() { "Flu", recipientId, new BodyManagementRequest(true, false, "Lunch", "Full", 3, true, false, true, "Good"), - new NursingManagementRequest(120, 80, "36.5", "All good"), - new CognitiveManagementRequest(true, "No issues"), + new NursingManagementRequest(120, 80, "36.5", true, true, true, "All good"), + new CognitiveManagementRequest(true, true, "No issues"), new RecoveryTrainingRequest("Physical Therapy", true, "Completed") ); @@ -128,7 +128,8 @@ void testToEntity_bodyManagementRequestToBodyManagement() { void testToResponse_nursingManagementToNursingManagementResponse() { // given HealthBloodPressure healthBloodPressure = new HealthBloodPressure(120, 80); - NursingManagement nursingManagement = new NursingManagement(healthBloodPressure, "36.5", "All good"); + NursingManagement nursingManagement = new NursingManagement(healthBloodPressure, "36.5", true, true, true, + "All good"); // when NursingManagementResponse response = chartMapper.toResponse(nursingManagement); @@ -142,7 +143,7 @@ void testToResponse_nursingManagementToNursingManagementResponse() { @Test void testToEntity_nursingManagementRequestToNursingManagement() { // given - NursingManagementRequest request = new NursingManagementRequest(120, 80, "36.5", "All good"); + NursingManagementRequest request = new NursingManagementRequest(120, 80, "36.5", true, true, true, "All good"); // when NursingManagement nursingManagement = chartMapper.toEntity(request); From 772e4125702c96599a415ccfa1d38348971b0db5 Mon Sep 17 00:00:00 2001 From: Yoo KyeongMi Date: Mon, 4 Nov 2024 14:20:39 +0900 Subject: [PATCH 11/11] =?UTF-8?q?feat:=20RecoveryTraining=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20-=20=EC=9D=B8=EC=A7=80=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=ED=9B=88=EB=A0=A8,=20=EB=AC=BC=EB=A6=AC?= =?UTF-8?q?=20=EC=B9=98=EB=A3=8C=20=EC=A0=9C=EA=B3=B5=20=EC=97=AC=EB=B6=80?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20-=20req/res=20=EB=B3=80=EA=B2=BD=20-=20?= =?UTF-8?q?test=20=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/RecoveryTrainingRequest.java | 16 ++++++++++------ .../dto/response/RecoveryTrainingResponse.java | 12 ++++++------ .../domain/chart/entity/RecoveryTraining.java | 6 ++++++ src/test/java/dbdr/chart/ChartMapperTest.java | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/main/java/dbdr/domain/chart/dto/request/RecoveryTrainingRequest.java b/src/main/java/dbdr/domain/chart/dto/request/RecoveryTrainingRequest.java index 997d9762..41e5e081 100644 --- a/src/main/java/dbdr/domain/chart/dto/request/RecoveryTrainingRequest.java +++ b/src/main/java/dbdr/domain/chart/dto/request/RecoveryTrainingRequest.java @@ -3,11 +3,15 @@ import io.swagger.v3.oas.annotations.media.Schema; public record RecoveryTrainingRequest( - @Schema(description = "회복 프로그램 이름", example = "회복") - String recoveryProgram, // 회복 프로그램 이름 - @Schema(description = "회복훈련 완료 여부", example = "true") - boolean recoveryTraining, // 회복훈련 완료 여부 - @Schema(description = "회복훈련 특이사항", example = "없음") - String recoveryNote // 회복훈련 특이사항 + @Schema(description = "회복 프로그램 이름", example = "회복") + String recoveryProgram, // 회복 프로그램 이름 + @Schema(description = "회복훈련 완료 여부", example = "true") + boolean recoveryTraining, // 회복훈련 완료 여부 + @Schema(description = "인지훈련 제공 여부", example = "true") + boolean isCognitiveTrainingProvided, // 인지훈련 제공 여부 + @Schema(description = "물리치료 제공 여부", example = "true") + boolean isPhysicalTherapyProvided, // 물리치료 제공 여부 + @Schema(description = "회복훈련 특이사항", example = "없음") + String recoveryNote // 회복훈련 특이사항 ) { } diff --git a/src/main/java/dbdr/domain/chart/dto/response/RecoveryTrainingResponse.java b/src/main/java/dbdr/domain/chart/dto/response/RecoveryTrainingResponse.java index 0b6dd774..e77c4520 100644 --- a/src/main/java/dbdr/domain/chart/dto/response/RecoveryTrainingResponse.java +++ b/src/main/java/dbdr/domain/chart/dto/response/RecoveryTrainingResponse.java @@ -1,11 +1,11 @@ package dbdr.domain.chart.dto.response; -import com.fasterxml.jackson.annotation.JsonProperty; - public record RecoveryTrainingResponse( - Long id, - @JsonProperty("회복 프로그램 이름") String recoveryProgram, // 회복 프로그램 이름 - @JsonProperty("회복훈련 완료 여부") boolean recoveryTraining, // 회복훈련 완료 여부 - @JsonProperty("회복훈련 특이사항") String recoveryNote // 회복훈련 특이사항 + Long id, + String recoveryProgram, // 회복 프로그램 이름 + boolean recoveryTraining, // 회복훈련 완료 여부 + boolean isCognitiveTrainingProvided, // 인지훈련 제공 여부 + boolean isPhysicalTherapyProvided, // 물리치료 제공 여부 + String recoveryNote // 회복훈련 특이사항 ) { } diff --git a/src/main/java/dbdr/domain/chart/entity/RecoveryTraining.java b/src/main/java/dbdr/domain/chart/entity/RecoveryTraining.java index 1e3d31b5..ec8bc814 100644 --- a/src/main/java/dbdr/domain/chart/entity/RecoveryTraining.java +++ b/src/main/java/dbdr/domain/chart/entity/RecoveryTraining.java @@ -26,6 +26,12 @@ public class RecoveryTraining extends BaseEntity { @Comment("회복 훈련 완료 여부") private boolean recoveryTraining; // 회복훈련 완료 여부 + @Comment("인지훈련 제공 여부") + private boolean isCognitiveTrainingProvided; // 인지훈련 제공 여부 + + @Comment("물리치료 제공 여부") + private boolean isPhysicalTherapyProvided; // 물리치료 제공 여부 + @Comment("회복 훈련 특이사항") @Column(columnDefinition = "TEXT") private String recoveryNote; // 회복훈련 특이사항 diff --git a/src/test/java/dbdr/chart/ChartMapperTest.java b/src/test/java/dbdr/chart/ChartMapperTest.java index dcbb7afb..5fa4be3c 100644 --- a/src/test/java/dbdr/chart/ChartMapperTest.java +++ b/src/test/java/dbdr/chart/ChartMapperTest.java @@ -71,7 +71,7 @@ void testToEntity_chartDetailRequestToChart() { new BodyManagementRequest(true, false, "Lunch", "Full", 3, true, false, true, "Good"), new NursingManagementRequest(120, 80, "36.5", true, true, true, "All good"), new CognitiveManagementRequest(true, true, "No issues"), - new RecoveryTrainingRequest("Physical Therapy", true, "Completed") + new RecoveryTrainingRequest("Physical Therapy", true, true, true, "Completed") ); // when