-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 약 소프트 삭제 도입 및 약물 충돌 정합성 정비 #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 30 additions & 11 deletions
41
src/main/java/com/piuda/callcare/domain/drugconflict/converter/DrugConflictConverter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,62 @@ | ||
| package com.piuda.callcare.domain.drugconflict.converter; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import com.piuda.callcare.domain.drugconflict.dto.response.ConflictDrug; | ||
| import com.piuda.callcare.domain.drugconflict.dto.response.DrugConflictDetailResponse; | ||
| import com.piuda.callcare.domain.drugconflict.dto.response.DrugConflictResponse; | ||
| import com.piuda.callcare.domain.drugconflict.entity.DrugConflict; | ||
| import com.piuda.callcare.domain.medication.entity.Medication; | ||
|
|
||
| @Component | ||
| public class DrugConflictConverter { | ||
|
|
||
| // DrugConflict → DrugConflictResponse (목록 카드용) | ||
| // 카드 표시값(제품종류·제품명·처방기관·처방날짜)은 저장하지 않고 Medication에서 조합한다. | ||
| public DrugConflictResponse toResponse(DrugConflict conflict) { | ||
| return new DrugConflictResponse( | ||
| conflict.getId(), | ||
| conflict.getMedication1().getId(), | ||
| conflict.getMedication1().getDrugName(), | ||
| conflict.getMedication2().getId(), | ||
| conflict.getMedication2().getDrugName(), | ||
| toConflictDrug(conflict.getMedication1()), | ||
| toConflictDrug(conflict.getMedication2()), | ||
| conflict.getSeverity(), | ||
| conflict.getSeverity().getLabel(), | ||
| conflict.getIsResolved() | ||
| ); | ||
| } | ||
|
|
||
| // DrugConflict → DrugConflictDetailResponse (상세 조회용) | ||
| // 약 정보는 목록과 동일한 ConflictDrug로 채워 두 응답의 형태를 맞춘다. | ||
| public DrugConflictDetailResponse toDetail(DrugConflict conflict) { | ||
| return new DrugConflictDetailResponse( | ||
| conflict.getId(), | ||
| conflict.getMedication1().getId(), | ||
| conflict.getMedication1().getDrugName(), | ||
| conflict.getMedication1().getDrugNickname(), | ||
| conflict.getMedication2().getId(), | ||
| conflict.getMedication2().getDrugName(), | ||
| conflict.getMedication2().getDrugNickname(), | ||
| toConflictDrug(conflict.getMedication1()), | ||
| toConflictDrug(conflict.getMedication2()), | ||
| conflict.getSeverity(), | ||
| conflict.getSeverity().getLabel(), | ||
| conflict.getConflictDescription(), | ||
| conflict.getIsResolved(), | ||
| conflict.getCreatedAt() | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| // Medication → ConflictDrug (목록·상세에 표시할 약 정보 합성) | ||
| private ConflictDrug toConflictDrug(Medication medication) { | ||
| return new ConflictDrug( | ||
| medication.getId(), | ||
| medication.getDrugType(), | ||
| medication.getDrugName(), | ||
| medication.getDrugNickname(), | ||
| medication.getHospitalName(), | ||
| resolvePrescriptionDate(medication) | ||
| ); | ||
| } | ||
|
|
||
| // 처방 날짜 폴백: prescription_date(OCR) → 없으면 start_date(사용자 입력) | ||
| private LocalDate resolvePrescriptionDate(Medication medication) { | ||
| return medication.getPrescriptionDate() != null | ||
| ? medication.getPrescriptionDate() | ||
| : medication.getStartDate(); | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/piuda/callcare/domain/drugconflict/dto/response/ConflictDrug.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.piuda.callcare.domain.drugconflict.dto.response; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| // 충돌에 관련된 약 한 알의 표시 정보. 목록 카드와 상세가 같은 구조를 공유한다. | ||
| // 저장하지 않고 조회 시 Medication에서 조합한다(파생값 비저장 원칙). | ||
| @Schema(description = "충돌에 관련된 약 정보") | ||
| public record ConflictDrug( | ||
|
|
||
| @Schema(description = "약(medication) ID") Long medicationId, | ||
| @Schema(description = "제품 종류 (drug_type)") String drugType, | ||
| @Schema(description = "제품명 (drug_name)") String drugName, | ||
| @Schema(description = "약 별명 (drug_nickname)") String drugNickname, | ||
| @Schema(description = "처방 기관 (hospital_name)") String hospitalName, | ||
| @Schema(description = "처방 날짜 (prescription_date, 없으면 start_date로 폴백)") LocalDate prescriptionDate | ||
| ) { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: PIUDAProject/Backend
Length of output: 41576
🏁 Script executed:
Repository: PIUDAProject/Backend
Length of output: 249
🏁 Script executed:
Repository: PIUDAProject/Backend
Length of output: 6127
외부 API 응답 계약 변경을 배포 전에 확인하십시오.
약물 필드가
drug1/drug2중첩 객체로 바뀌었습니다. 기존 클라이언트는drug1Name,drug2Name같은 평탄 필드를 더 읽지 못하므로 렌더링 오류가 발생할 수 있습니다.GET /api/conflicts와/api/conflicts/{conflictId}응답을 새 중첩 JSON 구조로 매핑하는 프론트 변경을 배포와 맞추십시오.drugType,drugName,prescriptionDate같은 중첩 필드 추가를 반영하십시오.GET /api/conflicts와 상세 조회 모두에 적용됩니다.📍 Affects 4 files
src/main/java/com/piuda/callcare/domain/drugconflict/dto/response/DrugConflictResponse.java#L10-L18(this comment)src/main/java/com/piuda/callcare/domain/drugconflict/dto/response/ConflictDrug.java#L10-L18src/main/java/com/piuda/callcare/domain/drugconflict/dto/response/DrugConflictDetailResponse.java#L12-L22src/main/java/com/piuda/callcare/domain/drugconflict/converter/DrugConflictConverter.java#L18-L60🤖 Prompt for AI Agents