Beispiel #1
0
def create_new_treatment():
    animal_id = request.form['animal_id']
    animal = animal_repository.select(animal_id)
    vet_id = request.form['vet_id']
    vet = vet_repository.select(vet_id)
    date = request.form['date']
    details = request.form['details']
    new_treatment = Treatment(animal, vet, details, date)
    treatment_repository.save(new_treatment)
    return redirect(f'/animals/{animal_id}')
def new():
    if request.method == 'GET':
        message = request.args.get('message')
        show_all = request.args.get('show_all')
        active_vets = vet_repository.select_all_active()
        active_animals = animal_repository.select_all_active()
        return render_template("treatments/new.html.j2", **locals())
    if request.method == 'POST':
        vet_id = request.form['vet_id']
        animal_id = request.form['animal_id']
        date = request.form['date']
        notes = request.form['notes']
        weight = request.form['weight']
        treatment = Treatment(vet_id, animal_id, date, notes, weight)
        saved_treatment = treatment_repository.save(treatment)
        message = f"Treatment ID:{saved_treatment.id} Added"
        return redirect(url_for("treatments.index", message=message))
Beispiel #3
0
# Pets
pet_1 = Pet('Hudini', '1/1/2012', owner_1, pet_type_3, vet_1)
PR.save(pet_1)

pet_2 = Pet('KitKat', '1/1/2010', owner_1, pet_type_3, vet_1)
PR.save(pet_2)

pet_3 = Pet('Steven', '03/10/2004', owner_3, pet_type_5, vet_2)
PR.save(pet_3)

# Notes

note_1 = Note('09/08/2020', 'Hudini is a stinky boy', pet_1, vet_1)
NR.save(note_1)

# Treatments
treatment_1 = Treatment('Worming tablets', 10, 2, 'dewormitroxin',
                        'Liquid Spray')
TR.save(treatment_1)

treatment_2 = Treatment('Antibiotics - Stinkyitus', 50, 7, 'stinkicillin',
                        'Tablet')
TR.save(treatment_2)

# Test appointment

appointment1 = Appointment('2020-09-12', 'Note text', vet_1, pet_3)
AR.save(appointment1)

pdb.set_trace()
patient_2.name = "Black Panther"
patient_repository.update(patient_2)
patient_list = patient_repository.select_all()

# Treatment repo tests
treatment_1 = Treatment(
    "X-ray done on front left leg following car collision. Results sent to specialists at vet hospital. Awaiting results from specialist.",
    "02/10/2020", patient_1, vet_1)
treatment_2 = Treatment(
    "Patient arrived with severe dehydration and heatstroke due to heatwave. Put in ice bath and on fluids and keeping overnight to monitor progress.",
    "03/10/2020", patient_2, vet_2)
treatment_3 = Treatment(
    "Prepared patient for abdominable surgery following foreign object injestion.",
    "01/10/2020", patient_3, vet_1)
treatment_4 = Treatment(
    "Patient underwent abdominal surgery and foreign object causing distress was successfully removed. Patient moved to intensive care for overnight observation",
    "02/10/2020", patient_3, vet_1)
treatment_1 = treatment_repository.save(treatment_1)
treatment_2 = treatment_repository.save(treatment_2)
treatment_3 = treatment_repository.save(treatment_3)
treatment_4 = treatment_repository.save(treatment_4)

treatment_list_patient_3 = treatment_repository.select_all(patient_3.id)
selected_treatment = treatment_repository.select(treatment_4.id)
# treatment_repository.delete(treatment_3.id)
treatment_list_patient_3 = treatment_repository.select_all(patient_3.id)
treatment_1.date = "30/09/2020"
treatment_repository.update(treatment_1)
selected_treatment = treatment_repository.select(treatment_1.id)

pdb.set_trace()