From 041d1d81c486a1628d72273494302687e89f5b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=9C=EA=B3=A8=EC=95=BD=EC=82=AC?= Date: Sun, 15 Feb 2026 12:54:22 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=99=98=EC=9E=90=20=EC=B2=98=EB=B0=A9?= =?UTF-8?q?=20=EB=82=B4=EC=97=AD=EC=97=90=EC=84=9C=20=EC=A1=B0=EC=A0=9C=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=EC=9D=B8=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=ED=8E=BC=EC=B9=A8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 환자 처방 내역 모달에서 처방 행 클릭 시 상세 정보 펼침 - 중첩 모달 문제 해결을 위해 인라인 표시 방식으로 변경 - 구성 약재 정보 테이블 표시 (약재명, 보험코드, 첩당용량, 총용량) - 재고 소비 내역 테이블 표시 (약재명, 원산지, 도매상, 사용량, 단가, 원가) - 총 원가 자동 계산 및 표시 - chevron 아이콘으로 펼침/접힘 상태 표시 - 다른 행 클릭 시 자동으로 이전 행 닫기 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- static/app.js | 146 +++++++++++++++++++++++++++++++++++++++---- templates/index.html | 6 +- 2 files changed, 137 insertions(+), 15 deletions(-) diff --git a/static/app.js b/static/app.js index 672ab18..f1ad19f 100644 --- a/static/app.js +++ b/static/app.js @@ -254,7 +254,7 @@ $(document).ready(function() { `); } else { - compounds.forEach(compound => { + compounds.forEach((compound, index) => { // 상태 뱃지 let statusBadge = ''; switch(compound.status) { @@ -271,8 +271,13 @@ $(document).ready(function() { statusBadge = '대기'; } + const detailRowId = `compound-detail-${compound.compound_id}`; + tbody.append(` - + + + + ${compound.compound_date || '-'} ${compound.formula_name || '직접조제'} ${compound.je_count || 0} @@ -282,20 +287,59 @@ $(document).ready(function() { ${formatCurrency(compound.sell_price_total || 0)} ${statusBadge} ${compound.prescription_no || '-'} - - + + + +
+
+
+
+
구성 약재
+
+
+
+ 로딩 중... +
+
+ +
재고 소비 내역
+
+
+
+ 로딩 중... +
+
+
+
+
+
`); }); - // 상세보기 버튼 이벤트 - $('.view-compound-detail').on('click', function() { - const compoundId = $(this).data('id'); - viewCompoundDetail(compoundId); + // 행 클릭 이벤트 - 상세 정보 토글 + $('.compound-row').on('click', function() { + const compoundId = $(this).data('compound-id'); + const detailRow = $(`#compound-detail-${compoundId}`); + const icon = $(this).find('.toggle-icon'); + + if (detailRow.is(':visible')) { + // 닫기 + detailRow.slideUp(); + icon.removeClass('bi-chevron-down').addClass('bi-chevron-right'); + } else { + // 열기 - 다른 모든 행 닫기 + $('.collapse-row').slideUp(); + $('.toggle-icon').removeClass('bi-chevron-down').addClass('bi-chevron-right'); + + // 현재 행 열기 + detailRow.slideDown(); + icon.removeClass('bi-chevron-right').addClass('bi-chevron-down'); + + // 상세 정보 로드 + loadCompoundDetailInline(compoundId); + } }); } @@ -311,6 +355,70 @@ $(document).ready(function() { }); } + // 환자 처방 내역 모달 내에서 조제 상세 정보 로드 (인라인) + function loadCompoundDetailInline(compoundId) { + $.get(`/api/compounds/${compoundId}`, function(response) { + if (response.success && response.data) { + const data = response.data; + + // 구성 약재 테이블 + let ingredientsHtml = ''; + + if (data.ingredients && data.ingredients.length > 0) { + data.ingredients.forEach(ing => { + ingredientsHtml += ` + + + + + + + `; + }); + } else { + ingredientsHtml += ''; + } + ingredientsHtml += '
약재명보험코드첩당용량총용량
${ing.herb_name}${ing.insurance_code || '-'}${ing.grams_per_cheop}g${ing.total_grams}g
약재 정보가 없습니다
'; + + $(`#ingredients-${compoundId}`).html(ingredientsHtml); + + // 재고 소비 내역 테이블 + let consumptionsHtml = ''; + + if (data.consumptions && data.consumptions.length > 0) { + let totalCost = 0; + data.consumptions.forEach(con => { + totalCost += con.cost_amount || 0; + consumptionsHtml += ` + + + + + + + + + `; + }); + consumptionsHtml += ` + + + + + `; + } else { + consumptionsHtml += ''; + } + consumptionsHtml += '
약재명원산지도매상사용량단가원가
${con.herb_name}${con.origin_country || '-'}${con.supplier_name || '-'}${con.quantity_used}g${formatCurrency(con.unit_cost_per_g)}/g${formatCurrency(con.cost_amount)}
총 원가:${formatCurrency(totalCost)}
재고 소비 내역이 없습니다
'; + + $(`#consumptions-${compoundId}`).html(consumptionsHtml); + } + }).fail(function() { + $(`#ingredients-${compoundId}`).html('
데이터를 불러오는데 실패했습니다.
'); + $(`#consumptions-${compoundId}`).html('
데이터를 불러오는데 실패했습니다.
'); + }); + } + // 처방 목록 로드 function loadFormulas() { $.get('/api/formulas', function(response) { @@ -847,7 +955,21 @@ $(document).ready(function() { // 비고 $('#detailNotes').text(data.notes || ''); - // 모달 표시 + // 부모 모달(환자 처방 내역)을 임시로 숨기고 조제 상세 모달 열기 + const parentModal = $('#patientCompoundsModal'); + const wasParentOpen = parentModal.hasClass('show'); + + if (wasParentOpen) { + // 부모 모달 숨기기 (DOM에서 제거하지 않음) + parentModal.modal('hide'); + + // 조제 상세 모달이 닫힐 때 부모 모달 다시 열기 + $('#compoundDetailModal').off('hidden.bs.modal').on('hidden.bs.modal', function() { + parentModal.modal('show'); + }); + } + + // 조제 상세 모달 열기 $('#compoundDetailModal').modal('show'); } }).fail(function() { diff --git a/templates/index.html b/templates/index.html index 18c03fd..5a7da18 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1088,9 +1088,10 @@
처방 내역
- +
+ @@ -1100,11 +1101,10 @@ - - +
조제일 처방명 제수판매가 상태 처방전번호작업