Пример #1
0
class MonitForm(QWidget):
	lbMap = {1:("lbTemperatura","C"), 3:("lbPressao","mmHg"), 4:("lbO2","%"), 5:("lbFC","bpm")}
	def __init__(self, parent = None):
		super(MonitForm, self).__init__(parent)
		self.ui = Ui_SoloMonitForm()
		self.ui.setupUi(self)
		self.alarmForm = AlarmForm()
		self.alarmForm.setParent(self.ui.alarmePanel)
		self.ui.alarmePanel.hide()
		self.ui.parametrosPanel.setStyleSheet("background-color:black;");
		#self.hideAlarms()
		self.ui.btnalarm.clicked.connect(self.toggleAlarms)
		self.hidden = True
		self.monitController = None
		self.plotter = GenPlotter(self.ui.ecgchart,100000)
		self.controller = None
	
	def toggleAlarms(self):
		if self.hidden == True:
			self.ui.alarmePanel.show()
			#self.showAlarms()
			self.hidden = False
		else:
			self.ui.alarmePanel.hide()
			#self.hideAlarms()
			self.hidden = True

	def showAlarms(self):
		for w in range(0, self.ui.gridLayout_alarms.count()):
			self.ui.gridLayout_alarms.itemAt(w).widget().show()

	def hideAlarms(self):
		for w in range(0, self.ui.gridLayout_alarms.count()):
			self.ui.gridLayout_alarms.itemAt(w).widget().hide()

	def atualiza(self, paciente):
		self.atualizaLabels(self.ui, paciente)
		self.plotter.atualiza(paciente.measures[4].channels[0].data)

	def atualizaLabels(self, gui, paciente):
		for m in paciente.measures:
			if m.cod == 6:
				continue
			lb = getattr(gui,self.lbMap[m.cod][0])
			un = self.lbMap[m.cod][1]
			if m.cod == 3:
				self.setLabel(lb, ("%s/%s" % (m.channels[0].data[0], m.channels[1].data[0])), un)
			else:
				self.setLabel(lb, str(m.channels[0].data[0]), un)

	def setLabel(self, label, dado, unidade = ''):
		label.setText("%s %s" % (dado, unidade))
Пример #2
0
 def __init__(self, qtreactor, qtip, qtport, parent=None):
     super(MonitSim, self).__init__(parent)
     self.reactor = qtreactor
     self.ip = qtip
     self.port = qtport
     self.ui = Ui_MonitSimForm()
     self.ui.setupUi(self)
     self.plotter = GenPlotter(self.ui.ecgChart)
     self.smsg = None
     self.monit = monitor_multi(sys.argv[1])
     #Twisted client api
     #self.monitw = ICUMonitorFactory(self.setmsg, self.ip, self.port) #Create client
     self.monitw = ICUClient(reactor, self.ip, self.port)
Пример #3
0
	def __init__(self, parent = None):
		super(MonitForm, self).__init__(parent)
		self.ui = Ui_SoloMonitForm()
		self.ui.setupUi(self)
		self.alarmForm = AlarmForm()
		self.alarmForm.setParent(self.ui.alarmePanel)
		self.ui.alarmePanel.hide()
		self.ui.parametrosPanel.setStyleSheet("background-color:black;");
		#self.hideAlarms()
		self.ui.btnalarm.clicked.connect(self.toggleAlarms)
		self.hidden = True
		self.monitController = None
		self.plotter = GenPlotter(self.ui.ecgchart,100000)
		self.controller = None
	def __init__(self, qtreactor, qtip, qtport, parent = None):
		super(MonitSim, self).__init__(parent)
		self.reactor = qtreactor
		self.ip = qtip
		self.port = qtport
		self.ui = Ui_MonitSimForm()
		self.ui.setupUi(self)
		self.plotter = GenPlotter(self.ui.ecgChart)
		self.smsg = None
		self.monit = monitor_multi(sys.argv[1])
		#Twisted client api
		#self.monitw = ICUMonitorFactory(self.setmsg, self.ip, self.port) #Create client
		self.monitw = ICUClient(reactor, self.ip, self.port)
Пример #5
0
class MonitSim(QWidget):
    def __init__(self, qtreactor, qtip, qtport, parent=None):
        super(MonitSim, self).__init__(parent)
        self.reactor = qtreactor
        self.ip = qtip
        self.port = qtport
        self.ui = Ui_MonitSimForm()
        self.ui.setupUi(self)
        self.plotter = GenPlotter(self.ui.ecgChart)
        self.smsg = None
        self.monit = monitor_multi(sys.argv[1])
        #Twisted client api
        #self.monitw = ICUMonitorFactory(self.setmsg, self.ip, self.port) #Create client
        self.monitw = ICUClient(reactor, self.ip, self.port)

    def closeEvent(self, event):
        self.loop.stop()
        self.monitw.stop_sending()
        time.sleep(1)
        fecha = oru_wav((12312, 'CEN'), (sys.argv[1], 'MON'))
        p1 = patient(1, 'Jonas Brothers')
        m1 = measure()
        p1.add_measure(m1)
        fecha.add_patient(p1)
        fecha.fill_segments()
        #self.smsg = fecha.to_str()
        self.monitw.msg = fecha.to_str()
        self.monitw.send_msg()
        #time.sleep(5)
        #self.reactor.stop()

    #Message that is sent to the icu center. HL7 format
    def setmsg(self):
        return self.smsg

    #Initiates the monitor
    def turnOn(self):
        self.loop = LoopingCall(self.genMeasure)
        self.loop.start(0.3)  #Starts function that generates measures
        #		self.monitw.startsend(self.reactor, 0.3) #Starts function that sends data to the icu center
        self.monitw.start_sending(0.3)

    #Generates new measures from the patient
    def genMeasure(self):
        self.monit.preenche()
        orw = self.monit.get_orw((sys.argv[1], 'CEN'))
        #		self.smsg = orw.to_str()
        self.monitw.msg = orw.to_str()

        #Creates strings with the measures
        strTemp = str(self.monit.monitored.measures[0].channels[0].data).strip(
            '[]')  #Temp
        strO2 = str(self.monit.monitored.measures[2].channels[0].data).strip(
            '[]')  #SpO2
        strFc = str(self.monit.monitored.measures[3].channels[0].data).strip(
            '[]')  #BPM
        strSys = str(self.monit.monitored.measures[1].channels[0].data).strip(
            '[]')  #Systolic
        strDys = str(self.monit.monitored.measures[1].channels[1].data).strip(
            '[]')  #Dyastolic
        strName = str(self.monit.monitored.name)
        strId = str(sys.argv[1])
        #Updates the labels for showing the measures
        self.ui.lbTemperatura.setText(strTemp)
        self.ui.lbO2.setText(strO2)
        self.ui.lbFC.setText(strFc)
        self.ui.lbPressao.setText(strSys + '/' + strDys)
        self.ui.lbPaciente.setText(strName)
        self.ui.lbMonitor.setText(strId)
        self.plotter.atualiza(
            self.monit.monitored.measures[4].channels[0].data)
class MonitSim(QWidget):
	def __init__(self, qtreactor, qtip, qtport, parent = None):
		super(MonitSim, self).__init__(parent)
		self.reactor = qtreactor
		self.ip = qtip
		self.port = qtport
		self.ui = Ui_MonitSimForm()
		self.ui.setupUi(self)
		self.plotter = GenPlotter(self.ui.ecgChart)
		self.smsg = None
		self.monit = monitor_multi(sys.argv[1])
		#Twisted client api
		#self.monitw = ICUMonitorFactory(self.setmsg, self.ip, self.port) #Create client
		self.monitw = ICUClient(reactor, self.ip, self.port)

	def closeEvent(self, event):
		self.loop.stop()
		self.monitw.stop_sending()
		time.sleep(1)
		fecha = oru_wav((12312,'CEN'),(sys.argv[1], 'MON'))
		p1 = patient(1,'Jonas Brothers')
		m1 = measure()
		p1.add_measure(m1)
		fecha.add_patient(p1)
		fecha.fill_segments()
		#self.smsg = fecha.to_str()
		self.monitw.msg = fecha.to_str()
		self.monitw.send_msg()
		#time.sleep(5)
		#self.reactor.stop()

	#Message that is sent to the icu center. HL7 format
	def setmsg(self):
		return self.smsg
	
	#Initiates the monitor
	def turnOn(self):
		self.loop = LoopingCall(self.genMeasure)
		self.loop.start(0.3) #Starts function that generates measures
#		self.monitw.startsend(self.reactor, 0.3) #Starts function that sends data to the icu center
		self.monitw.start_sending(0.3)

	#Generates new measures from the patient
	def genMeasure(self):
		self.monit.preenche() 
		orw = self.monit.get_orw((sys.argv[1], 'CEN'))
#		self.smsg = orw.to_str()
		self.monitw.msg = orw.to_str()

		#Creates strings with the measures
		strTemp = str(self.monit.monitored.measures[0].channels[0].data).strip('[]') #Temp
		strO2 = str(self.monit.monitored.measures[2].channels[0].data).strip('[]') #SpO2
		strFc = str(self.monit.monitored.measures[3].channels[0].data).strip('[]') #BPM
		strSys = str(self.monit.monitored.measures[1].channels[0].data).strip('[]') #Systolic
		strDys = str(self.monit.monitored.measures[1].channels[1].data).strip('[]') #Dyastolic
		strName = str(self.monit.monitored.name)
		strId = str(sys.argv[1])
		#Updates the labels for showing the measures
		self.ui.lbTemperatura.setText(strTemp) 
		self.ui.lbO2.setText(strO2)
		self.ui.lbFC.setText(strFc)
		self.ui.lbPressao.setText(strSys + '/' + strDys)
		self.ui.lbPaciente.setText(strName)
		self.ui.lbMonitor.setText(strId)
		self.plotter.atualiza(self.monit.monitored.measures[4].channels[0].data)