Exemple #1
0
    def clickOnAddEvent(self, parent):
        import datetime
        todayDate = datetime.datetime.now()
        date = self.dateTimeEdit.text()
        dateToSend = date.split('/')[::-1]
        dateToSend[0] = '20' + dateToSend[0]
        dateToSend = '-'.join(dateToSend)
        print(dateToSend)
        title = self.eventName.text()
        eventlocation = self.venue.text()
        description = self.description.toPlainText()
        if description == "" or title == "" or date == "" or eventlocation == "":
            self.dialog = messageBox()
            self.dialog.infoBox("Please Enter Details")
            return
        state = "All States"
        city = "All Cities"
        hid = None
        tcid = None
        bbcid = None
        dsid = None
        if self.type != 'SA':
            state = self.userData["state"]
            city = self.userData["city"]
        if self.type == 'H':
            hid = int(self.userData["id"])
        elif self.type == 'BB':
            bbcid = int(self.userData["id"])
        elif self.type == 'DS':
            dsid = int(self.userData["id"])
        elif self.type == 'TC':
            tcid = int(self.userData["id"])
        data = {
            "eventlocation": eventlocation,
            "city": city,
            "state": state,
            "title": title,
            "description": description,
            "dateofevent": dateToSend,
            "dateofcreation": str(datetime.date.today()),
            "hospitalid": hid,
            "bloodbankid": bbcid,
            "dispensaryid": dsid,
            "testcentreid": tcid
        }

        URL = "https://mdtouchs.herokuapp.com/api/event/"
        import requests
        r = requests.post(url=URL, data=data)
        print(r)
        l = r.json()
        print(l)
        self.window = messageBox()
        self.window.infoBox("Event has been created")
        parent.close()
        self.window = QDialog()
        self.dialog = eventProfile()
        self.dialog.setup(self.window, l)
        self.window.setModal(True)
        self.window.show()
Exemple #2
0
    def clickOnBroadcastButton(self, parent, callerId):

        if self.message.toPlainText() == "":
            self.dialog = messageBox()
            self.dialog.infoBox("Empty Message")
            return
        if self.titleInput.text() == "":
            self.dialog = messageBox()
            self.dialog.infoBox("Empty Title")
            return

        state = self.stateComboBox.currentText()
        city = self.cityComboBox.currentText()
        title = self.titleInput.text()
        message = str(self.message.toPlainText())
        import requests
        URL = "https://mdtouch.herokuapp.com/api/broadcast/"

        # Yaha pae sendto ko chnage karna hai callerId se
        data = {
            "title": title,
            "message": message,
            "sendto": 1,
            "state": state,
            "city": city,
        }
        r = requests.post(url=URL, data=data)
        print(r.json())
        parent.close()
        self.dialog = messageBox()
        self.dialog.infoBox("The message has been broadcasted to all " +
                            str(callerId))
Exemple #3
0
    def clickOnDeleteAdmin(self, parent):
        id = self.searchByID.text()
        if id != "":
            if id.isdigit():
                import requests
                URL = "https://mdtouchs.herokuapp.com/api/administrator/" + str(
                    id)
                r = requests.get(url=URL)
                data = r.json()
                if data == {"detail": "Not found."}:
                    self.window = messageBox()
                    self.window.infoBox("Id Does Not Exists")
                    self.searchByID.setText("")
                    return
                else:
                    URL = "https://mdtouchs.herokuapp.com/api/hospital/" + str(
                        data["workplace"])
                    r = requests.get(url=URL)
                    hdata = r.json()
                    parent.close()
                    self.window = QDialog()
                    self.dialog = deleteAdmin()
                    self.dialog.setup(self.window, data, hdata)
                    self.window.setModal(True)
                    self.window.show()
                    return

            else:
                self.window = messageBox()
                self.window.infoBox("Id is a Integer")
                self.searchByID.setText("")
            return

        if self.adminComboBox.count() == 0:
            self.window = messageBox()
            self.window.infoBox("Select the hospital first")
            return
        admin_name = self.adminComboBox.currentText()
        adminData = {}
        hdata = {}
        for i in self.admin_list:
            if admin_name == i["firstName"] + " " + i["lastName"]:
                adminData = i
                break
        for i in self.hospital_list:
            if i["name"] == self.hospitalComboBox.currentText():
                hdata = i
                break
        parent.close()
        self.window = QDialog()
        self.dialog = deleteAdmin()
        self.dialog.setup(self.window, adminData, hdata)
        self.window.setModal(True)
        self.window.show()
Exemple #4
0
 def clickOnPublishButton(self, parent):
     title = self.title.text()
     notice = self.notice.toPlainText()
     if title == "" or len(notice) < 10:
         self.window = messageBox()
         self.window.infoBox("Please Provide Sufficient Information")
         return
     data = {"title": title, "notice": notice}
     URL = "https://mdtouch.herokuapp.com/MDTouch/api/notice/"
     r = requests.post(url=URL, data=data)
     print(r.json())
     self.window = messageBox()
     self.window.infoBox("Event Created")
     parent.close()
Exemple #5
0
    def loginEvent(self, loginPage):
        # Checking id and password
        usernameInput = self.userNameInput.text()
        passwordInput = self.passwordInput.text()

        if usernameInput == "" or passwordInput == "":
            self.dialog = messageBox()
            self.dialog.infoBox('Invalid Credentials')
            return

        param = {
            "username" : usernameInput,
            "password" : passwordInput
        }
        URL = "https://mdtouchs.herokuapp.com/api/login/"
        import requests
        r = requests.get(url=URL,params=param)
        data = r.json()
        print(data)
        if len(data) == 0:
            self.dialog = messageBox()
            self.dialog.infoBox('Invalid Credentials')
            return
        if data[0]["dept"] == "SA":
            self.superadminpage = superadminHome()
            self.superadminpage.setup(loginPage,data[0])
            return
        if data[0]["dept"] == "D":
            self.doctorpage = doctorHome()
            self.doctorpage.setup(loginPage,data[0])
            return
        if data[0]["dept"] == "DS":
            self.dispensarypage = dispensaryHome()
            self.dispensarypage.setup(loginPage,data[0])
            return
        if data[0]["dept"] == "BB":
            self.bloodBankpage = bloodBankHome()
            self.bloodBankpage.setup(loginPage,data[0])
            return
        if data[0]["dept"] == "TC":
            self.testCenterpage = testCenterHome()
            self.testCenterpage.setup(loginPage,data[0])
            return
        if data[0]["dept"] == "H":
            self.hospitalpage = hospitalHome()
            self.hospitalpage.setup(loginPage,data[0])
        if data[0]["dept"] == "ES":
            self.espage = emergencyServiceHome()
            self.espage.setup(loginPage,data[0])
Exemple #6
0
    def forgotPasswordEvent(self, loginPage):

        # forgot Password Email Sent
        username = self.userNameInput.text()
        if username == "":
            self.dialog = messageBox()
            self.dialog.infoBox('Enter the username')
            return

        try:
            self.dialog = messageBox()
            self.dialog.infoBox('The link to reset your password has been sent to your email')
        except:
            self.dialog = messageBox()
            self.dialog.warningBox('Something happened with connection Try Again! Check Your Internet Connection')
Exemple #7
0
 def clickOnDeleteNotice(self,parent):
     self.window = messageBox()
     self.window.infoBox("Notice is deleted")
     parent.close()
     import requests
     URL = "https://mdtouchs.herokuapp.com/MDTouch/api/notice/" + str(self.data["id"])
     r = requests.delete(url = URL)
    def clickOnSaveButton(self, parent, grandparent):
        text = self.specilaization.text()
        if text != "":
            if self.id != 0:
                URL = "https://mdtouchs.herokuapp.com/api/specialization/" + str(
                    self.id)
                data = {"skill": text}
                import requests
                r = requests.put(url=URL, data=data)
                print(r.json())
                grandparent.specializationComboBox.setItemText(0, text)
            else:
                print(text)
                URL = "https://mdtouchs.herokuapp.com/api/specialization/"
                data = {"skill": text}
                import requests
                r = requests.post(url=URL, data=data)

                l = r.json()
                print(l, "-------------------------")
                grandparent.specializationComboBox.addItem(str(text))
                grandparent.doctordata["specialization"] = l["id"]
            parent.close()
        else:
            self.window = messageBox()
            self.window.infoBox("Qualification cannot be empty")
            return
Exemple #9
0
 def clickOnSelectButton(self, parent):
     PatientID = self.patientID.text()
     prescriptionID = self.prescriptionId.text()
     if PatientID == "" and prescriptionID == "":
         self.window = messageBox()
         self.window.infoBox("Ivalid data")
         return
     if PatientID != "":
         if not (PatientID.isdigit()):
             self.window = messageBox()
             self.window.infoBox("Ivalid data")
             return
         params = {
             "patient": int(PatientID),
             "doctor": int(self.doctordata["id"])
         }
         import requests
         URL = "https://mdtouch.herokuapp.com/api/prescription/"
         r = requests.get(url=URL, params=params)
         l = r.json()
         if len(l) == 0:
             self.window = messageBox()
             self.window.infoBox("No Prescription Found for This patient")
             return
         self.window = QDialog()
         self.dialog = prescriptionList()
         self.dialog.setup(self.window, l)
         self.window.setModal(True)
         self.window.show()
         parent.close()
     else:
         if prescriptionID.isdigit():
             import requests
             URL = "https://mdtouch.herokuapp.com/api/prescription/" + str(
                 prescriptionID)
             r = requests.get(url=URL)
             data = r.json()
             self.window = QDialog()
             self.dialog = prescriptionProfile()
             self.dialog.setup(self.window, data)
             self.window.setModal(True)
             self.window.show()
             parent.close()
         else:
             self.window = messageBox()
             self.window.infoBox("Ivalid Data")
Exemple #10
0
 def clickOnDeleteButton(self, parent):
     self.window = messageBox()
     self.window.infoBox("Following event is deleted")
     import requests
     URL = "https://mdtouchs.herokuapp.com/api/event/" + str(self.eventdata["id"])
     r = requests.delete(url=URL)
     print(r)
     parent.close()
Exemple #11
0
    def clickOnDelete(self, parent,adminData,hdata):
        parent.close()
        self.window = messageBox()
        self.window.infoBox("Hospital with ID : " + str(hdata["id"]) + " is deleted.")

        # Deleting Hospital
        import requests
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/login/" + str(adminData["username"])
        r = requests.delete(url=URL)
        print(r)
    def clickOnRemoveButton(self, parent,hdata):
        parent.close()
        self.window = messageBox()
        self.window.infoBox("Hospital with ID : " + str(hdata["id"]) + " is deleted.")

        # Deleting Hospital
        import requests
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/hospital/" + str(hdata["id"])
        r = requests.delete(url=URL)
        print(r)
Exemple #13
0
 def clickOnSelectButton(self, parent):
     id = self.searchByID.text()
     if id == "" or (not (id.isdigit())):
         self.window = messageBox()
         self.window.infoBox("Invalid Id")
         return
     URL = "https://mdtouch.herokuapp.com/MDTouch/api/notice/" + str(id)
     import requests
     r = requests.get(url=URL)
     l = r.json()
     if l == {"detail": "Not found."}:
         self.window = messageBox()
         self.window.infoBox("Not ID Found")
         return
     self.window = QDialog()
     self.dialog = deleteNotice()
     self.dialog.setup(self.window, l)
     self.window.setModal(True)
     self.window.show()
Exemple #14
0
 def clickOnRemoveButton(self, parent):
     if self.emergencyServiceComboBox.count() == 0 and self.searchByID.text(
     ) == "":
         self.dialog = messageBox()
         self.dialog.warningBox(
             "Select the emergencyService or Enter the Id")
         return
     if self.searchByID.text() != "":
         id = self.searchByID.text()
         print(id)
         if id.isdigit():
             import requests
             url = "https://mdtouch.herokuapp.com/api/emergencyservice/" + id
             r = requests.get(url=url)
             l = r.json()
             print(l)
             if l == {'detail': 'Not found.'}:
                 self.dialog = messageBox()
                 self.dialog.warningBox("No Id Match")
                 return
             else:
                 self.window = QDialog()
                 self.dialog = removeEmergencyService()
                 self.dialog.setup(self.window, l)
                 self.window.setModal(True)
                 self.window.show()
                 parent.close()
                 return
         else:
             self.dialog = messageBox()
             self.dialog.warningBox("Id must be integer")
         return
     hdata = {}
     for i in self.emergencyService_list:
         if i["name"] == self.emergencyServiceComboBox.currentText():
             hdata = i
     parent.close()
     self.window = QDialog()
     self.dialog = removeEmergencyService()
     self.dialog.setup(self.window, hdata)
     self.window.setModal(True)
     self.window.show()
Exemple #15
0
    def clickOnBloodGraph(self):
        if not (self.tcid.text().isdigit()):
            self.window = messageBox()
            self.window.infoBox("Invalid ID")
            return

        self.window = QDialog()
        self.dialog = bloodbankGraph()
        self.dialog.setup(self.window, int(self.tcid.text()))
        self.window.setModal(True)
        self.window.show()
Exemple #16
0
    def clickOnGotoProfile(self):
        if not (self.tcid.text().isdigit()):
            self.window = messageBox()
            self.window.infoBox("Invalid ID")
            return
        import requests
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(
            self.tcid.text())
        r = requests.get(url=URL)
        l = r.json()
        if l == {"detail": "Not found."}:
            self.window = messageBox()
            self.window.infoBox("Id Does Not Exits")
            return

        self.window = QDialog()
        self.dialog = new_bloodBankProfile()
        self.dialog.setup(self.window, l)
        self.window.setModal(True)
        self.window.show()
Exemple #17
0
    def clickOnRemoveButton(self, parent,esData):
        print(esData)
        parent.close()
        self.window = messageBox()
        self.window.infoBox("Emergency Service with ID : " + str(esData["id"]) + " is deleted.")

        # Deleting Hospital
        import requests
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/login/" + str(esData["username"])
        r = requests.delete(url=URL)
        print(r)
        pass
Exemple #18
0
    def clickOnRemoveDispensary(self, parent,dispensaryData):
        #print("Remove Button called")
        print(dispensaryData)
        parent.close()
        self.window = messageBox()
        self.window.infoBox("Dispensary with ID : " + str(dispensaryData["id"]) + " is deleted.")

        # Deleting Hospital
        import requests
        URL = "https://mdtouch.herokuapp.com/MDTouch/api/login/" + str(dispensaryData["username"])
        r = requests.delete(url=URL)
        print(r)
    def clickOnRemoveButton(self, parent, tcData):
        print(tcData)
        parent.close()
        self.window = messageBox()
        self.window.infoBox("Test Center with ID : " + str(tcData["id"]) +
                            " is deleted.")

        # Deleting TestCenter
        import requests
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/login/" + str(
            tcData["username"])
        r = requests.delete(url=URL)
        print(r)
Exemple #20
0
 def clickOnButton(self, parent, loginData, grandparent):
     old_password = self.oldPassword.text()
     new_password = self.newPassword.text()
     _new_password = self._newPassword.text()
     if old_password != loginData["password"]:
         self.window = messageBox()
         self.window.warningBox("Old Password is Incorrect")
         return
     if new_password != _new_password:
         self.window = messageBox()
         self.window.warningBox("New Password Does not match")
         return
     import requests
     URL = "https://mdtouch.herokuapp.com/MDTouch/api/login/" + str(
         loginData["id"])
     data = {"password": new_password}
     r = requests.put(url=URL, data=data)
     print(r)
     print(r.json())
     grandparent.logindata = r.json()
     parent.close()
     self.window = messageBox()
     self.window.infoBox("Your Password has been changed")
 def clickOnWrite(self, parent):
     patientId = self.patientID.text()
     data = {
         "patientid": int(patientId),
         "doctorid": int(self.doctordata["id"]),
         "status": 1
     }
     URL = "https://mdtouch.herokuapp.com/MDTouch/api/appointment/"
     import requests
     r = requests.get(url=URL, params=data)
     appointmentData = r.json()
     if len(appointmentData) == 0:
         self.window = messageBox()
         self.window.infoBox(
             "This is not your Patient. Either you have not accepted his appointment"
         )
         return
     title = self.title.text()
     disease = self.disease.text()
     prescription = self.prescriptionBox.toPlainText()
     data = {
         "name": title,
         "dosage": disease,
         "prescription": prescription,
         "patient": int(patientId),
         "doctor": int(self.doctordata["id"])
     }
     URL = "https://mdtouch.herokuapp.com/MDTouch/api/prescription/"
     r = requests.post(url=URL, data=data)
     prescriptiondata = r.json()
     URL = "https://mdtouch.herokuapp.com/MDTouch/api/appointment/" + str(
         appointmentData[0]["id"])
     r = requests.delete(url=URL)
     self.window = messageBox()
     self.window.infoBox("Prescription Generated with ID : ")
     parent.close()
Exemple #22
0
    def events(self,parent):
        self.okbutton.clicked.connect(lambda : parent.close())
        import requests
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/doctor/"
        params = {
            "workplace" : int(self.hospitaldata["id"])
        }
        r = requests.get(url=URL,params=params)
        l = r.json()
        self.doctorList = l
        if len(l) == 0:
            self.window = messageBox()
            self.window.infoBox("No Admin Found")
            parent.close()
            return
        self.tableWidget.verticalHeader().hide()
        self.tableWidget.horizontalHeader().hide()
        self.tableWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContentsOnFirstShow)
        self.tableWidget.setAutoScrollMargin(100)
        self.tableWidget.setShowGrid(True)
        self.tableWidget.setWordWrap(True)
        self.tableWidget.setCornerButtonEnabled(True)
        self.tableWidget.setRowHeight(0,120)
        self.tableWidget.setStyleSheet("background : rgb(255,255,255);")
        self.tableWidget.setColumnCount(1)
        self.tableWidget.setObjectName("tablewidget")
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(0, item)
        self.tableWidget.horizontalHeader().setCascadingSectionResizes(False)
        self.tableWidget.horizontalHeader().setStretchLastSection(True)
        self.tableWidget.setColumnCount(1)
        self.tableWidget.setRowCount(len(l))
        ctr = 0
        for i in l:
            if ctr == 10:
                break

            self.item  = Widget1()
            self.item.noticeIdLabel.setText("ID : " + str(i["id"]))
            self.item.noticeNameLabel.setText(str(i["firstName"] + " " + i["lastName"]))
            self.tableWidget.setCellWidget(ctr,0,self.item)
            self.tableWidget.setRowHeight(ctr,50)
            ctr += 1
        self.tableWidget.cellClicked.connect(self.cellClick)
Exemple #23
0
    def clickOnSaveButton(self,parent,grandparent):

        address =  self.address.toPlainText()

        import requests
        URL = "https://mdtouchs.herokuapp.com/api/doctor/" + str(self.doctordata["id"])
        data = {
            "address" : address,
            "qualification" : int(self.doctordata["qualification"]),
            "specialization" : int(self.doctordata["specialization"])
        }
        r = requests.put(url=URL,data= data)
        print(r.json())
        self.doctordata = r.json()
        grandparent.doctordata = self.doctordata
        print(self.doctordata)
        self.window = messageBox()
        self.window.infoBox("Changes are saved")
        parent.close()
Exemple #24
0
    def clickOnRemoveButton(self, parent):
        id = self.searchByID.text()
        if self.searchByID.text() == "" or (
                not (self.searchByID.text().isdigit())):
            self.dialog = messageBox()
            self.dialog.warningBox("Enter Valid ID")
            return
        import requests
        URL = "https://mdtouch.herokuapp.com/api/event/" + id
        r = requests.get(url=URL)
        l = r.json()
        print(l)
        if l == {'detail': 'Not found.'}:
            self.window = messageBox()
            self.window.warningBox("Id Does not Exists")
            return
        if self.type == 'H':
            if l["hospitalid"] != self.userdata["id"]:
                self.dialog = messageBox()
                self.dialog.warningBox("Enter Valid ID")
                return
        elif self.type == "BB":
            if l["bloodbankid"] != self.userdata["id"]:
                self.dialog = messageBox()
                self.dialog.warningBox("Enter Valid ID")
                return
        elif self.type == "DS":
            if l["dispensaryid"] != self.userdata["id"]:
                self.dialog = messageBox()
                self.dialog.warningBox("Enter Valid ID")
                return
        elif self.type == "T":
            if l["testcenterid"] != self.userdata["id"]:
                self.dialog = messageBox()
                self.dialog.warningBox("Enter Valid ID")
                return

        parent.close()
        self.window = QDialog()
        self.dialog = deleteEvent()
        self.dialog.setup(self.window, l)
        self.window.setModal(True)
        self.window.show()
Exemple #25
0
    def addRowDataFunction(self, EventListDialog):
        print("Hey baby")
        URL = "https://mdtouch.herokuapp.com/MDTouch/api/hospital/"
        self.dataToFill = []
        if self.searchEventInput.text() == "":
            print("Yes")
            if self.stateComboBox.currentText() == "All States":
                print("All States")
                import requests
                r = requests.get(url=URL)
                l = r.json()
                self.dataToFill = l
                print(self.dataToFill)
            else:
                if self.cityComboBox.currentText() == "All Cities":
                    params = {"state": self.stateComboBox.currentText()}
                    import requests
                    r = requests.get(url=URL, params=params)
                    l = r.json()
                    self.dataToFill = l
                else:
                    params = {
                        "state": self.stateComboBox.currentText(),
                        "city": self.cityComboBox.currentText()
                    }
                    import requests
                    r = requests.get(url=URL, params=params)
                    l = r.json()
                    self.dataToFill = l
            print(self.dataToFill)
        elif self.comboBox.currentText() == "Search By Id":
            id = self.searchEventInput.text()
            if id.isdigit():
                import requests
                url = URL + id
                r = requests.get(url=url)
                m = r.json()
                print(m)
                if m == {'detail': 'Not found.'}:
                    self.dialog = messageBox()
                    self.dialog.infoBox("No Id Match")
                    self.tableWidget.setRowCount(0)
                    return
                else:
                    self.dataToFill.append(m)
            else:
                self.window = messageBox()
                self.window.infoBox("Id should be a integer")
                self.tableWidget.setRowCount(0)
                return
        else:
            name = self.searchEventInput.text()
            print(name)
            if self.stateComboBox.currentText() == "All States":
                import requests
                r = requests.get(url=URL)
                l = r.json()
                from difflib import SequenceMatcher
                for i in l:
                    if SequenceMatcher(None, i["name"].lower(), name.lower(
                    )).ratio() >= 0.5 or name.lower() in i["name"].lower():
                        self.dataToFill.append(i)
            else:
                if self.cityComboBox.currentText() == "All Cities":
                    params = {"state": self.stateComboBox.currentText()}
                    import requests
                    r = requests.get(url=URL, params=params)
                    l = r.json()
                    from difflib import SequenceMatcher
                    for i in l:
                        if SequenceMatcher(None, i["name"].lower(), name.lower(
                        )).ratio() >= 0.5 or name.lower() in i["name"].lower():
                            self.dataToFill.append(i)
                else:
                    params = {
                        "state": self.stateComboBox.currentText(),
                        "city": self.cityComboBox.currentText()
                    }
                    import requests
                    r = requests.get(url=URL, params=params)
                    l = r.json()
                    from difflib import SequenceMatcher
                    for i in l:
                        if SequenceMatcher(None, i["name"].lower(), name.lower(
                        )).ratio() >= 0.5 or name.lower() in i["name"].lower():
                            self.dataToFill.append(i)
        print("Hello")
        if len(self.dataToFill) == 0:
            self.tableWidget.setRowCount(0)
            self.dialog = messageBox()
            self.dialog.infoBox("No Hospitals Found")
            return
        i = 0
        print(self.dataToFill)
        self.tableWidget.setRowCount(len(self.dataToFill))
        for hdata in self.dataToFill:

            self.table = Widget1()
            self.table.hospitalNameLabel.setText(str(hdata["name"]))
            self.table.hospitalIdLabel.setText("Id : " + str(hdata["id"]))
            self.table.cityLabel.setText("City : " + str(hdata["city"]))
            self.table.stateLabel.setText("State : " + str(hdata["state"]))
            self.table.addresslabel.setText(hdata["address"])
            if (i % 2):
                self.table.setStyleSheet("background:rgb(225,225,225);")
            else:
                self.table.setStyleSheet("background : rgb(255,255,255);")
            self.tableWidget.setCellWidget(i, 0, self.table)
            self.tableWidget.setRowHeight(i, 120)

            i += 1
        self.tableWidget.cellClicked.connect(self.cellClick)
        self.searchEventInput.setText("")
Exemple #26
0
    def clickOnAddButton(self,parent,grandparent,bloodBankHome):
        pid = self.patientID.text()

        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/patient/" + pid
        import requests
        r = requests.get(url=URL)
        if r.json() == {"detail": "Not found."}:
            self.window = messageBox()
            self.window.infoBox("Patient ID Does Not exits")
            return
        quantity = self.quantity.text()
        bloodtype = self.bloodTypeComboBox.currentText()
        if bloodtype == 'A+':
            left = grandparent.bloodbankdata["quantityAp"] + int(quantity)
            grandparent.bloodbankdata["quantityAp"] = left
            data = {
                "quantityAp" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        elif bloodtype == 'A-':

            left = grandparent.bloodbankdata["quantityAm"] + int(quantity)
            grandparent.bloodbankdata["quantityAm"] = left
            data = {
                "quantityAm" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        elif bloodtype == 'B+':
            left = grandparent.bloodbankdata["quantityBp"] + int(quantity)
            grandparent.bloodbankdata["quantityBp"] = left
            data = {
                "quantityBp" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        elif bloodtype == 'B-':
            left = grandparent.bloodbankdata["quantityBm"] + int(quantity)
            grandparent.bloodbankdata["quantityBm"] = left
            data = {
                "quantityBm" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        elif bloodtype == 'AB+':

            left = grandparent.bloodbankdata["quantityABp"] + int(quantity)
            grandparent.bloodbankdata["quantityABp"] = left
            data = {
                "quantityABp" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        elif bloodtype == 'AB-':
            left = grandparent.bloodbankdata["quantityABm"] + int(quantity)
            grandparent.bloodbankdata["quantityABm"] = left
            data = {
                "quantityABm" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        elif bloodtype == 'O+':
            left = grandparent.bloodbankdata["quantityOp"] + int(quantity)
            grandparent.bloodbankdata["quantityOp"] = left
            data = {
                "quantityOp" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        else:
            left = grandparent.bloodbankdata["quantityOm"] + int(quantity)
            grandparent.bloodbankdata["quantityOm"] = left
            data = {
                "quantityOm" : int(left)
            }
            URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
            r = requests.put(url=URL,data = data)
        import datetime
        data = {
            "date" : datetime.date.today(),
            "quantity": int(quantity),
            "bloodtype": bloodtype,
            "bloodquantity": int(quantity),
            "status": False,
            "patid": int(pid),
            "bbcid": grandparent.bloodbankdata["id"]
        }
        URL = "https://mdtouchs.herokuapp.com/MDTouch/api/bloodbilling/"
        r = requests.post(url=URL,data=data)
        l = None
        l = r.json()
        print(l)
        parent.close()
        if l :
            self.window = QDialog()
            self.dialog = bloodDonationProfile()
            self.dialog.setup(self.window,l)
            self.window.setModal(True)
            self.window.show()
        grandparent.setup(bloodBankHome,grandparent.logindata)
Exemple #27
0
    def addRowDataFunction(self, EventListDialog):
        print("Hey baby")
        URL = "https://mdtouch.herokuapp.com/MDTouch/api/event/"
        self.dataToFill = []
        import requests
        if self.searchEventInput.text() == "":
            params = {}
            if self.type == 'H':
                params = {"hospitalid": self.userdata["id"]}
            elif self.type == "BB":
                params = {"bloodbankid": self.userdata["id"]}
            elif self.type == 'DS':
                params = {"dispensaryid": self.userdata["id"]}
            elif self.type == "T":
                params = {"testcentreid": self.userdata["id"]}
            r = requests.get(url=URL, params=params)
            self.dataToFill = r.json()
        else:
            id = self.searchEventInput.text()
            if id.isdigit():
                import requests
                r = requests.get(url=URL + str(id))
                l = r.json()
                if self.type == 'H':
                    if l["hospitalid"] != self.userdata["id"]:
                        self.window = messageBox()
                        self.window.warningBox("No Id Found")
                        return
                if self.type == 'T':
                    if l["testcentreid"] != self.userdata["id"]:
                        self.window = messageBox()
                        self.window.warningBox("No Id Found")
                        return
                if self.type == 'BB':
                    if l["bloodbankid"] != self.userdata["id"]:
                        self.window = messageBox()
                        self.window.warningBox("No Id Found")
                        return
                if self.type == 'DS':
                    if l["dispensaryid"] != self.userdata["id"]:
                        self.window = messageBox()
                        self.window.warningBox("No Id Found")
                        return
                self.dataToFill.append(l)
            else:
                self.window = messageBox()
                self.window.warningBox("Id should be a integer")

        if len(self.dataToFill) == 0:
            self.tableWidget.setRowCount(0)
            self.dialog = messageBox()
            self.dialog.infoBox("No events Found")
            return
        i = 0
        print(self.dataToFill)
        self.tableWidget.setRowCount(len(self.dataToFill))
        for hdata in self.dataToFill:

            self.table = Widget1()
            self.table.eventNameLabel.setText(str(hdata["title"]))
            self.table.eventIdLabel.setText("Id : " + str(hdata["id"]))
            self.table.cityLabel.setText("City : " + str(hdata["city"]))
            self.table.stateLabel.setText("State : " + str(hdata["state"]))
            if hdata["hospitalid"]:
                self.table.addresslabel.setText("Host : Hospital Id : " +
                                                str(hdata["hospitalid"]))
            elif hdata["bloodbankid"]:
                self.table.addresslabel.setText(
                    "Host : BloodbankCentre Id : " + str(hdata["bloodbankid"]))
            elif hdata["dispensaryid"]:
                self.table.addresslabel.setText("Host : Dispensary Id : " +
                                                str(hdata["dispensaryid"]))
            elif hdata["testcentreid"]:
                self.table.addresslabel.setText("Host : Test Center Id : " +
                                                str(hdata["testcentreid"]))
            else:
                self.table.addresslabel.setText("Host : SuperAdmin")
            if (i % 2):
                self.table.setStyleSheet("background:rgb(225,225,225);")
            else:
                self.table.setStyleSheet("background : rgb(255,255,255);")
            self.tableWidget.setCellWidget(i, 0, self.table)
            self.tableWidget.setRowHeight(i, 120)

            i += 1
        self.tableWidget.cellClicked.connect(self.cellClick)
        self.searchEventInput.setText("")
    def clickOnAddButton(self,parent,grandparent,bloodbankHome):
        bbid = grandparent.bloodbankdata["id"]
        quantity = self.quantity.text()
        reason = self.reason.toPlainText()
        if not(quantity.isdigit()) or len(reason) < 11 :
            self.window = messageBox()
            self.window.infoBox("Invalid data")
            return
        import requests
        bloodtype = self.bloodTypeComboBox.currentText()
        if bloodtype == 'A+':
            if int(grandparent.bloodbankdata["quantityAp"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityAp"] - int(quantity)
                grandparent.bloodbankdata["quantityAp"] = left
                data = {
                    "quantityAp" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        elif bloodtype == 'A-':
            if int(grandparent.bloodbankdata["quantityAm"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityAm"] - int(quantity)
                grandparent.bloodbankdata["quantityAm"] = left
                data = {
                    "quantityAm" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        elif bloodtype == 'B+':
            if int(grandparent.bloodbankdata["quantityBp"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityBp"] - int(quantity)
                grandparent.bloodbankdata["quantityBp"] = left
                data = {
                    "quantityBp" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        elif bloodtype == 'B-':
            if int(grandparent.bloodbankdata["quantityBm"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityBm"] - int(quantity)
                grandparent.bloodbankdata["quantityBm"] = left
                data = {
                    "quantityBm" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        elif bloodtype == 'AB+':
            if int(grandparent.bloodbankdata["quantityABp"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityABp"] - int(quantity)
                grandparent.bloodbankdata["quantityABp"] = left
                data = {
                    "quantityABp" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        elif bloodtype == 'AB-':
            if int(grandparent.bloodbankdata["quantityABm"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityABm"] - int(quantity)
                grandparent.bloodbankdata["quantityABm"] = left
                data = {
                    "quantityABm" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        elif bloodtype == 'O+':
            if int(grandparent.bloodbankdata["quantityOp"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityOp"] - int(quantity)
                grandparent.bloodbankdata["quantityOp"] = left
                data = {
                    "quantityOp" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)
        else:
            if int(grandparent.bloodbankdata["quantityOm"]) < int(quantity):
                self.window = messageBox()
                self.window.infoBox("Does Not have blood of this type")
                return
            else:
                left = grandparent.bloodbankdata["quantityOm"] - int(quantity)
                grandparent.bloodbankdata["quantityOm"] = left
                data = {
                    "quantityOm" : int(left)
                }
                URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodbankcenter/" + str(grandparent.bloodbankdata["id"])
                r = requests.put(url=URL,data = data)

        import datetime
        data = {
            "date" : datetime.date.today(),
            "quantity": int(quantity),
            "bloodgrp": self.bloodTypeComboBox.currentText(),
            "reason": reason,
            "bbcid": int(bbid)
        }
        URL = "https://mdtouch.herokuapp.com/MDTouch/api/bloodwaste/"
        r = requests.post(url=URL,data=data)
        l = r.json()
        parent.close()
        self.window = QDialog()
        self.dialog = bloodwasteReciept()
        self.dialog.setup(self.window,l)
        self.window.setModal(True)
        self.window.show()
        grandparent.setup(bloodbankHome,grandparent.logindata)