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:
parent
d8aa073564
commit
7928bbd55c
@ -151,24 +151,30 @@ def get_prescription_detail(prescription_id):
|
||||
conn = get_mssql_connection('PM_PRES')
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 처방전 기본 정보
|
||||
# 처방전 기본 정보 + 질병정보
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
PreSerial,
|
||||
Day_Serial,
|
||||
PassDay,
|
||||
Paname,
|
||||
PaNum,
|
||||
CusCode,
|
||||
InsName,
|
||||
Drname,
|
||||
PresTime,
|
||||
PreGubun,
|
||||
PRICE_T,
|
||||
PRICE_P,
|
||||
PRICE_C
|
||||
FROM PS_MAIN
|
||||
WHERE PreSerial = ?
|
||||
M.PreSerial,
|
||||
M.Day_Serial,
|
||||
M.PassDay,
|
||||
M.Paname,
|
||||
M.PaNum,
|
||||
M.CusCode,
|
||||
M.InsName,
|
||||
M.Drname,
|
||||
M.PresTime,
|
||||
M.PreGubun,
|
||||
M.PRICE_T,
|
||||
M.PRICE_P,
|
||||
M.PRICE_C,
|
||||
M.St1,
|
||||
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,))
|
||||
|
||||
rx_row = cursor.fetchone()
|
||||
@ -232,6 +238,21 @@ def get_prescription_detail(prescription_id):
|
||||
except:
|
||||
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({
|
||||
'success': True,
|
||||
'prescription': {
|
||||
@ -251,6 +272,7 @@ def get_prescription_detail(prescription_id):
|
||||
'age': age,
|
||||
'gender': gender
|
||||
},
|
||||
'disease_info': disease_info,
|
||||
'medications': medications,
|
||||
'medication_count': len(medications)
|
||||
})
|
||||
|
||||
@ -574,11 +574,24 @@
|
||||
document.getElementById('detailInfo').textContent =
|
||||
`${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 = `
|
||||
<span>🏥 ${data.prescription.hospital || '-'}</span>
|
||||
<span>👨⚕️ ${data.prescription.doctor || '-'}</span>
|
||||
<span>📅 ${data.prescription.date}</span>
|
||||
<span>💊 ${data.medication_count}종</span>
|
||||
${diseaseHtml}
|
||||
`;
|
||||
|
||||
// 약품 테이블
|
||||
|
||||
Loading…
Reference in New Issue
Block a user