Problems deleting

nursejeff wrote on Wednesday, June 13, 2012:

Hello,

I am having problems deleting items such as medications and scanned in pdf file in documents.

When I try to delete a scanned in item from documents I got this error:

ERROR: query failed: SELECT * FROM form_encounter WHERE document_id = ‘16006’
Error: Unknown column ‘document_id’ in ‘where clause’

When I try to delete medication, a pop up states “delete successful” but the medication remains.

I am using :  OpenEMR v4.1.0 (10) on a Linux server.

Please help.

Jeff Guillory Jr.
NP Health Clinic

nursejeff wrote on Tuesday, June 19, 2012:

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’

The document was note deleted.

Anyone have an idea.  Any help is appreciated.

Jeff Guillory
NP Health Clinic

cerber98 wrote on Tuesday, June 19, 2012:

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.

Just my opinion…
Alex.

nursejeff wrote on Tuesday, June 19, 2012:

Thank you Alex.  You solved my problem, which was that the document was in the wrong chart.

I also understand you opinion about deleting any portion of the chart.

I am wondering however, why and how the query is incorrect.  Is there a setting I missed or installed something in the wrong place?

Jeff

cerber98 wrote on Wednesday, June 20, 2012:

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…

Hope that helps.
Alex.