Repository: Pet-ner/AniDoc
Pull request #21: [FEAT] 검사기록 조회/수정/삭제
Author: login: Heun0
Created: 2025-05-15T05:38:24Z | Merged: 2025-05-15T06:20:34Z


# 🧠 Feature PR


### 1️⃣관련 이슈

🔗https://github.com/Pet-ner/AniDoc/issues/14
</br></br>

### 2️⃣작업 내용

✒️검사 기록 조회/수정/삭제
</br></br>


### 3️⃣테스트

- [x] 로컬에서 테스트 완료 🧪🫧

✒️h2 DB사용해서 swagger테스트
</br></br>
### 4️⃣이슈 넘버 기술
Closes #14 




Linked issue #14: [FEAT] 검사기록 조회/수정/삭제
## 📍 구현 기능
- 진료기록에 포함된 수술, 입원, 검사기록을 조회/수정/삭제 할 수 있도록 함

## 🛠 작업 내용
- [ ] 검사 기록 조회/수정/삭제

## 📢 추가 의논 사항
- s3 관련한 이미지 업로드 부분은 나중에 한번에 추가하고자함

## 🚨 주의 사항
- x


Diff:
diff --git a/backend/src/main/java/com/petner/anidoc/domain/vet/checkup/repository/CheckupRepository.java b/backend/src/main/java/com/petner/anidoc/domain/vet/checkup/repository/CheckupRepository.java
new file mode 100644
index 0000000..44dcd87
--- /dev/null
+++ b/backend/src/main/java/com/petner/anidoc/domain/vet/checkup/repository/CheckupRepository.java
@@ -0,0 +1,13 @@
+package com.petner.anidoc.domain.vet.checkup.repository;
+
+import com.petner.anidoc.domain.vet.checkuprecord.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface CheckupRepository extends JpaRepository<CheckupRecord, Long> {
+    List<CheckupRecord> findAllByMedicalRecordId(Long medicalRecordId);
+    Optional<CheckupRecord> findByIdAndIsDeletedFalse(Long id);
+}
diff --git a/backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java b/backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
new file mode 100644
index 0000000..180896a
--- /dev/null
+++ b/backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
@@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordRequestDto;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordResponseDto;
+import com.petner.anidoc.domain.vet.checkuprecord.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupRecordResponseDto createCheckupRecord(CheckupRecordRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupRecordResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupRecordResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupRecordResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 삭제할 권한이 없습니다.");
+        }
+
+        checkupRecord.markAsDeleted();
+    }
+
+    @Transactional
+    public CheckupRecordResponseDto updateCheckupRecord(CheckupRecordRequestDto checkupRequestDto,Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(checkupRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 수정할 권한이 없습니다.");
+        }
+
+        checkupRecord.updateFromDto(checkupRequestDto);
+        return CheckupRecordResponseDto.from(checkupRecord);
+    }
+
+}
diff --git a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/controller/CheckupRecordController.java b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/controller/CheckupRecordController.java
index beadee0..b4f76da 100644
--- a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/controller/CheckupRecordController.java
+++ b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/controller/CheckupRecordController.java
@@ -10,6 +10,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import java.nio.file.AccessDeniedException;
+import java.util.List;
 
 @RestController
 @RequiredArgsConstructor
@@ -29,4 +30,38 @@ public ResponseEntity<CheckupRecordResponseDto> createCheckupRecord(
         CheckupRecordResponseDto response = checkupRecordService.createCheckupRecord(requestDto, userId, medicalRecordId);
         return ResponseEntity.ok(response);
     }
+
+    @GetMapping
+    @Operation(summary = "진료 기록에 대한 모든 검사 기록 조회", description = "의료진이 진료기록에 검사 결과를 조회")
+    public ResponseEntity<List<CheckupRecordResponseDto>> getCheckupRecord(
+            @RequestParam Long userId,
+            @PathVariable Long medicalRecordId
+    ) {
+        List<CheckupRecordResponseDto> records = checkupRecordService.getCheckupRecord(userId, medicalRecordId);
+        return ResponseEntity.ok(records);
+    }
+
+    @PutMapping("/{checkupId}")
+    @Operation(summary = "검사 결과 수정", description = "의료진이 진료기록에 검사 결과를 수정")
+    public ResponseEntity<CheckupRecordResponseDto> updateCheckup(
+            @RequestBody CheckupRecordRequestDto requestDto,
+            @RequestParam Long userId,
+            @PathVariable Long medicalRecordId,
+            @PathVariable("checkupId") Long checkupRecordId
+    ) throws AccessDeniedException {
+        CheckupRecordResponseDto updated = checkupRecordService.updateCheckupRecord(requestDto, userId, medicalRecordId, checkupRecordId);
+        return ResponseEntity.ok(updated);
+    }
+
+    @DeleteMapping("/{checkupId}")
+    @Operation(summary = "검사 결과 삭제", description = "의료진이 진료기록에 검사 결과를 삭제")
+    public ResponseEntity<Void> deleteCheckup(
+            @RequestParam Long userId,
+            @PathVariable Long medicalRecordId,
+            @PathVariable("checkupId") Long checkupRecordId
+    ) throws AccessDeniedException {
+        checkupRecordService.deleteCheckupRecord(userId, medicalRecordId, checkupRecordId);
+        return ResponseEntity.noContent().build();
+    }
+
 }
diff --git a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/entity/CheckupRecord.java b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/entity/CheckupRecord.java
index 7a5ef43..21362a4 100644
--- a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/entity/CheckupRecord.java
+++ b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/entity/CheckupRecord.java
@@ -1,12 +1,10 @@
 package com.petner.anidoc.domain.vet.checkuprecord.entity;
 
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordRequestDto;
 import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
 import com.petner.anidoc.global.jpa.BaseEntity;
 import jakarta.persistence.*;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 import lombok.experimental.SuperBuilder;
 
 import java.time.LocalDate;
@@ -38,4 +36,21 @@ public class CheckupRecord extends BaseEntity {
 
     @Enumerated(EnumType.STRING)
     private CheckupStatus status; //검사상태(검사전, 검사중, 검사완료)
+
+    @Builder.Default
+    @Column(name="is_deleted")
+    private Boolean isDeleted = false;
+
+    public void markAsDeleted(){
+        this.isDeleted=true;
+    }
+
+    public void updateFromDto(CheckupRecordRequestDto dto) {
+        this.checkupType = dto.getCheckupType();
+        this.result = dto.getResult();
+        this.resultUrl = dto.getResultUrl();
+        this.checkupDate = dto.getCheckupDate();
+        this.status = dto.getStatus();
+    }
+
 }
diff --git a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/repository/CheckupRecordRepository.java b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/repository/CheckupRecordRepository.java
index 7e0ee3a..da97767 100644
--- a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/repository/CheckupRecordRepository.java
+++ b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/repository/CheckupRecordRepository.java
@@ -1,7 +1,14 @@
 package com.petner.anidoc.domain.vet.checkuprecord.repository;
 
 import com.petner.anidoc.domain.vet.checkuprecord.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
 import org.springframework.data.jpa.repository.JpaRepository;
 
+import java.util.List;
+import java.util.Optional;
+
 public interface CheckupRecordRepository extends JpaRepository<CheckupRecord, Long> {
+    Optional<CheckupRecord> findByIdAndIsDeletedFalse(Long id);
+
+    List<CheckupRecord> findAllByMedicalRecordId(Long medicalRecordId);
 }
diff --git a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/service/CheckupRecordService.java b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/service/CheckupRecordService.java
index 34339aa..aa6049e 100644
--- a/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/service/CheckupRecordService.java
+++ b/backend/src/main/java/com/petner/anidoc/domain/vet/checkuprecord/service/CheckupRecordService.java
@@ -15,6 +15,8 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
 @Slf4j
@@ -51,4 +53,61 @@ public CheckupRecordResponseDto createCheckupRecord(CheckupRecordRequestDto chec
         return CheckupRecordResponseDto.from(savedResult);
     }
 
+    @Transactional
+    public List<CheckupRecordResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findById(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRecordRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupRecordResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRecordRepository.findById(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 삭제할 권한이 없습니다.");
+        }
+
+        checkupRecord.markAsDeleted();
+    }
+
+    @Transactional
+    public CheckupRecordResponseDto updateCheckupRecord(CheckupRecordRequestDto checkupRequestDto,Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRecordRepository.findByIdAndIsDeletedFalse(checkupRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 수정할 권한이 없습니다.");
+        }
+
+        checkupRecord.updateFromDto(checkupRequestDto);
+        return CheckupRecordResponseDto.from(checkupRecord);
+    }
+
+
+
 }


Reviews:
user: login: github-actions[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-15T05:38:45Z
user: login: github-actions[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-15T05:38:46Z
user: login: github-actions[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-15T05:38:47Z
user: login: github-actions[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-15T06:07:46Z
user: login: github-actions[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-15T06:07:47Z
user: login: github-actions[bot]
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-15T06:07:48Z

Review comments:
diff_hunk: @@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkup.dto.CheckupRequestDto;
+import com.petner.anidoc.domain.vet.checkup.dto.CheckupResponseDto;
+import com.petner.anidoc.domain.vet.checkup.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupResponseDto createCheckupRecord(CheckupRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
path: backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
user: login: github-actions[bot]
body: 에러 핸들링을 더욱 세분화하여 특정 예외에 대한 정보를 명확히 전달하는 것이 좋습니다. 예를 들어,  `IllegalArgumentException` 대신 더 구체적인 예외를 사용하고, 예외 메시지에 더 많은 정보를 포함시키는 것을 고려해 보세요.
created_at: 2025-05-15T05:38:45Z
author_association: NONE
diff_hunk: @@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkup.dto.CheckupRequestDto;
+import com.petner.anidoc.domain.vet.checkup.dto.CheckupResponseDto;
+import com.petner.anidoc.domain.vet.checkup.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupResponseDto createCheckupRecord(CheckupRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 삭제할 권한이 없습니다.");
+        }
+
+        checkupRecord.markAsDeleted();
+    }
+
+    @Transactional
+    public CheckupResponseDto updateCheckupRecord(CheckupRequestDto checkupRequestDto,Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
path: backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
user: login: github-actions[bot]
body: CheckupRecord 엔티티의 isDeleted 필드를 활용하여 soft delete를 구현하였으나,  `findByIdAndIsDeletedFalse` 와 같은  조건절을 여러번 사용하고 있습니다.  쿼리 성능 최적화를 위해  Spring Data JPA의 기능을 활용하거나,  조건을 하나로 합치는 방법을 고려해보세요. (예: `@Query` 어노테이션 사용)
created_at: 2025-05-15T05:38:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkup.dto.CheckupRequestDto;
+import com.petner.anidoc.domain.vet.checkup.dto.CheckupResponseDto;
+import com.petner.anidoc.domain.vet.checkup.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupResponseDto createCheckupRecord(CheckupRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 삭제할 권한이 없습니다.");
+        }
+
+        checkupRecord.markAsDeleted();
+    }
+
+    @Transactional
+    public CheckupResponseDto updateCheckupRecord(CheckupRequestDto checkupRequestDto,Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(checkupRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 수정할 권한이 없습니다.");
+        }
+
+        checkupRecord.updateFromDto(checkupRequestDto);
+        return CheckupResponseDto.from(checkupRecord);
+    }
+
path: backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
user: login: github-actions[bot]
body: CheckupRecord 엔티티의 isDeleted 필드를 활용하여 soft delete를 구현하였으나,  `findByIdAndIsDeletedFalse` 와 같은  조건절을 여러번 사용하고 있습니다.  쿼리 성능 최적화를 위해  Spring Data JPA의 기능을 활용하거나,  조건을 하나로 합치는 방법을 고려해보세요. (예: `@Query` 어노테이션 사용)
created_at: 2025-05-15T05:38:47Z
author_association: NONE
diff_hunk: @@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordRequestDto;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordResponseDto;
+import com.petner.anidoc.domain.vet.checkuprecord.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupRecordResponseDto createCheckupRecord(CheckupRecordRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupRecordResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupRecordResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupRecordResponseDto::from)
+                .collect(Collectors.toList());
path: backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
user: login: github-actions[bot]
body: 의존성 주입 방식을 고려하여  `userRepository.findById(userId)` 와 `medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)` 부분을 한번에 처리하는 방법을 고려해볼 수 있습니다. 예를 들어, `findById` 메서드를 커스텀하여 두 엔티티를 동시에 조회하는 기능을 추가할 수 있습니다.
created_at: 2025-05-15T06:07:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordRequestDto;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordResponseDto;
+import com.petner.anidoc.domain.vet.checkuprecord.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupRecordResponseDto createCheckupRecord(CheckupRecordRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupRecordResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupRecordResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupRecordResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 삭제할 권한이 없습니다.");
+        }
+
+        checkupRecord.markAsDeleted();
path: backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
user: login: github-actions[bot]
body: CheckupRecord 엔티티의 isDeleted 필드를 이용하여  `checkupRepository.findAllByMedicalRecordId(medicalRecordId)` 에서 삭제된 검사 기록을 제외하는 로직을 추가하는 것이 좋습니다.
created_at: 2025-05-15T06:07:47Z
author_association: NONE
diff_hunk: @@ -0,0 +1,111 @@
+package com.petner.anidoc.domain.vet.checkup.service;
+
+import com.petner.anidoc.domain.user.user.entity.User;
+import com.petner.anidoc.domain.user.user.entity.UserRole;
+import com.petner.anidoc.domain.user.user.repository.UserRepository;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordRequestDto;
+import com.petner.anidoc.domain.vet.checkuprecord.dto.CheckupRecordResponseDto;
+import com.petner.anidoc.domain.vet.checkuprecord.entity.CheckupRecord;
+import com.petner.anidoc.domain.vet.checkup.repository.CheckupRepository;
+import com.petner.anidoc.domain.vet.medicalrecord.entity.MedicalRecord;
+import com.petner.anidoc.domain.vet.medicalrecord.repository.MedicalRecordRepository;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.nio.file.AccessDeniedException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class CheckupService {
+    private final MedicalRecordRepository medicalRecordRepository;
+    private final UserRepository userRepository;
+    private final CheckupRepository checkupRepository;
+
+    @Transactional
+    public CheckupRecordResponseDto createCheckupRecord(CheckupRecordRequestDto checkupRequestDto, Long userId, Long medicalRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("진료 기록을 작성할 권한이 없습니다.");
+        }
+
+        CheckupRecord checkupResult = CheckupRecord.builder()
+                .medicalRecord(medicalRecord)
+                .checkupType(checkupRequestDto.getCheckupType())
+                .result(checkupRequestDto.getResult())
+                .resultUrl(checkupRequestDto.getResultUrl())
+                .checkupDate(checkupRequestDto.getCheckupDate())
+                .status(checkupRequestDto.getStatus())
+                .build();
+
+        CheckupRecord savedResult = checkupRepository.save(checkupResult);
+
+        return CheckupRecordResponseDto.from(savedResult);
+    }
+
+    @Transactional
+    public List<CheckupRecordResponseDto> getCheckupRecord(Long userId, Long medicalRecordId){ //진료기록 기준 모든 검사기록 조회
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        List<CheckupRecord> checkupRecords = checkupRepository.findAllByMedicalRecordId(medicalRecordId);
+
+        return checkupRecords.stream()
+                .map(CheckupRecordResponseDto::from)
+                .collect(Collectors.toList());
+
+    }
+
+    @Transactional
+    public void deleteCheckupRecord(Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 삭제할 권한이 없습니다.");
+        }
+
+        checkupRecord.markAsDeleted();
+    }
+
+    @Transactional
+    public CheckupRecordResponseDto updateCheckupRecord(CheckupRecordRequestDto checkupRequestDto,Long userId, Long medicalRecordId, Long checkupRecordId) throws AccessDeniedException {
+        User user = userRepository.findById(userId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 유저가 존재하지 않습니다."));
+
+        MedicalRecord medicalRecord = medicalRecordRepository.findByIdAndIsDeletedFalse(medicalRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 진료기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+
+        CheckupRecord checkupRecord = checkupRepository.findByIdAndIsDeletedFalse(checkupRecordId)
+                .orElseThrow(()-> new IllegalArgumentException("해당 검사 기록이 존재하지 않거나 이미 삭제되었습니다."));
+
+        if(!user.getRole().equals(UserRole.ROLE_STAFF)){
+            throw new AccessDeniedException("검사 기록을 수정할 권한이 없습니다.");
+        }
+
+        checkupRecord.updateFromDto(checkupRequestDto);
path: backend/src/main/java/com/petner/anidoc/domain/vet/checkup/service/CheckupService.java
user: login: github-actions[bot]
body: `checkupRepository.findByIdAndIsDeletedFalse(medicalRecordId)` 에서 medicalRecordId 대신 checkupRecordId를 사용해야 합니다.
created_at: 2025-05-15T06:07:48Z
author_association: NONE

PR comments:
user: login: codefish-sea
created_at: 2025-05-15T06:15:05Z
body: LGTM
author_association: CONTRIBUTOR
user: login: mordor8378
created_at: 2025-05-15T06:19:00Z
body: LGTM
author_association: CONTRIBUTOR