5 * display a form's values in the encounter summary page
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)
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);
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") {
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>";
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;
50 if ($count == $cols) {
56 switch (intdiv($phq9_total, 5)) {
58 $exp = $str_score_analysis[0];
61 $exp = $str_score_analysis[5];
64 $exp = $str_score_analysis[10];
67 $exp = $str_score_analysis[15];
70 $exp = $str_score_analysis[20];
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>";