def __init__(self): super(RetrieveAvailableHospitalDoctors, self).__init__() self.dataStaffDemographics = model0.StaffDemographics() self.dataUsers = model0.Users() self.dataStaffDemographicsUsersRel = model0.StaffDemographicsUsersRel() self.dataStaffState = model0.StaffState() self.dataStaffLeaveStatus = model0.StaffLeaveStatus() self.dataStaffCurrentAccountState = model0.StaffCurrentAccountState() self.dataDepartmentStaffRel = model0.DepartmentStaffRel() self.dataDeparment = model0.Department() self.message = [] self.idPrefix = accountManagementHelper.GenerateIdPrefix() raw_data0 = [] raw_data00 = self.dataUsers.getAllUsers() for a, b, c, d, e in raw_data00: if d != "System Administrator" and d != "Laboratorist" and d != "Clinician" and d != "Pharmacist" and d != "Principle Nurse Officer" and d != "Head Pharmacy" and d != "Store Personnel" and d != "Head Clinic" and d != "Head Laboratory" and d != "Head Front Desk" and d != "Head Store" and d != "Senior Principle Nurse Officer" and d != "Human Resource" and d != "Nurse" and d != "This is list should be extended as development proceeds": raw_data11 = self.dataStaffDemographicsUsersRel.getStaffDemographicsUsersRelByUsername( username=a) for f, g in raw_data11: check0 = self.dataStaffState.getStaffState(staff_id=f) if len(check0) == 0: raw_data0.append([a, b, c, d, e]) for a, b, c, d, e in raw_data0: messageCrude = [] raw_data1 = self.dataStaffDemographicsUsersRel.getStaffDemographicsUsersRelByUsername( username=a) for f, g in raw_data1: raw_data2 = self.dataStaffDemographics.getStaffDemographicsByStaffId( staff_id=f) for h, i, j, k, l, m, n, o, p, q, r, s, t, u, v in raw_data2: messageCrude.append(self.idPrefix.idPrefix + "-" + h) messageCrude.append(i) messageCrude.append(v) raw_data3 = self.dataStaffLeaveStatus.getStaffLeaveStatus( staff_id=h) if len(raw_data3) == 0: messageCrude.append("Account Not Activated") else: for w, x in raw_data3: if x == 'on': messageCrude.append("On Leave") else: raw_data4 = self.dataStaffCurrentAccountState.getStaffCurrentAccountState( staff_id=h) for y, z, aa in raw_data4: messageCrude.append(z) raw_data5 = self.dataDepartmentStaffRel.getDepartmentStaffRelByStaffId( staff_id=h) if len(raw_data5) == 0: if d != "Head Padeatrics" and d != "Head Surgery": messageCrude.append("Not Assigned Yet") else: messageCrude.append(d) else: for bb, cc, dd in raw_data5: raw_data6 = self.dataDeparment.getDepartment( department_id=bb) for ee, ff in raw_data6: messageCrude.append(ff) self.message.append(messageCrude)
def __init__(self): super(RetrieveUnsignedHospitalNurses, self).__init__() self.dataStaffDemographics=model0.StaffDemographics() self.dataUsers=model0.Users() self.dataStaffDemographicsUsersRel=model0.StaffDemographicsUsersRel() self.dataStaffState=model0.StaffState() self.dataStaffLeaveStatus=model0.StaffLeaveStatus() self.dataStaffCurrentAccountState=model0.StaffCurrentAccountState() self.dataDepartmentStaffRel=model0.DepartmentStaffRel() self.dataDeparment=model0.Department() self.message=[] self.departments=[] self.idPrefix=accountManagementHelper.GenerateIdPrefix() raw_data0=[] raw_data00=self.dataUsers.getAllUsers() for a,b,c,d,e in raw_data00: if d!="Principle Nurse Officer" and d!="Head Padeatrics" and d!="Head Surgery" and d!="System Administrator" and d!="Store Personnel" and d!="Laboratorist" and d!="Clinician" and d!="Pharmacist" and d!="Head Pharmacy" and d!="Head Clinic" and d!="Head Laboratory" and d!="Head Front Desk"\ and d!="Head Store" and d!="Human Resource" and d!="Doctor" and d!="This is list should be extended as development proceeds": raw_data11=self.dataStaffDemographicsUsersRel.getStaffDemographicsUsersRelByUsername(username=a) for f,g in raw_data11: check0=self.dataDepartmentStaffRel.getDepartmentStaffRelByStaffId(staff_id=f) if len(check0)==0: raw_data0.append([a,b,c,d,e]) for a,b,c,d,e in raw_data0: messageCrude=[] raw_data1=self.dataStaffDemographicsUsersRel.getStaffDemographicsUsersRelByUsername(username=a) for f,g in raw_data1: raw_data2=self.dataStaffDemographics.getStaffDemographicsByStaffId(staff_id=f) for h,i,j,k,l,m,n,o,p,q,r,s,t,u,v in raw_data2: messageCrude.append(self.idPrefix.idPrefix+"-"+h) messageCrude.append(h) messageCrude.append(i) messageCrude.append(v) messageCrude.append(q) check1=self.dataStaffLeaveStatus.getStaffLeaveStatus(staff_id=h) for w,x,xx in check1: if x=="off": raw_data3=self.dataStaffCurrentAccountState.getStaffCurrentAccountState(staff_id=h) for y,z,zz in raw_data3: messageCrude.append([z,zz]) else: messageCrude.append([x,xx]) self.message.append(messageCrude) raw_data3=self.dataDeparment.getAllDepartment() for a,b in raw_data3: if a in NurseDepartments: self.departments.append([a,b]) self.dataDeparment.conn.close() self.dataStaffDemographics.conn.close() self.dataUsers.conn.close() self.dataStaffDemographicsUsersRel.conn.close() self.dataStaffState.conn.close() self.dataStaffLeaveStatus.conn.close() self.dataStaffCurrentAccountState.conn.close() self.dataDepartmentStaffRel.conn.close()
def __init__(self, **kwags): super(AssignNurseToDepartment, self).__init__() self.dataStaffAccountState=model0.StaffAccountState() self.dataStaffCurrentAccountState=model0.StaffCurrentAccountState() self.dataDepartmentStaffRel=model0.DepartmentStaffRel() self.dataStaffLeaveStatus=model0.StaffLeaveStatus() check0=self.dataDepartmentStaffRel.getDepartmentStaffRelByStaffId(**kwags) if len(check0)==0: tm=time.ctime() kwags['date_of_assignment']=tm kwags['staff_leave_status']="off" kwags['date_of_state']=tm kwags['account_state']="inactive" self.dataDepartmentStaffRel.addDepartmentStaffRel(**kwags) self.dataStaffLeaveStatus.addStaffLeaveStatus(**kwags) self.dataStaffAccountState.addStaffAccountState(**kwags) self.dataStaffCurrentAccountState.addStaffCurrentAccountState(**kwags) self.dataStaffAccountState.conn.close() self.dataStaffCurrentAccountState.conn.close() self.dataDepartmentStaffRel.conn.close() self.dataStaffLeaveStatus.conn.close()