fix(rx-usage): 투약량 계산 수정 (INV_QUAN 사용)

- total_dose를 QUAN×Days → INV_QUAN으로 변경
- 투약량 = 1회복용량 × 복용횟수 × 일수 (정확한 계산)
- ORDER BY는 기존 유지 (GROUP BY 구조 문제로 임시)
This commit is contained in:
thug0bin
2026-03-13 00:10:17 +09:00
parent d901c67125
commit 94dea2ab3a
2 changed files with 12 additions and 12 deletions

View File

@@ -5105,7 +5105,7 @@ def api_rx_usage():
ISNULL(G.GoodsName, '알 수 없음') as product_name,
ISNULL(G.SplName, '') as supplier,
SUM(ISNULL(P.QUAN, 1)) as total_qty,
SUM(ISNULL(P.QUAN, 1) * ISNULL(P.Days, 1)) as total_dose,
SUM(ISNULL(P.INV_QUAN, 0)) as total_dose, -- 총 투약량 (1회복용량 x 복용횟수 x 일수)
SUM(ISNULL(P.DRUPRICE, 0)) as total_amount, -- DRUPRICE 합계
COUNT(DISTINCT P.PreSerial) as prescription_count,
COALESCE(NULLIF(G.BARCODE, ''), '') as barcode,