Exemplo n.º 1
0
def show_patients():
    "show all patients in db"
    cur = g.db.cursor()
    cur.execute('SELECT patient_id, date_created, xray_outcome FROM patients ORDER BY id desc;')
    if cur:
        patients = [dict(patient_id=row[0], datetime=getDateStr(row[1]), xray_outcome=row[2]) for row in cur.fetchall()]
    else:
        patients = []
    return render_template('show_patients.html', patients=patients)
Exemplo n.º 2
0
def show_patient(patient_id):
    "show patient with given patient_id"
    rq = query_db('select date_created, gender, xray, double_density, \
         oblique_diameter, appendage_shape, xray_outcome, ctmri from patients \
         where patient_id = %s;',
        [patient_id], one=True)
    patient = None
    if rq:
        ddate    = getDateStr(rq[0])
        gender   = rq[1]
        xray     = int2bool(rq[2])
        ddensity = int2choice(rq[3])
        oblique_diam = float(rq[4])
        app_shape = appendage2choice(rq[5])
        xray_outcome = rq[6]
        ctmri    = int2bool(rq[7])
        patient  = dict(patient_id=patient_id, datetime=ddate, gender=gender, 
            xray=xray, double_density=ddensity, oblique_diameter=oblique_diam,
            appendage_shape=app_shape,
            xray_outcome=xray_outcome, ctmri=ctmri)
    return render_template('show_patient.html', patient=patient)