Update Notes API for get notes by patient
This commit is contained in:
@@ -46,14 +46,15 @@ async def read_all_notes():
|
|||||||
async def read_all_patientsby(patientID: int):
|
async def read_all_patientsby(patientID: int):
|
||||||
db = dbConnection.dbConnect()
|
db = dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM patient_notes where patient_id = %s"
|
query = "SELECT * FROM patient_notes where patient_id = %s ORDER BY insert_date DESC"
|
||||||
cursor.execute(query, (patientID,))
|
cursor.execute(query, (patientID,))
|
||||||
items = [
|
items = [
|
||||||
{
|
{
|
||||||
"idpatient_notes": item[0],
|
"idpatient_notes": item[0],
|
||||||
"note_name": item[1],
|
"note_name": item[1],
|
||||||
"note_text": item[2],
|
"note_text": item[2],
|
||||||
"insert_date": item[3],
|
"patient_id": item[3],
|
||||||
|
"insert_date": item[4]
|
||||||
}
|
}
|
||||||
for item in cursor.fetchall()
|
for item in cursor.fetchall()
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user