797 lines
28 KiB
Python
797 lines
28 KiB
Python
# ============================================================
|
|
# SISTEM INFORMASI RUMAH SAKIT JAYA ABADI
|
|
# Interactive Terminal Program (OOP Implementation)
|
|
# ============================================================
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# CLASS: Pasien (Encapsulated)
|
|
# ─────────────────────────────────────────────
|
|
class Pasien:
|
|
jumlah_pasien = 0
|
|
|
|
def __init__(self, nama, tanggal_lahir, id_pasien, alamat, no_telepon, keluhan):
|
|
Pasien.jumlah_pasien += 1
|
|
# Atribut private (Enkapsulasi)
|
|
self.__nama = nama
|
|
self.__id_pasien = id_pasien
|
|
self.__birth_date = tanggal_lahir
|
|
self.__alamat = alamat
|
|
self.__telp = no_telepon
|
|
self.__keluhan = keluhan
|
|
self.__bpjs = False
|
|
self.__no_antrian = None
|
|
self.__dokter = None
|
|
self.__diagnosis = None
|
|
self.__resep = None
|
|
self.__obat = None
|
|
self.__dosis = None
|
|
self.__catatan = None
|
|
self.__status = "Belum Daftar"
|
|
|
|
# --- GETTER & SETTER (Properties) ---
|
|
@property
|
|
def nama(self):
|
|
return self.__nama
|
|
|
|
@nama.setter
|
|
def nama(self, value):
|
|
self.__nama = value
|
|
|
|
@property
|
|
def id_pasien(self):
|
|
return self.__id_pasien
|
|
|
|
@property
|
|
def birth_date(self):
|
|
return self.__birth_date
|
|
|
|
@birth_date.setter
|
|
def birth_date(self, value):
|
|
self.__birth_date = value
|
|
|
|
@property
|
|
def alamat(self):
|
|
return self.__alamat
|
|
|
|
@alamat.setter
|
|
def alamat(self, value):
|
|
self.__alamat = value
|
|
|
|
@property
|
|
def telp(self):
|
|
return self.__telp
|
|
|
|
@telp.setter
|
|
def telp(self, value):
|
|
self.__telp = value
|
|
|
|
@property
|
|
def keluhan(self):
|
|
return self.__keluhan
|
|
|
|
@keluhan.setter
|
|
def keluhan(self, value):
|
|
self.__keluhan = value
|
|
|
|
@property
|
|
def bpjs(self):
|
|
return self.__bpjs
|
|
|
|
@bpjs.setter
|
|
def bpjs(self, value):
|
|
self.__bpjs = bool(value)
|
|
|
|
@property
|
|
def no_antrian(self):
|
|
return self.__no_antrian
|
|
|
|
@no_antrian.setter
|
|
def no_antrian(self, value):
|
|
self.__no_antrian = value
|
|
|
|
@property
|
|
def dokter(self):
|
|
return self.__dokter
|
|
|
|
@dokter.setter
|
|
def dokter(self, value):
|
|
self.__dokter = value
|
|
|
|
@property
|
|
def diagnosis(self):
|
|
return self.__diagnosis
|
|
|
|
@diagnosis.setter
|
|
def diagnosis(self, value):
|
|
self.__diagnosis = value
|
|
|
|
@property
|
|
def resep(self):
|
|
return self.__resep
|
|
|
|
@resep.setter
|
|
def resep(self, value):
|
|
self.__resep = value
|
|
|
|
@property
|
|
def obat(self):
|
|
return self.__obat
|
|
|
|
@obat.setter
|
|
def obat(self, value):
|
|
self.__obat = value
|
|
|
|
@property
|
|
def dosis(self):
|
|
return self.__dosis
|
|
|
|
@dosis.setter
|
|
def dosis(self, value):
|
|
self.__dosis = value
|
|
|
|
@property
|
|
def catatan(self):
|
|
return self.__catatan
|
|
|
|
@catatan.setter
|
|
def catatan(self, value):
|
|
self.__catatan = value
|
|
|
|
@property
|
|
def status(self):
|
|
return self.__status
|
|
|
|
@status.setter
|
|
def status(self, value):
|
|
self.__status = value
|
|
|
|
def get_info(self):
|
|
print(f" │ Nama : {self.nama}")
|
|
print(f" │ ID : {self.id_pasien}")
|
|
print(f" │ Tgl Lahir : {self.birth_date}")
|
|
print(f" │ Alamat : {self.alamat}")
|
|
print(f" │ No. Telp : {self.telp}")
|
|
print(f" │ Keluhan : {self.keluhan}")
|
|
print(f" │ BPJS : {'Ya' if self.bpjs else 'Tidak'}")
|
|
print(f" │ Status : {self.status}")
|
|
|
|
def get_rekam_medis(self):
|
|
print(f" ┌{'─' * 40}")
|
|
print(f" │ REKAM MEDIS — {self.nama}")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ ID Pasien : {self.id_pasien}")
|
|
print(f" │ Keluhan : {self.keluhan}")
|
|
if self.no_antrian:
|
|
print(f" │ No. Antrian : {self.no_antrian}")
|
|
if self.dokter:
|
|
print(f" │ Dokter : {self.dokter}")
|
|
if self.diagnosis:
|
|
print(f" │ Diagnosis : {self.diagnosis}")
|
|
if self.resep:
|
|
print(f" │ Resep : {self.resep}")
|
|
if self.obat:
|
|
print(f" │ Obat : {self.obat}")
|
|
if self.dosis:
|
|
print(f" │ Dosis : {self.dosis}")
|
|
if self.catatan:
|
|
print(f" │ Catatan : {self.catatan}")
|
|
print(f" │ Status : {self.status}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# SUPERCLASS: Employee (Base Class with Encapsulation)
|
|
# ─────────────────────────────────────────────
|
|
class Employee:
|
|
company = "Rumah Sakit Jaya Abadi"
|
|
total_employee = 0
|
|
working_hours = 8
|
|
|
|
def __init__(self, employee_id, name, age, position, status, birth_date, hourly_salary):
|
|
# Atribut private (Enkapsulasi)
|
|
self.__employee_id = employee_id
|
|
self.__name = name
|
|
self.__age = age
|
|
self.__position = position
|
|
self.__status = status
|
|
self.__birth_date = birth_date
|
|
self.__hourly_salary = hourly_salary
|
|
Employee.total_employee += 1
|
|
|
|
# --- GETTER & SETTER (Properties) ---
|
|
@property
|
|
def employee_id(self):
|
|
return self.__employee_id
|
|
|
|
@property
|
|
def name(self):
|
|
return self.__name
|
|
|
|
@name.setter
|
|
def name(self, value):
|
|
self.__name = value
|
|
|
|
@property
|
|
def age(self):
|
|
return self.__age
|
|
|
|
@age.setter
|
|
def age(self, value):
|
|
if value > 0:
|
|
self.__age = value
|
|
|
|
@property
|
|
def position(self):
|
|
return self.__position
|
|
|
|
@position.setter
|
|
def position(self, value):
|
|
self.__position = value
|
|
|
|
@property
|
|
def status(self):
|
|
return self.__status
|
|
|
|
@status.setter
|
|
def status(self, value):
|
|
self.__status = value
|
|
|
|
@property
|
|
def birth_date(self):
|
|
return self.__birth_date
|
|
|
|
@birth_date.setter
|
|
def birth_date(self, value):
|
|
self.__birth_date = value
|
|
|
|
@property
|
|
def hourly_salary(self):
|
|
return self.__hourly_salary
|
|
|
|
@hourly_salary.setter
|
|
def hourly_salary(self, value):
|
|
if value >= 0:
|
|
self.__hourly_salary = value
|
|
|
|
def total_salary(self):
|
|
return self.__hourly_salary * self.working_hours
|
|
|
|
@staticmethod
|
|
def info_company():
|
|
print(f" ┌{'─' * 40}")
|
|
print(f" │ INFO PERUSAHAAN")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Nama RS : {Employee.company}")
|
|
print(f" │ Total Staff : {Employee.total_employee}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
def display_info(self):
|
|
"""Method umum untuk menampilkan informasi dasar pegawai"""
|
|
print(f" ┌{'─' * 40}")
|
|
print(f" │ {self.name}")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ ID : {self.employee_id}")
|
|
print(f" │ Umur : {self.age} tahun")
|
|
print(f" │ Posisi : {self.position}")
|
|
print(f" │ Status : {self.status}")
|
|
print(f" │ Tgl Lahir : {self.birth_date}")
|
|
print(f" │ Gaji/Jam : Rp {self.hourly_salary:,}")
|
|
print(f" │ Jam Kerja : {self.working_hours} jam")
|
|
print(f" │ Total Gaji : Rp {self.total_salary():,}")
|
|
print(f" │ Perusahaan : {self.company}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# SUBCLASS 1: Receptionist (Mewarisi Employee)
|
|
# ─────────────────────────────────────────────
|
|
class Receptionist(Employee):
|
|
antrian_counter = 0
|
|
|
|
def __init__(self, employee_id, name, age, position, status, birth_date, hourly_salary):
|
|
super().__init__(employee_id, name, age, position, status, birth_date, hourly_salary)
|
|
|
|
# --- METHOD OVERRIDING ---
|
|
def display_info(self):
|
|
"""Override method display_info dari Superclass Employee"""
|
|
super().display_info()
|
|
print(f" │ [Peran Khusus] : Front Office & Pendaftaran Pasien")
|
|
print(f" └{'─' * 40}")
|
|
|
|
# --- METHOD KHUSUS SUBCLASS ---
|
|
def register_patient(self, pasien):
|
|
Receptionist.antrian_counter += 1
|
|
pasien.no_antrian = Receptionist.antrian_counter
|
|
pasien.status = "Terdaftar"
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ PENDAFTARAN BERHASIL")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ No. Antrian : {pasien.no_antrian}")
|
|
print(f" │ Pasien : {pasien.nama}")
|
|
print(f" │ Keluhan : {pasien.keluhan}")
|
|
print(f" │ BPJS : {'Ya' if pasien.bpjs else 'Tidak'}")
|
|
print(f" │ Receptionist : {self.name}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
def manage_appointment(self, pasien, dokter, waktu):
|
|
pasien.dokter = dokter.name
|
|
pasien.status = "Menunggu Pemeriksaan"
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ JANJI TEMU DIBUAT")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Pasien : {pasien.nama}")
|
|
print(f" │ Dokter : {dokter.name}")
|
|
print(f" │ Spesialisasi : {dokter.position}")
|
|
print(f" │ Waktu : {waktu}")
|
|
print(f" │ Receptionist : {self.name}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# SUBCLASS 2: Doctor (Mewarisi Employee)
|
|
# ─────────────────────────────────────────────
|
|
class Doctor(Employee):
|
|
def __init__(self, employee_id, name, age, position, status, birth_date, hourly_salary, tunjangan_spesialis=500000):
|
|
super().__init__(employee_id, name, age, position, status, birth_date, hourly_salary)
|
|
# Atribut khusus Doctor (Enkapsulasi)
|
|
self.__tunjangan_spesialis = tunjangan_spesialis
|
|
|
|
@property
|
|
def tunjangan_spesialis(self):
|
|
return self.__tunjangan_spesialis
|
|
|
|
# --- METHOD OVERRIDING ---
|
|
def total_salary(self):
|
|
"""Override kalkulasi gaji: Gaji Pokok + Tunjangan Spesialis Dokter"""
|
|
base_salary = super().total_salary()
|
|
return base_salary + self.__tunjangan_spesialis
|
|
|
|
def display_info(self):
|
|
"""Override method display_info dari Superclass Employee"""
|
|
print(f" ┌{'─' * 40}")
|
|
print(f" │ DOKTER SPESIALIS: {self.name}")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ ID Dokter : {self.employee_id}")
|
|
print(f" │ Umur : {self.age} tahun")
|
|
print(f" │ Spesialisasi : {self.position}")
|
|
print(f" │ Status : {self.status}")
|
|
print(f" │ Tgl Lahir : {self.birth_date}")
|
|
print(f" │ Gaji Pokok : Rp {super().total_salary():,}")
|
|
print(f" │ Tunj. Medis : Rp {self.__tunjangan_spesialis:,}")
|
|
print(f" │ Total Gaji : Rp {self.total_salary():,}")
|
|
print(f" │ Rumah Sakit : {self.company}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
# --- METHOD KHUSUS SUBCLASS ---
|
|
def diagnose_patient(self, pasien, diagnosis, resep):
|
|
pasien.dokter = self.name
|
|
pasien.diagnosis = diagnosis
|
|
pasien.resep = resep
|
|
pasien.status = "Sudah Didiagnosis"
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ HASIL DIAGNOSIS")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Pasien : {pasien.nama}")
|
|
print(f" │ Keluhan : {pasien.keluhan}")
|
|
print(f" │ Diagnosis : {diagnosis}")
|
|
print(f" │ Resep : {resep}")
|
|
print(f" │ Dokter : {self.name}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
def set_schedule(self, hari, jam_mulai, jam_selesai):
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ JADWAL PRAKTEK DOKTER")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Dokter : {self.name}")
|
|
print(f" │ Spesialisasi : {self.position}")
|
|
print(f" │ Hari : {hari}")
|
|
print(f" │ Jam : {jam_mulai} - {jam_selesai}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# SUBCLASS 3: Nurse (Mewarisi Employee)
|
|
# ─────────────────────────────────────────────
|
|
class Nurse(Employee):
|
|
def __init__(self, employee_id, name, age, position, status, birth_date, hourly_salary):
|
|
super().__init__(employee_id, name, age, position, status, birth_date, hourly_salary)
|
|
|
|
# --- METHOD OVERRIDING ---
|
|
def display_info(self):
|
|
"""Override method display_info dari Superclass Employee"""
|
|
super().display_info()
|
|
print(f" │ [Unit/Ruangan] : {self.position}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
# --- METHOD KHUSUS SUBCLASS ---
|
|
def examine_patient(self, pasien):
|
|
pasien.status = "Sedang Diperiksa Perawat"
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ PEMERIKSAAN AWAL")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Pasien : {pasien.nama}")
|
|
print(f" │ Keluhan : {pasien.keluhan}")
|
|
print(f" │ Perawat : {self.name}")
|
|
print(f" │ Unit/Ruangan : {self.position}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
def give_medicine(self, pasien, obat, dosis):
|
|
pasien.obat = obat
|
|
pasien.dosis = dosis
|
|
pasien.status = "Obat Diberikan"
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ PEMBERIAN OBAT")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Pasien : {pasien.nama}")
|
|
print(f" │ Diagnosis : {pasien.diagnosis}")
|
|
print(f" │ Obat : {obat}")
|
|
print(f" │ Dosis : {dosis}")
|
|
print(f" │ Perawat : {self.name}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
def update_medical_record(self, pasien, catatan):
|
|
pasien.catatan = catatan
|
|
pasien.status = "Selesai"
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ REKAM MEDIS DIPERBARUI")
|
|
print(f" ├{'─' * 40}")
|
|
print(f" │ Pasien : {pasien.nama}")
|
|
print(f" │ Diagnosis : {pasien.diagnosis}")
|
|
print(f" │ Resep : {pasien.resep}")
|
|
print(f" │ Obat : {pasien.obat}")
|
|
print(f" │ Catatan : {catatan}")
|
|
print(f" │ Diupdate oleh: {self.name}")
|
|
print(f" │ Status : {pasien.status}")
|
|
print(f" └{'─' * 40}")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# DATA AWAL
|
|
# ─────────────────────────────────────────────
|
|
receptionists = [
|
|
Receptionist("EMP001", "Matthew", 20, "Receptionist", "permanent", "2006-05-10", 200000),
|
|
Receptionist("EMP002", "Budi", 22, "Receptionist", "internship", "2004-03-15", 150000),
|
|
]
|
|
|
|
doctors = [
|
|
Doctor("EMP003", "Dr. Andi", 35, "Cardiologist", "permanent", "1991-08-20", 500000, 750000),
|
|
Doctor("EMP004", "Dr. Sinta", 30, "Dermatologist", "permanent", "1996-03-11", 450000, 500000),
|
|
]
|
|
|
|
nurses = [
|
|
Nurse("PRW-101", "Ns. Siti Aminah, S.Kep", 28, "IGD", "permanent", "1998-04-12", 180000),
|
|
Nurse("PRW-102", "Budi Santoso, Amd.Kep", 30, "Bangsal Anak (Melati)", "permanent", "1996-07-23", 160000),
|
|
Nurse("PRW-103", "Rina Wijaya, S.Kep", 27, "ICU", "permanent", "1999-01-05", 190000),
|
|
]
|
|
|
|
patients = [
|
|
Pasien("Bejo", "16/06/2006", "PSN-001", "Simo Kwagean", "085816261843", "Kanker Kulit"),
|
|
Pasien("Putri", "17/06/2006", "PSN-002", "Kalijudan", "085816261843", "Kanker Otak"),
|
|
]
|
|
patient_counter = 2
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# HELPER
|
|
# ─────────────────────────────────────────────
|
|
def header(title):
|
|
print(f"\n ╔{'═' * 42}╗")
|
|
print(f" ║ {title:^38} ║")
|
|
print(f" ╚{'═' * 42}╝")
|
|
|
|
def divider():
|
|
print(f"\n {'─' * 44}\n")
|
|
|
|
def pilih_dari_list(items, label, attr="nama"):
|
|
if not items:
|
|
print(f" ⚠ Belum ada {label}.")
|
|
return None
|
|
print(f"\n Pilih {label}:")
|
|
for i, item in enumerate(items, 1):
|
|
name = getattr(item, attr, None) or getattr(item, "name", "?")
|
|
extra = ""
|
|
if hasattr(item, "position"):
|
|
extra = f" — {item.position}"
|
|
elif hasattr(item, "keluhan"):
|
|
extra = f" — {item.keluhan} [{item.status}]"
|
|
print(f" {i}. {name}{extra}")
|
|
try:
|
|
idx = int(input(f"\n Nomor {label} > ")) - 1
|
|
if 0 <= idx < len(items):
|
|
return items[idx]
|
|
print(" ✗ Nomor tidak valid.")
|
|
except ValueError:
|
|
print(" ✗ Input harus angka.")
|
|
return None
|
|
|
|
def pilih_pasien():
|
|
return pilih_dari_list(patients, "Pasien", "nama")
|
|
|
|
def pilih_pasien_terdaftar():
|
|
terdaftar = [p for p in patients if p.status != "Belum Daftar"]
|
|
if not terdaftar:
|
|
print(" ⚠ Belum ada pasien yang terdaftar.")
|
|
return None
|
|
return pilih_dari_list(terdaftar, "Pasien", "nama")
|
|
|
|
def lanjut():
|
|
input("\n Tekan Enter untuk kembali...")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# 1. MENU PASIEN
|
|
# ─────────────────────────────────────────────
|
|
def menu_pasien():
|
|
global patient_counter
|
|
while True:
|
|
header("MENU PASIEN")
|
|
print(" 1. Daftarkan diri (Registrasi)")
|
|
print(" 2. Lihat semua pasien")
|
|
print(" 3. Lihat info pasien")
|
|
print(" 4. Cek rekam medis")
|
|
print(" 0. Kembali")
|
|
pilihan = input("\n > ")
|
|
|
|
if pilihan == "1":
|
|
header("REGISTRASI PASIEN BARU")
|
|
nama = input(" Nama lengkap : ")
|
|
tgl = input(" Tanggal lahir (DD/MM/YYYY) : ")
|
|
alamat = input(" Alamat : ")
|
|
telp = input(" No. Telepon : ")
|
|
keluhan = input(" Keluhan : ")
|
|
bpjs = input(" Punya BPJS? (y/n) : ").strip().lower() == "y"
|
|
|
|
patient_counter += 1
|
|
id_p = f"PSN-{patient_counter:03d}"
|
|
p = Pasien(nama, tgl, id_p, alamat, telp, keluhan)
|
|
p.bpjs = bpjs
|
|
patients.append(p)
|
|
print(f"\n ✓ Registrasi berhasil! ID Anda: {id_p}")
|
|
print(f" Silakan menuju Receptionist untuk pendaftaran.")
|
|
lanjut()
|
|
|
|
elif pilihan == "2":
|
|
header("DAFTAR SEMUA PASIEN")
|
|
if not patients:
|
|
print(" Belum ada pasien.")
|
|
else:
|
|
print(f" Total: {Pasien.jumlah_pasien} pasien\n")
|
|
for p in patients:
|
|
print(f" ┌{'─' * 40}")
|
|
print(f" │ {p.nama}")
|
|
print(f" ├{'─' * 40}")
|
|
p.get_info()
|
|
print(f" └{'─' * 40}\n")
|
|
lanjut()
|
|
|
|
elif pilihan == "3":
|
|
header("INFO PASIEN")
|
|
p = pilih_pasien()
|
|
if p:
|
|
print(f"\n ┌{'─' * 40}")
|
|
print(f" │ {p.nama}")
|
|
print(f" ├{'─' * 40}")
|
|
p.get_info()
|
|
print(f" └{'─' * 40}")
|
|
lanjut()
|
|
|
|
elif pilihan == "4":
|
|
header("CEK REKAM MEDIS")
|
|
p = pilih_pasien()
|
|
if p:
|
|
print()
|
|
p.get_rekam_medis()
|
|
lanjut()
|
|
|
|
elif pilihan == "0":
|
|
break
|
|
else:
|
|
print(" ✗ Pilihan tidak valid.")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# 2. MENU RECEPTIONIST
|
|
# ─────────────────────────────────────────────
|
|
def menu_receptionist():
|
|
while True:
|
|
header("MENU RECEPTIONIST")
|
|
print(" 1. Lihat info receptionist")
|
|
print(" 2. Terima & daftarkan pasien")
|
|
print(" 3. Buat janji temu dengan dokter")
|
|
print(" 0. Kembali")
|
|
pilihan = input("\n > ")
|
|
|
|
if pilihan == "1":
|
|
header("DATA RECEPTIONIST")
|
|
for r in receptionists:
|
|
r.display_info()
|
|
print()
|
|
lanjut()
|
|
|
|
elif pilihan == "2":
|
|
header("PENDAFTARAN PASIEN")
|
|
r = pilih_dari_list(receptionists, "Receptionist", "name")
|
|
if r:
|
|
belum = [p for p in patients if p.status == "Belum Daftar"]
|
|
if not belum:
|
|
print("\n ⚠ Semua pasien sudah terdaftar.")
|
|
else:
|
|
p = pilih_dari_list(belum, "Pasien", "nama")
|
|
if p:
|
|
r.register_patient(p)
|
|
lanjut()
|
|
|
|
elif pilihan == "3":
|
|
header("BUAT JANJI TEMU")
|
|
r = pilih_dari_list(receptionists, "Receptionist", "name")
|
|
if r:
|
|
p = pilih_pasien_terdaftar()
|
|
if p:
|
|
d = pilih_dari_list(doctors, "Dokter", "name")
|
|
if d:
|
|
waktu = input("\n Waktu janji (cth: 10:00) : ")
|
|
r.manage_appointment(p, d, waktu)
|
|
lanjut()
|
|
|
|
elif pilihan == "0":
|
|
break
|
|
else:
|
|
print(" ✗ Pilihan tidak valid.")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# 3. MENU DOKTER
|
|
# ─────────────────────────────────────────────
|
|
def menu_dokter():
|
|
while True:
|
|
header("MENU DOKTER")
|
|
print(" 1. Lihat info dokter")
|
|
print(" 2. Periksa & diagnosis pasien")
|
|
print(" 3. Atur jadwal praktek")
|
|
print(" 0. Kembali")
|
|
pilihan = input("\n > ")
|
|
|
|
if pilihan == "1":
|
|
header("DATA DOKTER")
|
|
for d in doctors:
|
|
d.display_info()
|
|
print()
|
|
lanjut()
|
|
|
|
elif pilihan == "2":
|
|
header("DIAGNOSIS PASIEN")
|
|
d = pilih_dari_list(doctors, "Dokter", "name")
|
|
if d:
|
|
menunggu = [p for p in patients if p.status in ["Terdaftar", "Menunggu Pemeriksaan"]]
|
|
if not menunggu:
|
|
print("\n ⚠ Tidak ada pasien yang menunggu pemeriksaan.")
|
|
else:
|
|
p = pilih_dari_list(menunggu, "Pasien", "nama")
|
|
if p:
|
|
diagnosis = input("\n Diagnosis : ")
|
|
resep = input(" Resep / Obat : ")
|
|
d.diagnose_patient(p, diagnosis, resep)
|
|
lanjut()
|
|
|
|
elif pilihan == "3":
|
|
header("JADWAL PRAKTEK")
|
|
d = pilih_dari_list(doctors, "Dokter", "name")
|
|
if d:
|
|
hari = input("\n Hari : ")
|
|
mulai = input(" Jam mulai : ")
|
|
selesai = input(" Jam selesai : ")
|
|
d.set_schedule(hari, mulai, selesai)
|
|
lanjut()
|
|
|
|
elif pilihan == "0":
|
|
break
|
|
else:
|
|
print(" ✗ Pilihan tidak valid.")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# 4. MENU PERAWAT
|
|
# ─────────────────────────────────────────────
|
|
def menu_perawat():
|
|
while True:
|
|
header("MENU PERAWAT")
|
|
print(" 1. Lihat info perawat")
|
|
print(" 2. Periksa pasien")
|
|
print(" 3. Berikan obat")
|
|
print(" 4. Update rekam medis")
|
|
print(" 0. Kembali")
|
|
pilihan = input("\n > ")
|
|
|
|
if pilihan == "1":
|
|
header("DATA PERAWAT")
|
|
for n in nurses:
|
|
n.display_info()
|
|
print()
|
|
lanjut()
|
|
|
|
elif pilihan == "2":
|
|
header("PEMERIKSAAN PASIEN")
|
|
n = pilih_dari_list(nurses, "Perawat", "name")
|
|
if n:
|
|
diagnosed = [p for p in patients if p.status == "Sudah Didiagnosis"]
|
|
if not diagnosed:
|
|
print("\n ⚠ Tidak ada pasien yang perlu diperiksa perawat.")
|
|
else:
|
|
p = pilih_dari_list(diagnosed, "Pasien", "nama")
|
|
if p:
|
|
n.examine_patient(p)
|
|
lanjut()
|
|
|
|
elif pilihan == "3":
|
|
header("PEMBERIAN OBAT")
|
|
n = pilih_dari_list(nurses, "Perawat", "name")
|
|
if n:
|
|
perlu_obat = [p for p in patients if p.status == "Sedang Diperiksa Perawat"]
|
|
if not perlu_obat:
|
|
print("\n ⚠ Tidak ada pasien yang perlu diberi obat.")
|
|
else:
|
|
p = pilih_dari_list(perlu_obat, "Pasien", "nama")
|
|
if p:
|
|
print(f"\n Resep dokter : {p.resep}")
|
|
obat = input(" Nama obat : ")
|
|
dosis = input(" Dosis : ")
|
|
n.give_medicine(p, obat, dosis)
|
|
lanjut()
|
|
|
|
elif pilihan == "4":
|
|
header("UPDATE REKAM MEDIS")
|
|
n = pilih_dari_list(nurses, "Perawat", "name")
|
|
if n:
|
|
perlu_update = [p for p in patients if p.status == "Obat Diberikan"]
|
|
if not perlu_update:
|
|
print("\n ⚠ Tidak ada pasien yang perlu diupdate rekam medisnya.")
|
|
else:
|
|
p = pilih_dari_list(perlu_update, "Pasien", "nama")
|
|
if p:
|
|
catatan = input("\n Catatan : ")
|
|
n.update_medical_record(p, catatan)
|
|
lanjut()
|
|
|
|
elif pilihan == "0":
|
|
break
|
|
else:
|
|
print(" ✗ Pilihan tidak valid.")
|
|
|
|
|
|
# ─────────────────────────────────────────────
|
|
# MAIN MENU
|
|
# ─────────────────────────────────────────────
|
|
def main():
|
|
while True:
|
|
print(f"\n ╔{'═' * 42}╗")
|
|
print(f" ║ {'RUMAH SAKIT JAYA ABADI':^38} ║")
|
|
print(f" ║ {'Sistem Informasi Terpadu':^38} ║")
|
|
print(f" ╚{'═' * 42}╝")
|
|
print(" 1. Menu Pasien")
|
|
print(" 2. Menu Receptionist")
|
|
print(" 3. Menu Dokter")
|
|
print(" 4. Menu Perawat")
|
|
print(" 5. Info Perusahaan")
|
|
print(" 0. Keluar")
|
|
print(f" {'─' * 44}")
|
|
pilihan = input(" > ")
|
|
|
|
if pilihan == "1": menu_pasien()
|
|
elif pilihan == "2": menu_receptionist()
|
|
elif pilihan == "3": menu_dokter()
|
|
elif pilihan == "4": menu_perawat()
|
|
elif pilihan == "5":
|
|
header("INFO PERUSAHAAN")
|
|
Employee.info_company()
|
|
lanjut()
|
|
elif pilihan == "0":
|
|
print("\n Terima kasih telah menggunakan sistem ini.")
|
|
print(" Semoga lekas sembuh! 🏥\n")
|
|
break
|
|
else:
|
|
print(" ✗ Pilihan tidak valid.")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|