fix: 커스텀 처방 감지 로직 개선 및 기존 데이터 업데이트

- 문제: ingredient_code 기준 비교 누락으로 인삼 제거가 감지되지 않음
  - 인삼(3400H1AHM)은 herb_items에 없어서 herb_item_id 매핑 실패
  - 원 처방에만 있고 실제 재고가 없는 약재 처리 불가

- 해결: ingredient_code 기준 비교 로직 추가
  - original_by_code 딕셔너리로 원 처방 구성 저장
  - actual_by_code 딕셔너리로 실제 조제 구성 저장
  - 제거된 약재를 ingredient_code 기준으로 감지

- 조제 상세 모달에 가감방 표시 추가
  - 처방명 옆에 "가감" 뱃지 표시
  - 변경 내용 요약 표시

- 기존 데이터 업데이트 스크립트 추가
  - 십전대보탕에서 인삼 제거 감지 성공
  - compound #4를 가감방으로 정상 업데이트

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-02-17 01:38:23 +00:00
parent 1441c01fb4
commit 6ad8bac5c2
3 changed files with 160 additions and 9 deletions

View File

@@ -1108,8 +1108,15 @@ $(document).ready(function() {
$('#detailPatientPhone').text(data.patient_phone || '-');
$('#detailCompoundDate').text(data.compound_date || '-');
// 처방 정보
$('#detailFormulaName').text(data.formula_name || '직접조제');
// 처방 정보 (가감방 표시 포함)
let formulaDisplay = data.formula_name || '직접조제';
if (data.is_custom && data.formula_name) {
formulaDisplay += ' <span class="badge bg-warning">가감</span>';
if (data.custom_summary) {
formulaDisplay += `<br><small class="text-muted">${data.custom_summary}</small>`;
}
}
$('#detailFormulaName').html(formulaDisplay); // text() 대신 html() 사용
$('#detailPrescriptionNo').text(data.prescription_no || '-');
$('#detailQuantities').text(`${data.je_count}제 / ${data.cheop_total}첩 / ${data.pouch_total}파우치`);