forked from yaso_meth/mih-project
Add api to delete note
This commit is contained in:
@@ -11,9 +11,8 @@ from fastapi import Depends
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
class noteRequest(BaseModel):
|
||||
DocOfficeID: int
|
||||
patientID: int
|
||||
class noteDeleteRequest(BaseModel):
|
||||
idpatient_notes: int
|
||||
|
||||
class patientNoteInsertRequest(BaseModel):
|
||||
note_name: str
|
||||
@@ -115,6 +114,25 @@ async def insert_Patient_Note(itemRequest : patientNoteInsertRequest, session: S
|
||||
db.close()
|
||||
return {"message": "Successfully Created Record"}
|
||||
|
||||
# Update Patient note on table
|
||||
@router.delete("/notes/delete/", tags=["Patients Notes"])
|
||||
async def Delete_Patient_note(itemRequest : noteDeleteRequest ): #session: SessionContainer = Depends(verify_session())
|
||||
# today = date.today()
|
||||
db = database.dbConnection.dbConnect()
|
||||
cursor = db.cursor()
|
||||
query = "delete from patient_notes "
|
||||
query += "where idpatient_notes=%s"
|
||||
# notetData = (itemRequest.idpatient_notes)
|
||||
try:
|
||||
cursor.execute(query, (str(itemRequest.idpatient_notes),))
|
||||
except Exception as error:
|
||||
raise HTTPException(status_code=404, detail="Failed to Delete Record")
|
||||
#return {"query": query, "message": error}
|
||||
db.commit()
|
||||
cursor.close()
|
||||
db.close()
|
||||
return {"message": "Successfully deleted Record"}
|
||||
|
||||
# Update Patient note on table
|
||||
# @router.put("/notes/update/", tags="patients_notes")
|
||||
# async def UpdatePatient(itemRequest : patientNoteUpdateRequest, session: SessionContainer = Depends(verify_session())):
|
||||
|
||||
Reference in New Issue
Block a user