Hello,
I need help with a script to show how many times an Office Visit type has been used in CPS. We have an encounter type name Chronic Pain Visit and we are needing to know how many times that has been used. Hope that makes sense. Thanks!
select count(*) from document where doctype in (select dtid from doctypes where DESCRIPTION = 'Chronic Pain Visit')
I cant find the dtid for Chronic Pain Visit. Its a custom encounter we created, there is a dtid for Office Visit and i tried using that with description like Chronic Pain Visit and still not getting any results...
Cliff's answer is assuming the Document Type you are using for the encounter is called Chronic Pain Visit. If your encounter is the Office Visit document type, then that query won't work. Unless the Document Type or the Document Summary is unique or there is an obs term that is only set in that encounter, you probably can't get that answer. That being said, if you have auditing turned on and there is a form that is only in this encounter, you might be able to count how many times that form was inserted from the audit related tables.