feat: PMR 질병정보 표시

- PS_MAIN.St1, St2 + PM_BASE.CD_SANG JOIN
- 처방 헤더에 🩺 질병명 표시
- disease_info: {code_1, code_2, name_1, name_2}
This commit is contained in:
thug0bin 2026-03-04 23:46:02 +09:00
parent d8aa073564
commit 7928bbd55c
2 changed files with 51 additions and 16 deletions

View File

@ -151,24 +151,30 @@ def get_prescription_detail(prescription_id):
conn = get_mssql_connection('PM_PRES') conn = get_mssql_connection('PM_PRES')
cursor = conn.cursor() cursor = conn.cursor()
# 처방전 기본 정보 # 처방전 기본 정보 + 질병정보
cursor.execute(""" cursor.execute("""
SELECT SELECT
PreSerial, M.PreSerial,
Day_Serial, M.Day_Serial,
PassDay, M.PassDay,
Paname, M.Paname,
PaNum, M.PaNum,
CusCode, M.CusCode,
InsName, M.InsName,
Drname, M.Drname,
PresTime, M.PresTime,
PreGubun, M.PreGubun,
PRICE_T, M.PRICE_T,
PRICE_P, M.PRICE_P,
PRICE_C M.PRICE_C,
FROM PS_MAIN M.St1,
WHERE PreSerial = ? M.St2,
S1.AU_NAME,
S2.AU_NAME
FROM PS_MAIN M
LEFT JOIN PM_BASE.dbo.CD_SANG S1 ON M.St1 = S1.AU_CODE
LEFT JOIN PM_BASE.dbo.CD_SANG S2 ON M.St2 = S2.AU_CODE
WHERE M.PreSerial = ?
""", (prescription_id,)) """, (prescription_id,))
rx_row = cursor.fetchone() rx_row = cursor.fetchone()
@ -232,6 +238,21 @@ def get_prescription_detail(prescription_id):
except: except:
pass pass
# 질병 정보 (St1, St2 → AU_NAME)
disease_info = None
st1 = rx_row[13] or '' # St1
st2 = rx_row[14] or '' # St2
disease_name_1 = rx_row[15] or '' # S1.AU_NAME
disease_name_2 = rx_row[16] or '' # S2.AU_NAME
if st1 or st2:
disease_info = {
'code_1': st1,
'code_2': st2,
'name_1': disease_name_1,
'name_2': disease_name_2
}
return jsonify({ return jsonify({
'success': True, 'success': True,
'prescription': { 'prescription': {
@ -251,6 +272,7 @@ def get_prescription_detail(prescription_id):
'age': age, 'age': age,
'gender': gender 'gender': gender
}, },
'disease_info': disease_info,
'medications': medications, 'medications': medications,
'medication_count': len(medications) 'medication_count': len(medications)
}) })

View File

@ -574,11 +574,24 @@
document.getElementById('detailInfo').textContent = document.getElementById('detailInfo').textContent =
`${data.patient.age || '-'}세 / ${data.patient.gender || '-'} / ${data.patient.birthdate || '-'}`; `${data.patient.age || '-'}세 / ${data.patient.gender || '-'} / ${data.patient.birthdate || '-'}`;
// 질병 정보 표시
let diseaseHtml = '';
if (data.disease_info) {
const d = data.disease_info;
const diseases = [];
if (d.name_1) diseases.push(d.name_1);
if (d.name_2) diseases.push(d.name_2);
if (diseases.length > 0) {
diseaseHtml = `<span style="background:#fef3c7;color:#92400e;">🩺 ${diseases.join(', ')}</span>`;
}
}
document.getElementById('rxInfo').innerHTML = ` document.getElementById('rxInfo').innerHTML = `
<span>🏥 ${data.prescription.hospital || '-'}</span> <span>🏥 ${data.prescription.hospital || '-'}</span>
<span>👨‍⚕️ ${data.prescription.doctor || '-'}</span> <span>👨‍⚕️ ${data.prescription.doctor || '-'}</span>
<span>📅 ${data.prescription.date}</span> <span>📅 ${data.prescription.date}</span>
<span>💊 ${data.medication_count}종</span> <span>💊 ${data.medication_count}종</span>
${diseaseHtml}
`; `;
// 약품 테이블 // 약품 테이블