7 * @link http://www.open-emr.org
8 * @author Ruth Moulton <moulton ruth@muswell.me.uk>
9 * @copyright Copyright (c) 2021 ruth moulton <ruth@muswell.me.uk>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../../globals.php");
15 require_once("$srcdir/api.inc.php");
16 require_once("$srcdir/forms.inc.php");
18 use OpenEMR\Common\Csrf\CsrfUtils
;
20 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
21 CsrfUtils
::csrfNotVerified();
24 if ($encounter == "") {
25 $encounter = date("Ymd");
28 if ($_GET["mode"] == "new") {
29 $newid = formSubmit("form_phq9", $_POST, $_GET["id"], $userauthorized);
30 addForm($encounter, "PHQ-9 Form", $newid, "phq9", $pid, $userauthorized);
31 } elseif ($_GET["mode"] == "update") {
33 "update form_phq9 set pid = ?,
51 $_SESSION["authProvider"],
52 $_SESSION["authUser"],
54 $_POST["interest_score"],
55 $_POST["hopeless_score"],
56 $_POST["sleep_score"],
57 $_POST["fatigue_score"],
58 $_POST["appetite_score"],
59 $_POST["failure_score"],
60 $_POST["focus_score"],
61 $_POST["psychomotor_score"],
62 $_POST["suicide_score"],
69 formHeader("Redirecting....");