change Db connect and app patient search

This commit is contained in:
2024-08-08 15:19:24 +02:00
parent 6e2b61ecf2
commit 09538be196
6 changed files with 70 additions and 69 deletions

View File

@@ -6,7 +6,7 @@ from pydantic import BaseModel
app = FastAPI() app = FastAPI()
def dbConnect(): def dbPatientManagerConnect():
return mysql.connector.connect( return mysql.connector.connect(
host="mysqldb", host="mysqldb",
user="root", user="root",
@@ -26,7 +26,7 @@ def read_root():
# Get Doctors Office By ID # Get Doctors Office By ID
@app.get("/docOffices/{docOffic_id}") @app.get("/docOffices/{docOffic_id}")
def read_docOfficeByID(docOffic_id: int): def read_docOfficeByID(docOffic_id: int):
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s" query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s"
cursor.execute(query, (docOffic_id,)) cursor.execute(query, (docOffic_id,))
@@ -41,7 +41,7 @@ def read_docOfficeByID(docOffic_id: int):
# Get List of all Doctors Office # Get List of all Doctors Office
@app.get("/docOffices/") @app.get("/docOffices/")
def read_All_DoctorsOffice(): def read_All_DoctorsOffice():
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM doctor_offices" query = "SELECT * FROM doctor_offices"
cursor.execute(query) cursor.execute(query)
@@ -59,7 +59,7 @@ def read_All_DoctorsOffice():
# Get Patient By ID Number # Get Patient By ID Number
@app.get("/patients/{id_no}") @app.get("/patients/{id_no}")
def read_patientByID(id_no: str): def read_patientByID(id_no: str):
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patients WHERE id_no=%s" query = "SELECT * FROM patients WHERE id_no=%s"
cursor.execute(query, (id_no,)) cursor.execute(query, (id_no,))
@@ -83,7 +83,7 @@ def read_patientByID(id_no: str):
# Get List of all patients # Get List of all patients
@app.get("/patients/") @app.get("/patients/")
def read_all_patients(): def read_all_patients():
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patients" query = "SELECT * FROM patients"
cursor.execute(query) cursor.execute(query)
@@ -110,7 +110,7 @@ def read_all_patients():
# Get List of all patients by Doctors Office # Get List of all patients by Doctors Office
@app.get("/docOffice/patients/{docoff_id}") @app.get("/docOffice/patients/{docoff_id}")
def read_all_patientsby(docoff_id: str): def read_all_patientsby(docoff_id: str):
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patients where doc_office_id=%s" query = "SELECT * FROM patients where doc_office_id=%s"
cursor.execute(query, (docoff_id,)) cursor.execute(query, (docoff_id,))
@@ -137,7 +137,7 @@ def read_all_patientsby(docoff_id: str):
# Get List of all files # Get List of all files
@app.get("/patients/files/") @app.get("/patients/files/")
def read_all_files(): def read_all_files():
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patient_files" query = "SELECT * FROM patient_files"
cursor.execute(query) cursor.execute(query)
@@ -158,7 +158,7 @@ def read_all_files():
# Get List of all files by patient # Get List of all files by patient
@app.get("/patients/files/{patientID}") @app.get("/patients/files/{patientID}")
def read_all_files_by_patient(patientID: int): def read_all_files_by_patient(patientID: int):
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patient_files where patient_id = %s" query = "SELECT * FROM patient_files where patient_id = %s"
cursor.execute(query, (patientID,)) cursor.execute(query, (patientID,))
@@ -179,7 +179,7 @@ def read_all_files_by_patient(patientID: int):
# Get List of all notes # Get List of all notes
@app.get("/patients/notes/") @app.get("/patients/notes/")
def read_all_notes(): def read_all_notes():
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patient_notes" query = "SELECT * FROM patient_notes"
cursor.execute(query) cursor.execute(query)
@@ -199,7 +199,7 @@ def read_all_notes():
# Get List of all notes by patient # Get List of all notes by patient
@app.get("/patients/notes/{patientID}") @app.get("/patients/notes/{patientID}")
def read_all_patientsby(patientID: int): def read_all_patientsby(patientID: int):
db = dbConnect() db = dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patient_notes where patient_id = %s" query = "SELECT * FROM patient_notes where patient_id = %s"
cursor.execute(query, (patientID,)) cursor.execute(query, (patientID,))

View File

@@ -1,6 +1,6 @@
import mysql.connector import mysql.connector
def dbConnect(): def dbPatientManagerConnect():
return mysql.connector.connect( return mysql.connector.connect(
host="mysqldb", host="mysqldb",
user="root", user="root",

View File

@@ -14,7 +14,7 @@ router = APIRouter()
# Get Doctors Office By ID # Get Doctors Office By ID
@router.get("/docOffices/{docOffic_id}", tags=["Doctor Office"]) @router.get("/docOffices/{docOffic_id}", tags=["Doctor Office"])
async def read_docOffice_By_ID(docOffic_id: int, session: SessionContainer = Depends(verify_session())): async def read_docOffice_By_ID(docOffic_id: int, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s" query = "SELECT * FROM doctor_offices WHERE iddoctor_offices=%s"
cursor.execute(query, (docOffic_id,)) cursor.execute(query, (docOffic_id,))
@@ -29,7 +29,7 @@ async def read_docOffice_By_ID(docOffic_id: int, session: SessionContainer = Dep
# Get Doctors Office By user # Get Doctors Office By user
@router.get("/docOffices/user/{user}", tags=["Doctor Office"]) @router.get("/docOffices/user/{user}", tags=["Doctor Office"])
async def read_docOffice_By_ID(user: str, session: SessionContainer = Depends(verify_session())): async def read_docOffice_By_ID(user: str, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM users WHERE email=%s" query = "SELECT * FROM users WHERE email=%s"
cursor.execute(query, (user,)) cursor.execute(query, (user,))
@@ -50,7 +50,7 @@ async def read_docOffice_By_ID(user: str, session: SessionContainer = Depends(ve
# Get List of all Doctors Office # Get List of all Doctors Office
@router.get("/docOffices/", tags=["Doctor Office"]) @router.get("/docOffices/", tags=["Doctor Office"])
async def read_All_Doctors_Office(session: SessionContainer = Depends(verify_session())): async def read_All_Doctors_Office(session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM doctor_offices" query = "SELECT * FROM doctor_offices"
cursor.execute(query) cursor.execute(query)

View File

@@ -44,11 +44,12 @@ class patientDeleteRequest(BaseModel):
app_id: str app_id: str
# # Get Patient By ID Number # # Get Patient By ID Number
# @router.get("/patients/id/{pat_id}", tags="patients") # @router.get("/patients/search/{search}", tags=["Patients"])
# async def read_patientByID(pat_id: str, session: SessionContainer = Depends(verify_session())): # async def read_patientByID(search: str): #, session: SessionContainer = Depends(verify_session())
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "SELECT * FROM patients WHERE idpatients=%s" # query = "SELECT * FROM patients WHERE idpatients like %%%s%%" % search
# #return {"query": query}
# cursor.execute(query, (pat_id,)) # cursor.execute(query, (pat_id,))
# item = cursor.fetchone() # item = cursor.fetchone()
# cursor.close() # cursor.close()
@@ -71,7 +72,7 @@ class patientDeleteRequest(BaseModel):
# Get Patient By app ID # Get Patient By app ID
@router.get("/patients/{app_id}", tags=["Patients"]) @router.get("/patients/{app_id}", tags=["Patients"])
async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depends(verify_session())): async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patients WHERE app_id=%s" query = "SELECT * FROM patients WHERE app_id=%s"
cursor.execute(query, (app_id,)) cursor.execute(query, (app_id,))
@@ -98,7 +99,7 @@ async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depend
# # Get Patient By ID Number # # Get Patient By ID Number
# @router.get("/patients/email/{email}", tags="patients") # @router.get("/patients/email/{email}", tags="patients")
# async def read_patientByID(email: str, session: SessionContainer = Depends(verify_session())): # async def read_patientByID(email: str, session: SessionContainer = Depends(verify_session())):
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "SELECT * FROM patients WHERE lower(email)=%s" # query = "SELECT * FROM patients WHERE lower(email)=%s"
# cursor.execute(query, (email.lower(),)) # cursor.execute(query, (email.lower(),))
@@ -122,44 +123,44 @@ async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depend
# "medical_aid_code": item[12],} # "medical_aid_code": item[12],}
# # Get List of all patients # Get List of all patients
# @router.get("/patients/user/{email}", tags="patients") @router.get("/patients/search/{search}", tags=["Patients"])
# async def read_all_patientsByUser(email: str, session: SessionContainer = Depends(verify_session())): async def read_all_patientsByUser(search: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
# db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() cursor = db.cursor()
# #query = "SELECT * FROM patients" #query = "SELECT * FROM patients"
# query = "Select * from patients " query = "Select * from patients "
# query += "inner join users " query += "where id_no like '%%%s%%' " % search
# query += "on doc_office_id = docOffice_id " query += "or medical_aid_no like '%%%s%%'" % search
# query += "where lower(users.email)= %s" # return {"query": query}
# cursor.execute(query, (email.lower(),)) cursor.execute(query)
# items = [ items = [
# { {
# "idpatients": item[0], "idpatients": item[0],
# "id_no": item[1], "id_no": item[1],
# "first_name": item[2], "first_name": item[2],
# "last_name": item[3], "last_name": item[3],
# "email": item[4], "email": item[4],
# "cell_no": item[5], "cell_no": item[5],
# "medical_aid": item[11], "medical_aid": item[10],
# "medical_aid_name": item[6], "medical_aid_name": item[6],
# "medical_aid_no": item[7], "medical_aid_no": item[7],
# "medical_aid_main_member": item[12], "medical_aid_main_member": item[11],
# "medical_aid_code": item[13], "medical_aid_code": item[12],
# "medical_aid_scheme": item[8], "medical_aid_scheme": item[8],
# "address": item[9], "address": item[9],
# "doc_office_id": item[10] "app_id": item[13],
# } }
# 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 patients # # Get List of all patients
# @router.get("/patients/", tags="patients") # @router.get("/patients/", tags="patients")
# async def read_all_patients(session: SessionContainer = Depends(verify_session())): # async def read_all_patients(session: SessionContainer = Depends(verify_session())):
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "SELECT * FROM patients" # query = "SELECT * FROM patients"
# cursor.execute(query) # cursor.execute(query)
@@ -186,7 +187,7 @@ async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depend
# # Get List of all patients by Doctors Office # # Get List of all patients by Doctors Office
# @router.get("/patients/docOffice/{docoff_id}", tags="patients") # @router.get("/patients/docOffice/{docoff_id}", tags="patients")
# async def read_all_patientsby(docoff_id: str, session: SessionContainer = Depends(verify_session())): # async def read_all_patientsby(docoff_id: str, session: SessionContainer = Depends(verify_session())):
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "SELECT * FROM patients where doc_office_id=%s" # query = "SELECT * FROM patients where doc_office_id=%s"
# cursor.execute(query, (docoff_id,)) # cursor.execute(query, (docoff_id,))
@@ -213,7 +214,7 @@ async def read_patient_By_app_ID(app_id: str, session: SessionContainer = Depend
# Insert Patient into table # Insert Patient into table
@router.post("/patients/insert/", tags=["Patients"], status_code=201) @router.post("/patients/insert/", tags=["Patients"], status_code=201)
async def insert_Patient(itemRequest : patientInsertRequest, session: SessionContainer = Depends(verify_session())): async def insert_Patient(itemRequest : patientInsertRequest, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "insert into patients " query = "insert into patients "
query += "(id_no, first_name, last_name, email, cell_no, medical_aid, " query += "(id_no, first_name, last_name, email, cell_no, medical_aid, "
@@ -246,7 +247,7 @@ async def insert_Patient(itemRequest : patientInsertRequest, session: SessionCon
# Update Patient on table # Update Patient on table
@router.put("/patients/update/", tags=["Patients"]) @router.put("/patients/update/", tags=["Patients"])
async def Update_Patient(itemRequest : patientUpdateRequest, session: SessionContainer = Depends(verify_session())): async def Update_Patient(itemRequest : patientUpdateRequest, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "update patients " query = "update patients "
query += "set id_no=%s, first_name=%s, last_name=%s, email=%s, cell_no=%s, medical_aid=%s, " query += "set id_no=%s, first_name=%s, last_name=%s, email=%s, cell_no=%s, medical_aid=%s, "
@@ -280,7 +281,7 @@ async def Update_Patient(itemRequest : patientUpdateRequest, session: SessionCon
# delete Patient on table # delete Patient on table
@router.delete("/patients/delete/", tags=["Patients"]) @router.delete("/patients/delete/", tags=["Patients"])
async def Delete_Patient(itemRequest : patientDeleteRequest, session: SessionContainer = Depends(verify_session())): async def Delete_Patient(itemRequest : patientDeleteRequest, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "delete from patients " query = "delete from patients "
query += "where app_id=%s" query += "where app_id=%s"

View File

@@ -22,7 +22,7 @@ class fileInsertRequest(BaseModel):
# # 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.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "SELECT * FROM patient_files" # query = "SELECT * FROM patient_files"
# cursor.execute(query) # cursor.execute(query)
@@ -43,7 +43,7 @@ class fileInsertRequest(BaseModel):
# Get List of all files by patient # Get List of all files by patient
@router.get("/files/patients/{app_id}", tags=["Patients Files"]) @router.get("/files/patients/{app_id}", tags=["Patients Files"])
async def read_all_patient_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): async def read_all_patient_files_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patient_files where app_id = %s ORDER BY insert_date DESC" query = "SELECT * FROM patient_files where app_id = %s ORDER BY insert_date DESC"
cursor.execute(query, (app_id,)) cursor.execute(query, (app_id,))
@@ -64,7 +64,7 @@ async def read_all_patient_files_by_app_id(app_id: str, session: SessionContaine
# # 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.dbPatientManagerConnect()
# 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 "
@@ -92,7 +92,7 @@ async def read_all_patient_files_by_app_id(app_id: str, session: SessionContaine
@router.delete("/files/delete/", tags=["Patients Files"]) @router.delete("/files/delete/", tags=["Patients Files"])
async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionContainer = Depends(verify_session())): #session: SessionContainer = Depends(verify_session()) async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionContainer = Depends(verify_session())): #session: SessionContainer = Depends(verify_session())
# today = date.today() # today = date.today()
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "delete from patient_files " query = "delete from patient_files "
query += "where idpatient_files=%s" query += "where idpatient_files=%s"
@@ -111,7 +111,7 @@ async def Delete_Patient_File(itemRequest : fileDeleteRequest, session: SessionC
@router.post("/files/insert/", tags=["Patients Files"], status_code=201) @router.post("/files/insert/", tags=["Patients Files"], status_code=201)
async def insert_Patient_Files(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())): async def insert_Patient_Files(itemRequest : fileInsertRequest, session: SessionContainer = Depends(verify_session())):
today = date.today() today = date.today()
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "insert into patient_files " query = "insert into patient_files "
query += "(file_path, file_name, insert_date, app_id) " query += "(file_path, file_name, insert_date, app_id) "

View File

@@ -28,7 +28,7 @@ class patientNoteUpdateRequest(BaseModel):
# Get List of all notes # Get List of all notes
# @router.get("/notes/patients/", tags="patients_notes") # @router.get("/notes/patients/", tags="patients_notes")
# async def read_all_notes(session: SessionContainer = Depends(verify_session())): # async def read_all_notes(session: SessionContainer = Depends(verify_session())):
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "SELECT * FROM patient_notes" # query = "SELECT * FROM patient_notes"
# cursor.execute(query) # cursor.execute(query)
@@ -48,7 +48,7 @@ class patientNoteUpdateRequest(BaseModel):
# Get List of all notes by patient # Get List of all notes by patient
@router.get("/notes/patients/{app_id}", tags=["Patients Notes"]) @router.get("/notes/patients/{app_id}", tags=["Patients Notes"])
async def read_all_patient_notes_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): async def read_all_patient_notes_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())):
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "SELECT * FROM patient_notes where app_id = %s ORDER BY insert_date DESC" query = "SELECT * FROM patient_notes where app_id = %s ORDER BY insert_date DESC"
cursor.execute(query, (app_id,)) cursor.execute(query, (app_id,))
@@ -69,7 +69,7 @@ async def read_all_patient_notes_by_app_id(app_id: str, session: SessionContaine
# Get List of all notes by patient # Get List of all notes by patient
# @router.get("/notes/patients-docOffice/", tags="patients_notes") # @router.get("/notes/patients-docOffice/", tags="patients_notes")
# async def read_all_patientsby(itemRequest: noteRequest, session: SessionContainer = Depends(verify_session())): # async def read_all_patientsby(itemRequest: noteRequest, session: SessionContainer = Depends(verify_session())):
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "select patient_notes.idpatient_notes, patient_notes.note_name, patient_notes.note_text, patient_notes.patient_id, patient_notes.insert_date, patients.doc_office_id " # query = "select patient_notes.idpatient_notes, patient_notes.note_name, patient_notes.note_text, patient_notes.patient_id, patient_notes.insert_date, patients.doc_office_id "
# query += "from patient_manager.patient_notes " # query += "from patient_manager.patient_notes "
@@ -94,7 +94,7 @@ async def read_all_patient_notes_by_app_id(app_id: str, session: SessionContaine
@router.post("/notes/insert/", tags=["Patients Notes"], status_code=201) @router.post("/notes/insert/", tags=["Patients Notes"], status_code=201)
async def insert_Patient_Note(itemRequest : patientNoteInsertRequest, session: SessionContainer = Depends(verify_session())): async def insert_Patient_Note(itemRequest : patientNoteInsertRequest, session: SessionContainer = Depends(verify_session())):
today = date.today() today = date.today()
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "insert into patient_notes " query = "insert into patient_notes "
query += "(note_name, note_text, insert_date, app_id) " query += "(note_name, note_text, insert_date, app_id) "
@@ -118,7 +118,7 @@ async def insert_Patient_Note(itemRequest : patientNoteInsertRequest, session: S
@router.delete("/notes/delete/", tags=["Patients Notes"]) @router.delete("/notes/delete/", tags=["Patients Notes"])
async def Delete_Patient_note(itemRequest : noteDeleteRequest, session: SessionContainer = Depends(verify_session()) ): #session: SessionContainer = Depends(verify_session()) async def Delete_Patient_note(itemRequest : noteDeleteRequest, session: SessionContainer = Depends(verify_session()) ): #session: SessionContainer = Depends(verify_session())
# today = date.today() # today = date.today()
db = database.dbConnection.dbConnect() db = database.dbConnection.dbPatientManagerConnect()
cursor = db.cursor() cursor = db.cursor()
query = "delete from patient_notes " query = "delete from patient_notes "
query += "where idpatient_notes=%s" query += "where idpatient_notes=%s"
@@ -137,7 +137,7 @@ async def Delete_Patient_note(itemRequest : noteDeleteRequest, session: SessionC
# @router.put("/notes/update/", tags="patients_notes") # @router.put("/notes/update/", tags="patients_notes")
# async def UpdatePatient(itemRequest : patientNoteUpdateRequest, session: SessionContainer = Depends(verify_session())): # async def UpdatePatient(itemRequest : patientNoteUpdateRequest, session: SessionContainer = Depends(verify_session())):
# today = date.today() # today = date.today()
# db = database.dbConnection.dbConnect() # db = database.dbConnection.dbPatientManagerConnect()
# cursor = db.cursor() # cursor = db.cursor()
# query = "update patient_notes " # query = "update patient_notes "
# query += "set note_name=%s, note_text=%s, patient_id=%s, insert_date=%s " # query += "set note_name=%s, note_text=%s, patient_id=%s, insert_date=%s "