Skip to content
Snippets Groups Projects

Update Rendu 4/main.py

Merged Robin Lacroix requested to merge rlacroix-main-patch-68403 into main
1 file
+ 24
1
Compare changes
  • Side-by-side
  • Inline
+ 24
1
@@ -357,7 +357,7 @@ def taille_poids():
cur.execute(sql)
raw = cur.fetchone()
while raw:
print(f"[{raw[1]}] {raw[0]} {raw[2]} ")
print(f"[{raw[0]}] {raw[1]} {raw[2]} ")
raw = cur.fetchone()
conn.commit()
print("La taille :")
@@ -448,6 +448,29 @@ def veterinaire_suivant_un_animal(nom_animal):
conn.commit()
cur.close()
def medicament_consomme_periode(date_debut,date_fin):
cur = conn.cursor()
sql = f"SELECT m.molecule, (t.duree * p.quantite * COUNT(*)) AS nombre FROM Medicament m INNER JOIN Prescrit p ON m.molecule = p.medicament INNER JOIN Traitement t ON p.traitement = t.id WHERE t.date_debut - '{date_debut}' > 0 AND '{date_fin}' - t.date_debut > t.duree GROUP BY m.molecule, t.duree, p.quantite;"
cur.execute(sql)
raw = cur.fetchone()
while raw:
print(f"[{raw[0]}] {raw[1]} ")
raw = cur.fetchone()
conn.commit()
cur.close()
def traitement_par_periode(date_debut,date_fin):
cur = conn.cursor()
sql = f"SELECT COUNT(*) AS nombre_traitements FROM Traitement WHERE date_debut - '{date_debut}' > 0 AND '{date_fin}' - date_debut > duree;"
cur.execute(sql)
raw = cur.fetchone()
while raw:
print(f"{raw[0]}")
raw = cur.fetchone()
conn.commit()
cur.close()
def main():
print("début")
conn = connexion()
Loading