def delete(self): patientID = self.pid.text() #TODO delete patient self.ui = patientController.Ui_Dialog() self.Dialog.close() self.ui.show()
def editing(self): appointID = self.id.text() date = self.newAppointDate.date() time = self.newAppointTime.time() desc = self.appointDes.toPlainText() doctor = str(self.newDoctorList.currentText()) #TODO edit by appointment self.ui = patientController.Ui_Dialog() self.ui.show() self.Dialog.close()
def add(self): self.attentionLv = "" if self.radioButton_3.isChecked(): self.attentionLv = "High" elif self.radioButton_4.isChecked(): self.attentionLv = "Medium" elif self.radioButton_5.isChecked(): self.attentionLv = "Low" self.nurse = str(self.comboBox_2.currentText()) self.bed = str(self.comboBox.currentText()) self.dischargeDate = self.dateEdit.date() #TODO add new inpatient to database #get date by... print(self.dischargeDate.day()) print(self.dischargeDate.month()) print(self.dischargeDate.year()) self.ui = patientController.Ui_Dialog() self.Dialog.hide() self.ui.show()
def add(self): patientID = self.pid.text() appointID = self.appointid.text() date = self.appointDate.date() time = self.appointTime.time() desc = self.appointDes.toPlainText() doctor = str(self.doctorList.currentText()) #TODO add new appointment to database #how to date... print(date.day()) print(date.month()) print(date.year()) #how to time... print(time.hour()) print(time.minute()) self.ui = patientController.Ui_Dialog() self.ui.show() self.Dialog.close()
def add(self): bed = str(self.bedList.currentText()) dischargeDate = self.dischargeDate.date() attentionLv = "" if self.attenHigh.isChecked(): attentionLv = "High" elif self.attenMed.isChecked(): attentionLv = "Medium" elif self.attenLow.isChecked(): attentionLv = "Low" assignNurse = str(self.nurseList.currentText()) reason = self.reason.text() #TODO add treatment(for inpatien) to database #get date by... print(dischargeDate.day()) print(dischargeDate.month()) print(dischargeDate.year()) self.ui = patientController.Ui_Dialog() self.Dialog.hide() self.ui.show()
def back(self): self.ui = patientController.Ui_Dialog() self.ui.show() self.Dialog.close()
def add(self): gender = "" blood = "" status = "" if self.male.isChecked(): gender = "Male" elif self.female.isChecked(): gender = "Female" if self.bloodO.isChecked(): blood = "O" elif self.bloodA.isChecked(): blood = "A" elif self.bloodB.isChecked(): blood = "B" elif self.bloodAB.isChecked(): blood = "AB" if self.unknownStatus.isChecked(): status = "Unknown" elif self.dischargedStatus.isChecked(): status = "Discharged" elif self.admittedStatus.isChecked(): status = "Admitted" elif self.deceasedStatus.isChecked(): status = "Deceased" patientID = self.pid.text() name = self.name.text() personalID = self.nid.text() birthDate = datetime.date(int(self.DoB.date().year()), int(self.DoB.date().month()), int(self.DoB.date().day())) allergic = self.allergic.text() phones = self.phone.text() medHistory = self.medhistory.text() #TODO add new patient to database try: connection = mysql.connector.connect(host='localhost', database='hospital', user='******', password='******') objdata = (patientID, personalID, name, gender, birthDate, blood, status) sqlQuery = "insert into "+"patient"+"(Patient_ID, Patient_NID, Patient_Name, Patient_Gender, Patient_DoB, Blood_Group, Status) " \ "values(%s,%s,%s,%s,%s,%s,%s)" temp_list = list(objdata) if (name == ""): temp_list.remove(name) sqlQuery = sqlQuery.replace(", Patient_Name", '') sqlQuery = sqlQuery.replace("%s,", '', 1) if (gender == ""): temp_list.remove(gender) sqlQuery = sqlQuery.replace(", Patient_Gender", '') sqlQuery = sqlQuery.replace("%s,", '', 1) if (blood == ""): temp_list.remove(blood) sqlQuery = sqlQuery.replace(", Blood_Group", '') sqlQuery = sqlQuery.replace("%s,", '', 1) if (status == ""): temp_list.remove(status) sqlQuery = sqlQuery.replace(", Status", '') sqlQuery = sqlQuery.replace("%s,", '', 1) objdata = tuple(temp_list) cursor = connection.cursor() cursor.execute(sqlQuery, objdata) connection.commit() except: retmsg = ["1", "writing error"] else: retmsg = ["0", "writing done"] finally: if (connection.is_connected()): connection.close() cursor.close() #get date by... try: connection = mysql.connector.connect(host='localhost', database='hospital', user='******', password='******') sqlQuery = "insert into " + "patient_allergic" + "(Patient_ID, Allergic) " + "values(%s,%s)" for aller in allergic.split(): objdata = (patientID, aller) cursor = connection.cursor() cursor.execute(sqlQuery, objdata) connection.commit() except: retmsg_s = ["1", "writing error"] else: retmsg_s = ["0", "writing done"] finally: try: if (connection.is_connected()): connection.close() cursor.close() except: pass try: connection = mysql.connector.connect(host='localhost', database='hospital', user='******', password='******') sqlQuery = "insert into " + "patient_med_history" + "(Patient_ID, Med_History) " + "values(%s,%s)" for med in medHistory.split(): objdata = (patientID, med) cursor = connection.cursor() cursor.execute(sqlQuery, objdata) connection.commit() except: retmsg_s = ["1", "writing error"] else: retmsg_s = ["0", "writing done"] finally: try: if (connection.is_connected()): connection.close() cursor.close() except: pass try: connection = mysql.connector.connect(host='localhost', database='hospital', user='******', password='******') sqlQuery = "insert into " + "patient_phone" + "(Patient_ID, Phone) " + "values(%s,%s)" for phone in phones.split(): objdata = (patientID, phone) cursor = connection.cursor() cursor.execute(sqlQuery, objdata) connection.commit() except: retmsg_s = ["1", "writing error"] else: retmsg_s = ["0", "writing done"] finally: try: if (connection.is_connected()): connection.close() cursor.close() except: pass self.ui = patientController.Ui_Dialog() self.ui.show() self.Dialog.close()
def add(self): patientID = self.pid.text() treatmentID = self.treatmentID.text() arrivalDate = self.arriveDate.date() emergencyLv = "" if self.emerHigh.isChecked(): emergencyLv = "High" elif self.emerMed.isChecked(): emergencyLv = "Medium" elif self.emerLow.isChecked(): emergencyLv = "Low" print('pass') if len(emergencyLv) == 0: return None assignDoc = str(self.doctorList.currentText()) diagDisease = str(self.diseaseList.currentText()) drug = str(self.drugList.currentText()) appointID = str(self.appointList.currentText()) symptom = self.symptom.text() if treatmentID.upper().startswith("I"): self.ui = treatmentInpatientAddPopup.Ui_Dialog( patientID, treatmentID, arrivalDate, emergencyLv, assignDoc, diagDisease, drug, appointID) self.Dialog.hide() self.ui.show() else: #TODO add treatment to database try: connection = mysql.connector.connect(host='localhost', database='hospital', user='******', password=password) print('connected') cursor = connection.cursor() cursor.execute( 'select * from employee where Employee_Name = \'{}\''. format(assignDoc)) doctorID = cursor.fetchall()[0][0] cursor.execute( 'select * from disease where Disease_Name = \'{}\''.format( diagDisease)) diseaseID = cursor.fetchall()[0][0] cursor.execute( 'select * from drug where Drug_Name = \'{}\''.format(drug)) drugID = cursor.fetchall()[0][0] symptoms = [s.strip() for s in symptom.split(',')] dateinput = '{}-{}-{}'.format(arrivalDate.year(), arrivalDate.month(), arrivalDate.day()) into = 'Treatment_ID, Patient_ID, Arrival_Date, Emergency_Level, Patient_Type' value = '\'{}\', \'{}\', \'{}\', \'{}\', \'{}\''.format( treatmentID, patientID, dateinput, emergencyLv, 0) print('insert into {} ({}) value ({})'.format( 'treatment', into, value)) cursor.execute('insert into {} ({}) value ({})'.format( 'treatment', into, value)) cursor.execute( 'insert into treatment_assigned_doctor (Treatment_ID, Employee_ID) value (\'{}\', \'{}\')' .format(treatmentID, doctorID)) cursor.execute( 'insert into diagnose (Treatment_ID, Disease_ID) value (\'{}\', \'{}\')' .format(treatmentID, diseaseID)) cursor.execute( 'insert into used_drug (Treatment_ID, Drug_ID) value (\'{}\', \'{}\')' .format(treatmentID, drugID)) if len(appointID) != 0: cursor.execute( 'insert into correspond_to (Appointment_ID, Treatment_ID) value (\'{}\', \'{}\')' .format(appointID, treatmentID)) cursor.execute( 'insert into outpatient (Treatment_ID) value (\'{}\')'. format(treatmentID)) for s in symptoms: cursor.execute( 'insert into treatment_symptom (Treatment_ID, Symptom) value(\'{}\', \'{}\')' .format(treatmentID, s)) print('executed') connection.commit() #result = cursor.fetchall() #print(result) connection.close() except Exception as e: print(e) #get date by... print(arrivalDate.day()) print(arrivalDate.month()) print(arrivalDate.year()) self.ui = patientController.Ui_Dialog() self.Dialog.close() self.ui.show()