def submit(self): rid = RegistrationtDAO.newID() did = self.getDoctor() pid = self.patient.uid time = datetime.now() rtype = self.getRType() reg = Registration(rid, did, pid, rtype, time, False) RegistrationtDAO.add(reg) self.tk.destroy()
def createDetailedFrame(self): self.detailedFrame = LabelFrame(self.tk, text="挂号详情") self.detailedSelect = StringVar(self.detailedFrame) results = RegistrationtDAO.listByDoctor(self.doc.uid, False) results.sort(key=Registration.getRTime) self.detailedList = [] for result in results: self.detailedList.append(doctorResultToString(result)) out(doctorResultToString(result)) self.detailedSelect.set(self.detailedList[0]) self.detailedOption = OptionMenu(self.detailedFrame, self.detailedSelect, *self.detailedList, command=self.updateInfoFrame) self.detailedOption.config(width=43) self.detailedOption.grid(row=0, column=1, padx=5) self.createInfoFrame() self.doneButton = Button(self.detailedFrame, text="开始诊断", padx=10, command=self.doneHandler) self.doneButton.grid(row=2, column=0, columnspan=2) self.detailedFrame.grid(row=3, column=0)
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 createInfoFrame(self): self.infoFrame = Frame(self.detailedFrame) reg = RegistrationtDAO.get(self.selectedRID()) doc = DoctorDAO.get(reg.did) dept = DepartmentDAO.get(doc.deptID) 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=dept.deptName, 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=dept.location, width=30, anchor="w").grid(row=4, column=1) Label(self.infoFrame, text="科室电话", width=13, anchor="e").grid(row=5, column=0) Label(self.infoFrame, text=dept.phone, width=30, anchor="w").grid(row=5, column=1) Label(self.infoFrame, text="医生名称", width=13, anchor="e").grid(row=6, column=0) Label(self.infoFrame, text=doc.name, width=30, anchor="w").grid(row=6, column=1) self.infoFrame.grid(row=1, columnspan=2)
def createDetailedFrame(self): self.detailedFrame = LabelFrame(self.tk, text="挂号详情") self.detailedSelect = StringVar(self.detailedFrame) results = RegistrationtDAO.listByPatient(self.patient.uid, False) results.sort(key=Registration.getRTime) self.detailedList = [] for result in results: self.detailedList.append(patientResultToString(result)) out(patientResultToString(result)) self.detailedSelect.set(self.detailedList[0]) self.detailedOption = OptionMenu(self.detailedFrame, self.detailedSelect, *self.detailedList, command=self.updateInfoFrame) self.detailedOption.config(width=43) self.detailedOption.grid(row=0, column=1, padx=5) self.createInfoFrame() self.detailedFrame.grid(row=3, column=0)
def createPendingFrame(self): self.pendingFrame = LabelFrame(self.tk, text="当前待就诊") results = RegistrationtDAO.listByPatient(self.patient.uid, False) results.sort(key=Registration.getRTime) rows = [] rows.append("编号 | 时间 | 类型 | 科室") for result in results: if result == None: continue rows.append(patientResultToString(result)) self.pendingFrameLabels = [] for i in range(len(rows)): label = Label(self.pendingFrame, text=rows[i], anchor="w", width=50) label.grid() self.pendingFrame.grid(row=2, column=0)
def createPendingFrame(self): self.pendingFrame = LabelFrame(self.tk, text="历史查询") results = RegistrationtDAO.listByDoctor(self.doc.uid, True) results.sort(key=Registration.getRTime) rows = [] rows.append("编号 | 时间 | 类型 | 患者姓名") for result in results: if result == None: continue rows.append(doctorResultToString(result)) self.pendingFrameLabels = [] for i in range(len(rows)): label = Label(self.pendingFrame, text=rows[i], anchor="w", width=50) label.grid() self.pendingFrame.grid(row=0, column=0)
def doneHandler(self): reg = RegistrationtDAO.get(self.selectedRID()) reg.done = True RegistrationtDAO.update(reg) self.refresHandler()
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)