def __init__(self, uid): self.patient = PatientDAO.get(uid) self.tk = Tk() self.tk.title("医院挂号就诊系统-病患界面") self.userNameText = Label(self.tk, text=f"欢迎你, {self.patient.name}") self.userNameText.grid(row=0, column=0, padx=5, pady=10) self.actionsFrame = LabelFrame(self.tk, text="操作") self.newRegButton = Button(self.actionsFrame, text="新建挂号", padx=20, command=self.newRegHandler) self.newRegButton.grid(row=0, column=0, padx=5) self.refresButton = Button(self.actionsFrame, text=" 刷新 ", padx=20, command=self.refresHandler) self.refresButton.grid(row=0, column=1, padx=5) self.historyButton = Button(self.actionsFrame, text="查看历史", padx=20, command=self.historyHandler) self.historyButton.grid(row=0, column=2, padx=5) self.actionsFrame.grid(row=1, column=0) self.createPendingFrame() self.createDetailedFrame() self.tk.mainloop()
def createInfoFrame(self): self.infoFrame = Frame(self.detailedFrame) reg = RegistrationtDAO.get(self.selectedRID()) patient = PatientDAO.get(reg.pid) Label(self.infoFrame, text="挂号编号", width=13, anchor="e").grid(row=0, column=0) Label(self.infoFrame, text=reg.rid, width=30, anchor="w").grid(row=0, column=1) Label(self.infoFrame, text="挂号时间", width=13, anchor="e").grid(row=1, column=0) Label(self.infoFrame, text=reg.rtime.strftime("%Y/%m/%d %H:%M:%S"), width=30, anchor="w").grid(row=1, column=1) Label(self.infoFrame, text="挂号类型", width=13, anchor="e").grid(row=2, column=0) Label(self.infoFrame, text=rtypePrint(reg.rtype), width=30, anchor="w").grid(row=2, column=1) Label(self.infoFrame, text="患者名称", width=13, anchor="e").grid(row=3, column=0) Label(self.infoFrame, text=patient.name, width=30, anchor="w").grid(row=3, column=1) Label(self.infoFrame, text="患者电话", width=13, anchor="e").grid(row=4, column=0) Label(self.infoFrame, text=patient.phone, width=30, anchor="w").grid(row=4, column=1) self.infoFrame.grid(row=1, columnspan=2)
def __init__(self, uid): self.patient = PatientDAO.get(uid) self.tk = Tk() self.tk.title("医院挂号就诊系统-历史挂号") self.createPendingFrame() self.tk.mainloop()
def doctorResultToString(result): patient = PatientDAO.get(result.pid) if result.rtype == "pro": printType = "专家" else: printType = "普通" time = result.rtime.strftime("%Y/%m/%d %H:%M:%S") return f"{result.rid:8} | {time:19} | {printType:2} | {patient.name:<10}"
def __init__(self, uid): self.patient = PatientDAO.get(uid) self.tk = Tk() self.tk.title("医院挂号就诊系统-新建挂号") self.departments = DepartmentDAO.listAll() self.departments.sort(key=Department.getIdAsInt) self.departmentList=[] for department in self.departments: self.departmentList.append(f"{department.deptID:>2}|{department.deptName}") self.rtypeList = ["普通", "专家"] self.departmentText = Label(self.tk, text="科室", anchor="e", width=10) self.departmentText.grid(row=0, column=0, padx=5) self.doctorText = Label(self.tk, text="医生", anchor="e", width=10) self.doctorText.grid(row=1, column=0, padx=5) self.rtypeText = Label(self.tk, text="挂号类型", anchor="e", width=10) self.rtypeText.grid(row=2, column=0, padx=5) self.department = StringVar(self.tk) self.department.set(self.departmentList[0]) self.departmentOption = OptionMenu(self.tk, self.department, *self.departmentList, command=self.updateMenus) self.departmentOption.config(width=20) self.departmentOption.grid(row=0, column=1, padx=5) self.doctor = StringVar(self.tk) self.doctorOption = OptionMenu(self.tk, self.doctor, "null") self.updateMenus() self.rtype = StringVar(self.tk) self.rtype.set(self.rtypeList[0]) self.rtypeOption = OptionMenu(self.tk, self.rtype, *self.rtypeList) self.rtypeOption.config(width=20) self.rtypeOption.grid(row=2, column=1, padx=5) self.submitButton = Button(self.tk, text="确认", command = self.submit, padx=20) self.submitButton.grid(row=3, columnspan=2, padx=5, pady=5) self.tk.mainloop()
def refresHandler(self): self.patient = PatientDAO.get(self.patient.uid) self.updatePendingFrame() self.updateDetailedFrame()
import random from faker import Faker from user import User, UserDAO from patient import Patient, PatientDAO fake = Faker("zh_CN") users = UserDAO.listPatients() for user in users: uid = user.uid name = fake.name() balance = random.randint(0, 1000000) / 100 email = fake.email() phone = fake.phone_number() pat = Patient(uid, name, balance, email, phone) PatientDAO.add(pat) for patient in PatientDAO.listAll(): print(patient)
import random from faker import Faker from patient import Patient, PatientDAO from doctor import Doctor, DoctorDAO from registration import Registration, RegistrationtDAO fake = Faker("zh_CN") patients = PatientDAO.listAll() doctors = DoctorDAO.listAll() for i in range(6000): rtypes = ["normal", "pro"] done = random.choice([True] * 9 + [False] * 1) rid = RegistrationtDAO.newID() did = random.choice(doctors).uid pid = random.choice(patients).uid rtime = fake.date_time_this_month(before_now=True, after_now=False, tzinfo=None) rtype = random.choice(rtypes) reg = Registration(rid, did, pid, rtype, rtime, done) print(reg) RegistrationtDAO.add(reg) for doc in doctors: print(f"-----------Doctor {doc.name} --------------") for reg in RegistrationtDAO.listByDoctor(doc.uid, True): print(reg) for reg in RegistrationtDAO.listByDoctor(doc.uid, False): print(reg)