fix: Update patient_tracker.php (#6595)
[openemr.git] / interface / forms / phq9 / report.php
bloba8e5908248ab46aeb5ad814140c45fe09111107c
1 <?php
3 /**
4 * PHQ-9 report.php
5 * display a form's values in the encounter summary page
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Ruth Moulton <moulton ruth@muswell.me.uk>
10 * @copyright Copyright (c) 2021 ruth moulton <ruth@muswell.me.uk>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once(dirname(__FILE__) . '/../../../library/api.inc.php');
18 function phq9_report($pid, $encounter, $cols, $id)
20 $count = 0;
21 $phq9_total = 0;
22 $value = 0;
24 $str_values = [0 => xl('Not at all') . ' (0)',1 => xl('Several days') . ' (1)',2 => xl('More than half of days') . ' (2)',3 => xl('Nearly every day') . ' (3)'];
26 $str_difficulty_values = [0 => xl('Not at all') . ' (0)',1 => xl('Somewhat difficult') . ' (1)', 2 => xl('Very difficult') . ' (2)', 3 => xl('Extremely difficult') . ' (3)', 'undef' => xl('not answered')];
28 $str_issues = ["interest_score" => xl('Loss of Interest'),"hopeless_score" => xl('Feeling Hopeless'),"sleep_score" => xl('Sleep Disturbance'),"fatigue_score" => xl('Fatigue'),"appetite_score" => xl('Change in Appetite'),"failure_score" => xl('Feel like a Falure'),"focus_score" => xl('Poor Focus'),"psychomotor_score" => xl('Psychomotor Retardation'),"suicide_score" => xl('Suicidal Thoughts'),"difficulty" => xl('Difficulty working etc.'),"total" => xl('Total PHQ-9 score')];
30 $str_score_analysis = [0 => xl('No depressive disorder'), 5 => xl('Mild Depression'), 10 => xl('Moderate Depression'), 15 => xl('Moderately Severe Depression'), 20 => xl('Severe Depression'), 25 => xl('Severe Depression')];
32 $data = formFetch("form_phq9", $id);
34 if ($data) {
35 print "<table><tr>";
36 foreach ($data as $key => $value) {
37 // include scores_array and total for backward compatibility
38 if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $key == "scores_array" || $key == "total" || $value == "0000-00-00 00:00:00") {
39 continue;
41 if ($key == "difficulty") {
42 print "<td><span class=bold>" . text($str_issues[$key]) . ": </span><span class=text>" . text($str_difficulty_values[$value]) . "</span></td>";
43 } else {
44 print "<td><span class=bold>" . text($str_issues[$key]) . ": </span><span class=text>" . text($str_values[$value]) . "</span></td>";
45 if (is_numeric($value)) {
46 $phq9_total += $value;
49 $count++;
50 if ($count == $cols) {
51 $count = 0;
52 print "</tr><tr>\n";
55 // print the total
56 switch (intdiv($phq9_total, 5)) {
57 case 0:
58 $exp = $str_score_analysis[0];
59 break;
60 case 1:
61 $exp = $str_score_analysis[5];
62 break;
63 case 2:
64 $exp = $str_score_analysis[10];
65 break;
66 case 3:
67 $exp = $str_score_analysis[15];
68 break;
69 case 4:
70 $exp = $str_score_analysis[20];
71 break;
72 default:
73 $exp = $str_score_analysis[20];
76 print "<td><span class=bold>" . text($str_issues["total"]) . ": </span><span class=text>" . text($phq9_total) . " - " . text($exp) . "</span></td>";
79 print "</tr></table>";