def enregistrer_question(self, niveau, intitule, description, valeur, type_reponse, reponse_alerte, comparateur): dao_question.dao_Question().insert_question2(intitule, description, valeur, niveau, type_reponse, reponse_alerte, comparateur) self.rubrique = niveau return self.liste_questions()
def init_listes_questions(self): id_patient = model_global.get_user_id() #Récupère la liste des question de la rubrique self.liste_parametres = dao_question.dao_Question().get_questions_niveau(0) #Récupère les données du dernier questionnaire self.reponses_parametres = dao_reponse.dao_Reponse().get_last_reponse_patient(id_patient, 0) #Récupère les valeurs par défaut des questions si première saisie if len(self.reponses_parametres) == 0 : self.liste_parametres = dao_question.dao_Question().get_questions_niveau(0) self.reponses_parametres = [] for quest in self.liste_parametres : rep = reponse.Reponse() rep.set_id_question(quest.get_id()) rep.set_reponse(quest.get_valeur()) self.reponses_parametres.append(rep) #Symptomes fréquents self.liste_sympt_frequents = dao_question.dao_Question().get_questions_niveau(1) self.reponses_sympt_frequents = dao_reponse.dao_Reponse().get_last_reponse_patient(id_patient, 1) if len(self.reponses_sympt_frequents) == 0 : self.liste_sympt_frequents = dao_question.dao_Question().get_questions_niveau(1) self.reponses_sympt_frequents = [] for quest in self.liste_sympt_frequents : rep = reponse.Reponse() rep.set_id_question(quest.get_id()) rep.set_reponse(quest.get_valeur()) self.reponses_sympt_frequents.append(rep) #Symptomes moins fréquents self.liste_sympt_moins_frequents = dao_question.dao_Question().get_questions_niveau(2) self.reponses_sympt_moins_frequents = dao_reponse.dao_Reponse().get_last_reponse_patient(id_patient, 2) if len(self.reponses_sympt_moins_frequents) == 0 : self.liste_sympt_moins_frequents = dao_question.dao_Question().get_questions_niveau(2) self.reponses_sympt_moins_frequents = [] for quest in self.liste_sympt_moins_frequents : rep = reponse.Reponse() rep.set_id_question(quest.get_id()) rep.set_reponse(quest.get_valeur()) self.reponses_sympt_moins_frequents.append(rep) #Symptomes graves self.liste_sympt_graves = dao_question.dao_Question().get_questions_niveau(3) self.reponses_sympt_graves = dao_reponse.dao_Reponse().get_last_reponse_patient(id_patient, 3) if len(self.reponses_sympt_graves) == 0 : self.liste_sympt_graves = dao_question.dao_Question().get_questions_niveau(3) self.reponses_sympt_graves = [] for quest in self.liste_sympt_graves : rep = reponse.Reponse() rep.set_id_question(quest.get_id()) rep.set_reponse(quest.get_valeur()) self.reponses_sympt_graves.append(rep) #Commentaire quest = dao_questionnaire.dao_Questionnaire().get_last_questionnaire(id_patient) if not (quest == None) : self.questionnaire_jour.set_commentaire(quest.get_commentaire())
def ligne_reponse(self, niveau, questionnaire): liste_questions = dao_question.dao_Question().get_questions_niveau( niveau) count = 2 page = "" rep = "" for quest in liste_questions: for r in questionnaire.get_reponses(): if int(quest.get_id()) == int(r.get_id_question()): rep = r.get_reponse() break else: rep = str(quest.get_id()) + "-" + str(r.get_id_question()) if count % 2 == 0: page = page + "<tr><td><b>" + quest.get_intitule( ) + "</b><br>" + quest.get_description() + "</td><td>" + str( rep) + "</td></tr>" else: page = page + "<tr class='ligne_gris'><td><b>" + quest.get_intitule( ) + "</b><br>" + quest.get_description() + "</td><td>" + str( rep) + "</td></tr>" count = count + 1 return page
def questions_parametres(self, rubrique=0): self.rubrique = rubrique page = super().header() page = page + '''<fieldset class="cadre"> <legend> Paramêtres </legend>''' page = page + '''<div> <div class="rubriques"> <div class="button_selected"><a href="questions_parametres?rubrique=0">Paramêtres</a></div> <div class="button"><a href="questions_sympt_frequents?rubrique=1">Symptômes fréquents</a></div> <div class="button"><a href="questions_sympt_moins_frequents?rubrique=2">Symptômes moins fréquents</a></div> <div class="button"><a href="questions_sympt_graves?rubrique=3">Symptômes graves</a></div> </div> <div class="liste_questions">''' #Parametres du patients page = page + "<div><a href='nouveau_question?niveau=0'>Ajouter une question</a>" page = page + '<div style="width:800px;">' liste = dao_question.dao_Question().get_questions_niveau(0) count = 1 for c in liste: if count % 2 == 0: page = page + '<div class="ligne_gris" style="margin-bottom:10px;">' + c.to_string( ) + "</div>" else: page = page + '<div style="margin-bottom:10px;">' + c.to_string( ) + "</div>" count = count + 1 page = page + '''</div></div></div></div></fieldset>''' page = page + '<div style="width: 100px; margin: auto;"><a href="accueil_medecin">Retour accueil</a></div>' page = page + super().footer() return page
def suivi_patient(self, id=-1, rubrique=0): self.patient_selected = dao_patient.dao_Patient().get_patient(id) page = super().header() page = page + "<div class='cadre'>" page = page + self.infos_patient(id) page = page + "</div>" page = page + '''<fieldset class="cadre"> <legend> Suivi </legend> <div>''' page = page + '''<div class="liste_questions"> <div class="rubriques">''' #Parametres if int(rubrique) == 0: page = page + '''<div class="button_selected"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=0">Paramêtres</a></div>''' else: page = page + '''<div class="button"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=0">Paramêtres</a></div>''' #Frequents if int(rubrique) == 1: page = page + '''<div class="button_selected"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=1">Symptômes fréquents</a></div>''' else: page = page + '''<div class="button"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=1">Symptômes fréquents</a></div>''' #Moins Frequents if int(rubrique) == 2: page = page + '''<div class="button_selected"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=2">Symptômes moins fréquents</a></div>''' else: page = page + '''<div class="button"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=2">Symptômes moins fréquents</a></div>''' #Graves if int(rubrique) == 3: page = page + '''<div class="button_selected"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=3">Symptômes graves</a></div>''' else: page = page + '''<div class="button"><a href="suivi_patient?id=''' + str( id) + '''&rubrique=3">Symptômes graves</a></div>''' page = page + "</div>" page = page + "<table>" page = page + "<tr>" page = page + "<th> </th>" #Creation des colonnes liste_questions = dao_question.dao_Question().get_questions_niveau( rubrique) for quest in liste_questions: page = page + "<th>" + quest.get_intitule() + "</th>" page = page + "<th>Etat</th>" page = page + "</tr>" #Création des lignes questionnaires = dao_questionnaire.dao_Questionnaire( ).get_questionnaires_patient(self.patient_selected.get_id()) count = 2 indic = 0 for q in questionnaires: if count % 2 == 0: page = page + "<tr class='ligne_gris'>" else: page = page + "<tr>" page = page + "<td><a href='analyse_questionnaire_patient?id=" + str( q.get_id()) + "'>" + q.get_date() + "</a></td>" #les réponses indic = 0 comp = None curr_quest = None niv_alerte = None type_q = None reponses = dao_reponse.dao_Reponse().get_reponses_questionnaire( q.get_id(), rubrique) for rep in reponses: print("Reponse:" + rep.to_string()) curr_quest = liste_questions[indic] comp = curr_quest.get_comparateur() niv_alerte = curr_quest.get_reponse_alerte() type_q = curr_quest.get_type_reponse() if niv_alerte == None: page = page + '<td>' else: #Si reponse numérique if type_q == "Numérique": print("Question Numérique") val = float(rep.get_reponse()) niv_alerte = float(niv_alerte) #Si comparateur : = if comp == 2: if val == niv_alerte: page = page + '<td class="rep_alerte">' else: page = page + '<td>' #Si comparateur : > elif comp == 0: if val > niv_alerte: page = page + '<td class="rep_alerte">' else: page = page + '<td>' #Si comparateur : > elif comp == 1: if val < niv_alerte: page = page + '<td class="rep_alerte">' else: page = page + '<td>' #Si reponse Textuelle else: print("Question Textuelle :" + rep.get_reponse() + "; alerte:" + niv_alerte) if rep.get_reponse() == niv_alerte: page = page + '<td class="rep_alerte">' else: page = page + '<td>' page = page + str(rep.get_reponse()) + "</td>" indic = indic + 1 print("Etat patient=" + str(q.get_etat_patient())) if q.get_etat_patient() == -1: page = page + "<td class='etat_non_analyse'> </td>" elif q.get_etat_patient() == 0: page = page + "<td class='etat_gerrie'> </td>" elif q.get_etat_patient() == 1: page = page + "<td class='etat_moyen'> </td>" elif q.get_etat_patient() == 2: page = page + "<td class='etat_grave'> </td>" elif q.get_etat_patient() == 3: page = page + "<td class='etat_tres_grave'> </td>" elif q.get_etat_patient() == 4: page = page + "<td class='etat_decede'> </td>" page = page + "</tr>" count = count + 1 page = page + "</table>" page = page + "</div>" page = page + "</fieldset>" page = page + '<div style="width: 200px; margin: auto;"><a href="liste_patients">Retour liste des patients</a></div>' page = page + super().footer() return page