Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -231,6 +231,7 @@ def save_appointment_to_sheet(appointment_data):
|
|
| 231 |
appointment_data['clinic'],
|
| 232 |
appointment_data['doctor'],
|
| 233 |
appointment_data['preferred_time_slot'],
|
|
|
|
| 234 |
datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 235 |
]
|
| 236 |
sheet.append_row(row)
|
|
@@ -360,20 +361,32 @@ def main_page():
|
|
| 360 |
doctor, image_path = doctors[i + 1]
|
| 361 |
col2.image(image_path, caption=doctor, use_column_width=True)
|
| 362 |
|
|
|
|
| 363 |
if st.session_state.hn_valid:
|
| 364 |
-
doctor_options = ["-- เลือกชื่อแพทย์ --"] + clinic_doctor_mapping[st.session_state.clinic_key]
|
| 365 |
st.session_state.selected_doctor = st.selectbox("เลือกแพทย์", options=doctor_options, key='doctor_select')
|
| 366 |
-
|
| 367 |
if st.session_state.selected_doctor and st.session_state.selected_doctor != "-- เลือกชื่อแพทย์ --":
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
if st.button("สรุปข้อมูลที่ท่านจะทำนัด"):
|
| 376 |
st.session_state.appointment_confirmed = True
|
|
|
|
|
|
|
| 377 |
else:
|
| 378 |
st.warning("แนะนำให้เปิดเลข HN กับโรงพยาบาลจุฬาภรณ์ก่อน และกลับมาทำนัดทางระบบอีกครั้ง")
|
| 379 |
st.info("หากท่านต้องการข้อมูลเพิ่มเติมเกี่ยวกับการเปิด HN กรุณาติดต่อ 02-576-6000")
|
|
|
|
| 231 |
appointment_data['clinic'],
|
| 232 |
appointment_data['doctor'],
|
| 233 |
appointment_data['preferred_time_slot'],
|
| 234 |
+
"ใดก็ได้" if appointment_data['doctor'] == "แพทย์ท่านใดก็ได้" else "เฉพาะเจาะจง",
|
| 235 |
datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 236 |
]
|
| 237 |
sheet.append_row(row)
|
|
|
|
| 361 |
doctor, image_path = doctors[i + 1]
|
| 362 |
col2.image(image_path, caption=doctor, use_column_width=True)
|
| 363 |
|
| 364 |
+
##
|
| 365 |
if st.session_state.hn_valid:
|
| 366 |
+
doctor_options = ["-- เลือกชื่อแพทย์ --"] + clinic_doctor_mapping[st.session_state.clinic_key] + ["แพทย์ท่านใดก็ได้"]
|
| 367 |
st.session_state.selected_doctor = st.selectbox("เลือกแพทย์", options=doctor_options, key='doctor_select')
|
| 368 |
+
|
| 369 |
if st.session_state.selected_doctor and st.session_state.selected_doctor != "-- เลือกชื่อแพทย์ --":
|
| 370 |
+
if st.session_state.selected_doctor == "แพทย์ท่านใดก็ได้":
|
| 371 |
+
st.subheader("เลือกช่วงเวลาที่สะดวก:")
|
| 372 |
+
time_options = ["ในเวลาราชการ", "นอกเวลาราชการ (คิวจะเร็วกว่า เป็นช่วงหลัง 16.00 น. และวันเสาร์-อาทิตย์)"]
|
| 373 |
+
st.session_state.selected_slot = st.radio("", options=time_options)
|
| 374 |
+
else:
|
| 375 |
+
st.subheader(f"เวลาตรวจของ {st.session_state.selected_doctor}:")
|
| 376 |
+
time_slots = doctor_time_slots[st.session_state.selected_doctor]
|
| 377 |
+
st.session_state.selected_slot = st.selectbox("เลือกเวลาตรวจ", options=["-- เลือกเวลาตรวจ --"] + time_slots, key='time_slot_select')
|
| 378 |
+
|
| 379 |
+
if st.session_state.selected_doctor == "แพทย์ท่านใดก็ได้":
|
| 380 |
+
st.info("หมายเหตุ: การตรวจนอกเวลาราชการ (หลัง 16.00 น.) รวมทั้งวันหยุดเสาร์-อาทิตย์ จะมีค่าใช้จ่ายเพิ่มเติมในการตรวจ")
|
| 381 |
+
else:
|
| 382 |
+
st.info("หมายเหตุ: การตรวจนอกเวลาราชการ (หลัง 16.00 น.) รวมทั้งวันหยุดเสาร์-อาทิตย์ จะมีค่าใช้จ่ายเพิ่มเติมในการตรวจ")
|
| 383 |
+
|
| 384 |
+
if ((st.session_state.selected_doctor == "แพทย์ท่านใดก็ได้" and st.session_state.selected_slot) or
|
| 385 |
+
(st.session_state.selected_doctor != "แพทย์ท่านใดก็ได้" and st.session_state.selected_slot != "-- เลือกเวลาตรวจ --")):
|
| 386 |
if st.button("สรุปข้อมูลที่ท่านจะทำนัด"):
|
| 387 |
st.session_state.appointment_confirmed = True
|
| 388 |
+
|
| 389 |
+
##
|
| 390 |
else:
|
| 391 |
st.warning("แนะนำให้เปิดเลข HN กับโรงพยาบาลจุฬาภรณ์ก่อน และกลับมาทำนัดทางระบบอีกครั้ง")
|
| 392 |
st.info("หากท่านต้องการข้อมูลเพิ่มเติมเกี่ยวกับการเปิด HN กรุณาติดต่อ 02-576-6000")
|