def add(): if request.method == "POST": #make an array to store the info patient_info = {} patient_info["name"] = request.form["name"] patient_info["age"] = request.form["age"] patient_info["gender"] = request.form["gender"] patient_info["blood"] = request.form["blood"] patient_info["mobile"] = request.form["mobile"] patient_info["email"] = request.form["email"] patient_info["alcohol"] = request.form["alcohol"] patient_info["criminal"] = request.form["criminal"] patient_info["critical"] = request.form["critical"] patient_info["disease"] = request.form["disease"] patient_info["eco_status"] = request.form["eco_status"] patient_info["marital_status"] = request.form["marital_status"] patient_info["dependents"] = request.form["dependents"] #update evrything through firebase temp = fnm.EnterIntoPatientDB(patient_info) session["patient_info"] = patient_info if temp is None: #redirect to the same page flash("Patient added successfully", "success") return redirect(url_for("add")) else: return render_template("ml.html", content=temp) else: temp = fnm.GetDiseaseList() return render_template("add.html", content=temp)
def addroom(): name = request.form["name"] number_of_beds = request.form["capacity"] critical = request.form["critical"] fnm.AddRooms(name, number_of_beds, critical) return redirect(url_for("room"))
def discharge(): if request.method == "POST": name = request.form["name"] ids = request.form["patient_id"] #firebase fnm.DeletePatientByNumberAndName(ids, name) flash("Patient removed successfully", "sucess") return redirect(url_for("discharge")) else: return render_template("discharge.html")
def update(): if request.method == "POST": name = request.form["name"] ids = request.form["patient_id"] critical = request.form["critical"] #function flash("Patient information updated successfully", "sucess") fnm.UpdateRecord(ids, name, critical) return redirect(url_for("update")) else: return render_template("update.html")
def replace(): info = session["patient_info"] fnm.ReplacePatient(info) fnm.GradientDescent(info, 0) return redirect(url_for("home"))
def removeroom(): name = request.form["name"] fnm.RemoveRooms(name) return redirect(url_for("room"))
def home(): arr = [fnm.CountNumberOfPatients(), fnm.TotalOccupancy()] #arr = [10, 20] return render_template("index.html", content=arr)
def room(): temp = fnm.GetRoomsWithPatients() return render_template("room.html", content=temp)
def notreplace(): info = session["patient_info"] fnm.GradientDescent(info, 1) return redirect(url_for("home"))