Skip to content

Commit b5ec215

Browse files
refactor: update service implementations and exception handling
1 parent fa17d2a commit b5ec215

7 files changed

Lines changed: 712 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.countyhospital.healthapi.common.exception;
2+
3+
import org.springframework.http.HttpStatus;
4+
import org.springframework.web.bind.annotation.ResponseStatus;
5+
6+
@ResponseStatus(HttpStatus.BAD_REQUEST)
7+
public class BusinessException extends RuntimeException {
8+
9+
public BusinessException(String message) {
10+
super(message);
11+
}
12+
13+
public BusinessException(String message, Throwable cause) {
14+
super(message, cause);
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.countyhospital.healthapi.common.exception;
2+
3+
import org.springframework.http.HttpStatus;
4+
import org.springframework.web.bind.annotation.ResponseStatus;
5+
6+
@ResponseStatus(HttpStatus.NOT_FOUND)
7+
public class ResourceNotFoundException extends RuntimeException {
8+
9+
public ResourceNotFoundException(String message) {
10+
super(message);
11+
}
12+
13+
public ResourceNotFoundException(String message, Throwable cause) {
14+
super(message, cause);
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.countyhospital.healthapi.common.exception;
2+
3+
import org.springframework.http.HttpStatus;
4+
import org.springframework.web.bind.annotation.ResponseStatus;
5+
6+
@ResponseStatus(HttpStatus.BAD_REQUEST)
7+
public class ValidationException extends RuntimeException {
8+
9+
public ValidationException(String message) {
10+
super(message);
11+
}
12+
13+
public ValidationException(String message, Throwable cause) {
14+
super(message, cause);
15+
}
16+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.countyhospital.healthapi.encounter.service;
2+
3+
import java.time.LocalDateTime;
4+
import java.util.List;
5+
6+
import org.springframework.data.domain.Page;
7+
import org.springframework.data.domain.Pageable;
8+
9+
import com.countyhospital.healthapi.encounter.domain.Encounter;
10+
11+
public interface EncounterService {
12+
13+
Encounter createEncounter(Encounter encounter);
14+
15+
Encounter getEncounterById(Long id);
16+
17+
List<Encounter> getEncountersByPatientId(Long patientId);
18+
19+
Page<Encounter> getEncountersByPatientId(Long patientId, Pageable pageable);
20+
21+
List<Encounter> getAllEncounters();
22+
23+
Page<Encounter> getAllEncounters(Pageable pageable);
24+
25+
List<Encounter> getEncountersByDateRange(LocalDateTime start, LocalDateTime end);
26+
27+
List<Encounter> getEncountersByPatientIdAndDateRange(Long patientId, LocalDateTime start, LocalDateTime end);
28+
29+
List<Encounter> getEncountersByClass(String encounterClass);
30+
31+
Encounter updateEncounter(Long id, Encounter encounterDetails);
32+
33+
void deleteEncounter(Long id);
34+
35+
boolean encounterExists(Long id);
36+
37+
long getEncounterCountByPatientId(Long patientId);
38+
}

0 commit comments

Comments
 (0)