feat(V1): 선별급여 컬럼 추가 (QT-POS 동기화)
- SE_PRICE_P (선별급여약가) 컬럼 추가 - SE_PRICE_C (선별급여 보험부담) 컬럼 추가 - 청구액 = PRICE_C + SE_PRICE_C - 비급여조제료 계산에서 SE_PRICE_P 제외
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -69,6 +69,9 @@ def get_sales_stats(date_from: str, date_to: str) -> dict:
|
||||
m.PRICE_P,
|
||||
-- 진짜 수납액: PRICE_N + 선별급여/상한제초과 (PS_Main_Sub)
|
||||
(m.PRICE_N + ISNULL(s.SE_PRICE_P, 0)) AS PRICE_N,
|
||||
-- 선별급여 (QT-POS 동기화)
|
||||
ISNULL(s.SE_PRICE_P, 0) AS SE_PRICE_P,
|
||||
ISNULL(s.SE_PRICE_C, 0) AS SE_PRICE_C,
|
||||
ISNULL(n.Appr_Gubun, '') AS Appr_Gubun,
|
||||
ISNULL(n.nAPPROVAL_NUM, '') AS nAPPROVAL_NUM
|
||||
FROM PM_PRES..PS_MAIN m
|
||||
@@ -103,6 +106,8 @@ def get_sales_stats(date_from: str, date_to: str) -> dict:
|
||||
price_c = int(r.get('PRICE_C') or 0)
|
||||
price_p = int(r.get('PRICE_P') or 0)
|
||||
price_n = int(r.get('PRICE_N') or 0)
|
||||
se_price_p = int(r.get('SE_PRICE_P') or 0)
|
||||
se_price_c = int(r.get('SE_PRICE_C') or 0)
|
||||
appr_gubun = str(r.get('Appr_Gubun') or '')
|
||||
order_name = str(r.get('OrderName') or '기타')
|
||||
panum = str(r.get('PaNum') or '')
|
||||
@@ -116,10 +121,13 @@ def get_sales_stats(date_from: str, date_to: str) -> dict:
|
||||
nonins_drug = drug_t4
|
||||
else:
|
||||
ins_prep, ins_drug = s_prep, price_t - s_prep
|
||||
nonins_prep = max(0, price_n - drug_t4 - price_p) if drug_t4 > 0 else 0
|
||||
nonins_prep = max(0, price_n - drug_t4 - se_price_p - price_p) if drug_t4 > 0 else 0
|
||||
nonins_drug = drug_t4
|
||||
|
||||
args = (sales_amt, ins_prep, ins_drug, nonins_prep, nonins_drug, 0, price_c, price_p, price_n)
|
||||
# 청구액 = PRICE_C + SE_PRICE_C (선별급여 보험부담분)
|
||||
claim_amt = price_c + se_price_c
|
||||
|
||||
args = (sales_amt, ins_prep, ins_drug, nonins_prep, nonins_drug, 0, claim_amt, price_p, price_n, se_price_p)
|
||||
|
||||
# 전체
|
||||
_add(result['total'], *args)
|
||||
@@ -167,11 +175,11 @@ def get_sales_stats(date_from: str, date_to: str) -> dict:
|
||||
def _empty_row():
|
||||
return dict(cnt=0, sales_amt=0, ins_prep=0, ins_drug=0,
|
||||
nonins_prep=0, nonins_drug=0, nonins_margin=0,
|
||||
claim_amt=0, copay=0, receipt=0)
|
||||
claim_amt=0, copay=0, receipt=0, se_price_p=0)
|
||||
|
||||
|
||||
def _add(d, sales_amt, ins_prep, ins_drug, nonins_prep, nonins_drug,
|
||||
nonins_margin, claim_amt, copay, receipt):
|
||||
nonins_margin, claim_amt, copay, receipt, se_price_p=0):
|
||||
d['cnt'] += 1
|
||||
d['sales_amt'] += sales_amt
|
||||
d['ins_prep'] += ins_prep
|
||||
@@ -182,6 +190,7 @@ def _add(d, sales_amt, ins_prep, ins_drug, nonins_prep, nonins_drug,
|
||||
d['claim_amt'] += claim_amt
|
||||
d['copay'] += copay
|
||||
d['receipt'] += receipt
|
||||
d['se_price_p'] += se_price_p
|
||||
|
||||
|
||||
def _calc_age(panum: str, ref_date: date) -> int | None:
|
||||
|
||||
Reference in New Issue
Block a user