I went to delete a pdf file that was scanned into the wrong chart, it warned that this action would be logged, I agreed to delete then I got the following error:
ERROR: query failed: SELECT * FROM form_encounter WHERE document_id = ‘11798’
Error: Unknown column ‘document_id’ in ‘where clause’
Well, the query is incorrect. Documents are not referenced in the form_encounter table. They are in the Documents table…
But first, a couple of things. If you scanned a document into a wrong chart, you can move it to another patient’s chart (select it under Documents, then click on Move to Patient and select by patient ID or from a popup window. That’s probably the best way to do it, because most people (including physicians) should not really be deleting documents that have been scanned in. It’s similar to destroying parts of a paper chart…
If you really want to delete it, you can log in as Administrator, go into the database and fit it there, if you feel comfortable doing that. The point is, for legal reasons, only a few people should be able to delete documents, mainly the system administrator.
If it came from somewhere within the program, it’s probably a bug. First of all, form_encounter table doesn’t have a column named document_id (you can see that under Database section of the Administration tab). Second, the query is a Select query, meant to display items (even if the column name were correct), not a Delete query, which could look something like this: DELETE FROM table_name WHERE column=value…