comment out usless apis
This commit is contained in:
@@ -20,41 +20,41 @@ class fileInsertRequest(BaseModel):
|
|||||||
file_name: str
|
file_name: str
|
||||||
patient_id: int
|
patient_id: int
|
||||||
|
|
||||||
# Get List of all files
|
# # Get List of all files
|
||||||
@router.get("/files/patients/", tags="patients_files")
|
# @router.get("/files/patients/", tags="patients_files")
|
||||||
async def read_all_files(session: SessionContainer = Depends(verify_session())):
|
# async def read_all_files(session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
# db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
# cursor = db.cursor()
|
||||||
query = "SELECT * FROM patient_files"
|
# query = "SELECT * FROM patient_files"
|
||||||
cursor.execute(query)
|
# cursor.execute(query)
|
||||||
items = [
|
# items = [
|
||||||
{
|
# {
|
||||||
"idpatient_files": item[0],
|
# "idpatient_files": item[0],
|
||||||
"file_path": item[1],
|
# "file_path": item[1],
|
||||||
"file_name": item[2],
|
# "file_name": item[2],
|
||||||
"patient_id": item[3],
|
# "patient_id": item[3],
|
||||||
"insert_date": item[4],
|
# "insert_date": item[4],
|
||||||
}
|
# }
|
||||||
for item in cursor.fetchall()
|
# for item in cursor.fetchall()
|
||||||
]
|
# ]
|
||||||
cursor.close()
|
# cursor.close()
|
||||||
db.close()
|
# db.close()
|
||||||
return items
|
# return items
|
||||||
|
|
||||||
# Get List of all files by patient
|
# Get List of all files by patient
|
||||||
@router.get("/files/patients/{patientID}", tags="patients_files")
|
@router.get("/files/patients/{app_id}", tags="patients_files")
|
||||||
async def read_all_files_by_patient(patientID: int, session: SessionContainer = Depends(verify_session())):
|
async def read_all_files_by_patient(app_id: str, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT * FROM patient_files where patient_id = %s ORDER BY insert_date DESC"
|
query = "SELECT * FROM patient_files where app_id = %s ORDER BY insert_date DESC"
|
||||||
cursor.execute(query, (patientID,))
|
cursor.execute(query, (app_id,))
|
||||||
items = [
|
items = [
|
||||||
{
|
{
|
||||||
"idpatient_files": item[0],
|
"idpatient_files": item[0],
|
||||||
"file_path": item[1],
|
"file_path": item[1],
|
||||||
"file_name": item[2],
|
"file_name": item[2],
|
||||||
"patient_id": item[3],
|
"insert_date": item[3],
|
||||||
"insert_date": item[4],
|
"app_id": item[4],
|
||||||
}
|
}
|
||||||
for item in cursor.fetchall()
|
for item in cursor.fetchall()
|
||||||
]
|
]
|
||||||
@@ -62,52 +62,52 @@ async def read_all_files_by_patient(patientID: int, session: SessionContainer =
|
|||||||
db.close()
|
db.close()
|
||||||
return items
|
return items
|
||||||
|
|
||||||
# Get List of all files by patient & DocOffice
|
# # Get List of all files by patient & DocOffice
|
||||||
@router.get("/files/patients-docOffice/", tags="patients_files")
|
# @router.get("/files/patients-docOffice/", tags="patients_files")
|
||||||
async def read_all_files_by_patient(itemRequest: fileRequest, session: SessionContainer = Depends(verify_session())):
|
# async def read_all_files_by_patient(itemRequest: fileRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
db = database.dbConnection.dbConnect()
|
# db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
# cursor = db.cursor()
|
||||||
query = "select patient_files.idpatient_files, patient_files.file_path, patient_files.file_name, patient_files.patient_id, patient_files.insert_date, patients.doc_office_id "
|
# query = "select patient_files.idpatient_files, patient_files.file_path, patient_files.file_name, patient_files.patient_id, patient_files.insert_date, patients.doc_office_id "
|
||||||
query += "from patient_manager.patient_files "
|
# query += "from patient_manager.patient_files "
|
||||||
query += "inner join patient_manager.patients "
|
# query += "inner join patient_manager.patients "
|
||||||
query += "on patient_files.patient_id = patients.idpatients "
|
# query += "on patient_files.patient_id = patients.idpatients "
|
||||||
query += "where patient_files.patient_id = %s and patients.doc_office_id = %s"
|
# query += "where patient_files.patient_id = %s and patients.doc_office_id = %s"
|
||||||
cursor.execute(query, (itemRequest.patientID, itemRequest.DocOfficeID,))
|
# cursor.execute(query, (itemRequest.patientID, itemRequest.DocOfficeID,))
|
||||||
|
|
||||||
items = [
|
# items = [
|
||||||
{
|
# {
|
||||||
"idpatient_files": item[0],
|
# "idpatient_files": item[0],
|
||||||
"file_path": item[1],
|
# "file_path": item[1],
|
||||||
"file_name": item[2],
|
# "file_name": item[2],
|
||||||
"patient_id": item[3],
|
# "patient_id": item[3],
|
||||||
"insert_date": item[4],
|
# "insert_date": item[4],
|
||||||
"doc_office_id": item[5]
|
# "doc_office_id": item[5]
|
||||||
}
|
# }
|
||||||
for item in cursor.fetchall()
|
# for item in cursor.fetchall()
|
||||||
]
|
# ]
|
||||||
cursor.close()
|
# cursor.close()
|
||||||
db.close()
|
# db.close()
|
||||||
return items
|
# return items
|
||||||
|
|
||||||
# Insert Patient note into table
|
# # Insert Patient note into table
|
||||||
@router.post("/files/insert/", tags="patients_notes", status_code=201)
|
# @router.post("/files/insert/", tags="patients_notes", status_code=201)
|
||||||
async def insertPatientFiles(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())):
|
# async def insertPatientFiles(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())):
|
||||||
today = date.today()
|
# today = date.today()
|
||||||
db = database.dbConnection.dbConnect()
|
# db = database.dbConnection.dbConnect()
|
||||||
cursor = db.cursor()
|
# cursor = db.cursor()
|
||||||
query = "insert into patient_files "
|
# query = "insert into patient_files "
|
||||||
query += "(file_path, file_name, patient_id, insert_date) "
|
# query += "(file_path, file_name, patient_id, insert_date) "
|
||||||
query += "values (%s, %s, %s, %s)"
|
# query += "values (%s, %s, %s, %s)"
|
||||||
notetData = (itemRequest.file_path,
|
# notetData = (itemRequest.file_path,
|
||||||
itemRequest.file_name,
|
# itemRequest.file_name,
|
||||||
itemRequest.patient_id,
|
# itemRequest.patient_id,
|
||||||
today)
|
# today)
|
||||||
try:
|
# try:
|
||||||
cursor.execute(query, notetData)
|
# cursor.execute(query, notetData)
|
||||||
except Exception as error:
|
# except Exception as error:
|
||||||
#raise HTTPException(status_code=404, detail="Failed to Create Record")
|
# #raise HTTPException(status_code=404, detail="Failed to Create Record")
|
||||||
return {"message": error}
|
# return {"message": error}
|
||||||
db.commit()
|
# db.commit()
|
||||||
cursor.close()
|
# cursor.close()
|
||||||
db.close()
|
# db.close()
|
||||||
return {"message": "Successfully Created file Record"}
|
# return {"message": "Successfully Created file Record"}
|
||||||
|
|||||||
Reference in New Issue
Block a user