Advertisement
kevinrossen

Patients With Completed Procedure Codes - Open Dental

Jul 8th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.92 KB | None | 0 0
  1. -- List of patients with specific procedure code(s) completed. Provided by Divergent Dental Resources, LLC.
  2. -- Procedure code(s) defined on line 23.
  3. SET
  4.     @FromDate = CURDATE() - INTERVAL 12 MONTH, -- Defaults to previous 12 months. Change start date to define range.
  5.     @ToDate = CURDATE();
  6. SELECT
  7.     CONCAT(p.LName, ', ',p.FName, ' ', p.MiddleI) As Patient,
  8.     p.Email,
  9.     pl.ProcDate,
  10.     pv.Abbr,
  11.     pc.ProcCode,
  12.     pc.AbbrDesc,
  13.     ToothNum,
  14.     pl.ProcFee
  15. FROM patient p
  16. INNER JOIN procedurelog  pl ON p.PatNum = pl.PatNum
  17. INNER JOIN procedurecode pc ON pl.CodeNum = pc.CodeNum
  18. INNER JOIN provider pv ON pl.ProvNum = pv.ProvNum
  19. WHERE
  20.     pl.ProcStatus = 2
  21.     AND pl.ProcDate >= @FromDate
  22.     AND pl.ProcDate <= @ToDate
  23.     AND pc.ProcCode IN ('D6010') -- List desired procedure codes here. Enclose each code with single quotes, separate by comma, and contained within the parentheses. Example: ('D8080','D8090')
  24. ORDER BY
  25.     p.LName,
  26.     p.FName;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement