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)
Пример #2
0
 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(AddHospitalDoctor, self).__init__()
     self.message = []
     kwags['marital_status'] = ''
     kwags['physical_address'] = ''
     kwags['user_type'] = "Doctor"
     kwags['full_name'] = "{} {}".format(kwags['first_name'],
                                         kwags['other_name'])
     self.message.append(kwags['full_name'])
     pref = accountManagementHelper.GenerateIdPrefix()
     self.prefix = pref.idPrefix
     init = accountManagementHelper.GenerateIdInitials(**kwags)
     initials = init.initials
     kwag = {"state": "staff_id", "initials": initials}
     staffId = accountManagementHelper.GenerateId(**kwag)
     staff_id = staffId.id
     kwags['staff_id'] = staff_id
     self.message.append(self.prefix + "-" + staff_id)
     usrName = accountManagementHelper.GenerateUserName(**kwags)
     if usrName.username == None:
         kwags['username'] = kwags['staff_id']
         self.message.append(kwags['staff_id'])
     else:
         kwags['username'] = usrName.username
     self.message.append(kwags['appointment_id'])
     addStaff = accountManagementHelper.AddHighLevelStaff(**kwags)
     self.message.append(kwags['phone_number'])
     if addStaff.duplicateUserName == 1:
         self.mes0 = 0
     else:
         self.mes0 = 1
     self.message.append(self.mes0)
     if addStaff.tooMuchAdministrator == 1:
         self.mes1 = 0
     else:
         self.mes1 = 1
     self.message.append(self.mes1)
     self.message.append(addStaff.photo)
     self.message.append(addStaff.date_of_creation)
     self.message.append(kwags['user_type'])
Пример #4
0
 def __init__(self, **kwags):
     super(AddNewPatient, self).__init__()
     self.dataPatientCurrentStatus = model0.PatientCurrentStatus()
     self.dataPatientStatus = model0.PatientStatus()
     self.dataPatientPhoto = model0.PatientPhoto()
     self.dataPatientDemographics = model0.PatientDemographics()
     self.dataPatientNextOfKeen = model0.PatientNextOfKeen()
     self.dataPatientCurrentNextOfKeen = model0.PatientCurrentNextOfKeen()
     self.dataPatientEmployer = model0.PatientEmployer()
     self.dataPatientCurrentEmployer = model0.PatientCurrentEmployer()
     self.dataPatientPhysicalAddress = model0.PatientPhysicalAddress()
     self.dataPatientEmailAddress = model0.PatientEmailAddress()
     self.dataPatientPhoneNumber = model0.PatientPhoneNumber()
     self.dataPatientSpouseDetail = model0.PatientSpouseDetail()
     self.dataPatientCurrentSpouseDetail = model0.PatientCurrentSpouseDetail(
     )
     self.dataPatientDemographicsStaffRel = model0.PatientDemographicsStaffRel(
     )
     self.message = []
     tm = time.ctime()
     kwags['phone_number'] = "{}@{}@{}".format(kwags['home_phone'].strip(),
                                               kwags['work_phone'].strip(),
                                               kwags['cell_phone'].strip())
     kwags['date_of_registration'] = tm
     kwags['date_of_record'] = tm
     kwags['email_address'] = kwags['email']
     kwags['date_of_creation'] = tm
     kwags['date_of_status'] = tm
     kwagsEmmergency = dict()
     kwagsEmmergency['patient_id'] = kwags['patient_id']
     kwagsEmmergency['fullname'] = kwags['emmergence_name']
     kwagsEmmergency['physical_address'] = kwags['emmergency_address']
     kwagsEmmergency['mobile_phone'] = kwags['emmergency_phone_number']
     kwagsEmmergency['date_of_record'] = tm
     kwags['current_status'] = "float"
     kwags['patient_status'] = "out patient"
     kwags['fullname'] = "{} {}".format(kwags['first_name'].strip().lower(),
                                        kwags['other_name'].strip().lower())
     if len(kwags['nid'].strip()) != 0:
         check0 = self.dataPatientDemographics.getPatientDemographicsByNID(
             **kwags)
         if len(check0) != 0:
             self.mes0 = 0
         else:
             self.mes0 = 1
             check1 = self.dataPatientDemographics.getPatientDemographicsBySocialSecurityNumber(
                 **kwags)
             if len(check1) != 0:
                 self.mes1 = 0
             else:
                 self.mes1 = 1
     elif len(kwags['social_security_number'].strip()) != 0:
         check0 = self.dataPatientDemographics.getPatientDemographicsBySocialSecurityNumber(
             **kwags)
         if len(check0) != 0:
             self.mes1 = 0
         else:
             self.mes1 = 1
             check1 = self.dataPatientDemographics.getPatientDemographicsByNID(
                 **kwags)
             if len(check1) != 0:
                 self.mes0 = 0
             else:
                 self.mes0 = 1
     else:
         self.mes0 = 1
         self.mes1 = 1
     if self.mes0 != 1 or self.mes1 != 1:
         self.mes = 0
     else:
         self.mes = 1
         self.message.append(kwags['fullname'])
         pref = accountManagementHelper.GenerateIdPrefix()
         self.prefix = pref.idPrefix
         init = accountManagementHelper.GenerateIdInitials(**kwags)
         initials = init.initials
         kwag = {"state": "patient_id", "initials": initials}
         patientId = accountManagementHelper.GenerateId(**kwag)
         patient_id = patientId.id
         kwags['patient_id'] = patient_id
         self.message.append(self.prefix + patient_id)
         self.dataPatientDemographics.addPatientDemographics(**kwags)
         self.dataPatientPhoto.addPatientPhoto(**kwags)
         self.dataPatientPhysicalAddress.addPatientPhysicalAddress(**kwags)
         self.dataPatientEmailAddress.addPatientEmailAddress(**kwags)
         self.dataPatientPhoneNumber.addPatientPhoneNumber(**kwags)
         self.dataPatientDemographicsStaffRel.addPatientDemographicsStaffRel(
             **kwags)
         self.dataPatientEmployer.addPatientEmployer(**kwags)
         self.dataPatientCurrentEmployer.addPatientCurrentEmployer(**kwags)
         self.dataPatientSpouseDetail.addPatientSpouseDetail(**kwags)
         self.dataPatientCurrentSpouseDetail.addPatientCurrentSpouseDetail(
             **kwags)
         self.dataPatientCurrentStatus.addPatientCurrentStatus(**kwags)
         self.dataPatientStatus.addPatientStatus(**kwags)
         self.dataPatientNextOfKeen.addPatientNextOfKeen(**kwagsEmmergency)
         self.dataPatientCurrentNextOfKeen.addPatientCurrentNextOfKeen(
             **kwagsEmmergency)
     self.dataPatientDemographics.conn.close()
     self.dataPatientPhoto.conn.close()
     self.dataPatientPhysicalAddress.conn.close()
     self.dataPatientEmailAddress.conn.close()
     self.dataPatientPhoneNumber.conn.close()
     self.dataPatientDemographicsStaffRel.conn.close()
     self.dataPatientEmployer.conn.close()
     self.dataPatientCurrentEmployer.conn.close()
     self.dataPatientSpouseDetail.conn.close()
     self.dataPatientCurrentSpouseDetail.conn.close()
     self.dataPatientCurrentStatus.conn.close()
     self.dataPatientStatus.conn.close()
     self.dataPatientNextOfKeen.conn.close()
     self.dataPatientCurrentNextOfKeen.conn.close()