From b4278e7b3b3edc7a717640cce2ef19ad1f813409 Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Mon, 18 Jul 2005 21:49:05 +0000 Subject: [PATCH] added ability to select related issues --- interface/forms/newpatient/new.php | 304 +++++++++++++++++++------------- interface/forms/newpatient/save.php | 132 +++++++------- interface/forms/newpatient/view.php | 337 ++++++++++++++++++++++-------------- 3 files changed, 458 insertions(+), 315 deletions(-) rewrite interface/forms/newpatient/new.php (86%) rewrite interface/forms/newpatient/save.php (71%) rewrite interface/forms/newpatient/view.php (86%) diff --git a/interface/forms/newpatient/new.php b/interface/forms/newpatient/new.php dissimilarity index 86% index a4ec93f1d..4ebba9526 100644 --- a/interface/forms/newpatient/new.php +++ b/interface/forms/newpatient/new.php @@ -1,121 +1,183 @@ - - - - - - -New Encounter - - - topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0 onload="javascript:document.new_encounter.reason.focus();"> - -
- -New Encounter Form -
- - - - - - - - - - - - - - -
Chief Complaint:
Date Of Service: - -
Date of onset or hospitalization: - -
- -[Save] -                     - -" class="link">[Don't Save] - - -
- - - + + + + + + +New Encounter + + + + + topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0' + marginwidth='2' marginheight='0' onload="javascript:document.new_encounter.reason.focus();"> + +
+ +New Encounter Form +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Chief Complaint: + Issues (Problems, Medications, Surgeries, Allergies): +
+ + + +
Facility: + +
Date of Service: + + + +
Onset/hospitalization date: + + + +
+ +

+[Save] + +    +" class="link_submit">[Don't Save] + +    +[Add Issue] + +

+ +
+ + + diff --git a/interface/forms/newpatient/save.php b/interface/forms/newpatient/save.php dissimilarity index 71% index eb06cdf6a..2d19b8535 100644 --- a/interface/forms/newpatient/save.php +++ b/interface/forms/newpatient/save.php @@ -1,62 +1,70 @@ - $var) { - $_POST[$k] = mysql_escape_string($var); - echo "$var\n"; -} - -//if ($encounter == "") { - //$encounter = date("Ymd"); - $conn = $GLOBALS['adodb']['db']; - $encounter = $conn->GenID("sequences"); - setEncounter( $encounter ); -//} - -$date = $_POST["year"]."-".$_POST["month"]."-".$_POST["day"]; -$onset_date = $_POST["onset_year"]."-".$_POST["onset_month"]."-".$_POST["onset_day"]; - -if ($mode == 'new') { - -addForm($encounter, "New Patient Encounter", - idSqlStatement("insert into form_encounter set " . - "date = '$date', " . - "onset_date = '$onset_date', " . - "reason = '$reason', " . - "facility = '$facility', " . - "pid = '$pid', " . - "encounter = '$encounter'"), - "newpatient", $pid, $userauthorized, $date); - -} else if ($mode == 'update') { - - // See view.php to allow or disallow updates of the encounter date. - $datepart = $_POST["day"] ? "date = '$date', " : ""; - $id = $_POST["id"]; - sqlStatement("update form_encounter set " . - $datepart . - "onset_date = '$onset_date', " . - "reason = '$reason', " . - "facility = '$facility' " . - "where id = '$id'"); - -} - -$_SESSION["encounter"] = $encounter; -?> - - - - - - - - + $var) { + if (! is_array($var)) + $_POST[$k] = mysql_escape_string($var); + echo "$var\n"; +} + +$conn = $GLOBALS['adodb']['db']; + +$date = $_POST["year"]."-".$_POST["month"]."-".$_POST["day"]; +$onset_date = $_POST["onset_year"]."-".$_POST["onset_month"]."-".$_POST["onset_day"]; + +if ($mode == 'new') +{ + $encounter = $conn->GenID("sequences"); + addForm($encounter, "New Patient Encounter", + idSqlStatement("INSERT INTO form_encounter SET " . + "date = '$date', " . + "onset_date = '$onset_date', " . + "reason = '$reason', " . + "facility = '$facility', " . + "pid = '$pid', " . + "encounter = '$encounter'"), + "newpatient", $pid, $userauthorized, $date); +} +else if ($mode == 'update') +{ + $id = $_REQUEST['id']; + $result = sqlQuery("SELECT encounter FROM form_encounter WHERE id = '$id'"); + $encounter = $result['encounter']; + // See view.php to allow or disallow updates of the encounter date. + $datepart = $_POST["day"] ? "date = '$date', " : ""; + $id = $_POST["id"]; + sqlStatement("update form_encounter set " . + $datepart . + "onset_date = '$onset_date', " . + "reason = '$reason', " . + "facility = '$facility' " . + "where id = '$id'"); +} + +setencounter($encounter); + +// Update the list of issues associated with this encounter. +sqlStatement("DELETE FROM issue_encounter WHERE " . + "pid = '$pid' AND encounter = '$encounter'"); +if (is_array($_POST['issues'])) { + foreach ($_POST['issues'] as $issue) { + $query = "INSERT INTO issue_encounter ( " . + "pid, list_id, encounter " . + ") VALUES ( " . + "'$pid', '$issue', '$encounter'" . + ")"; + sqlStatement($query); + } +} +?> + + + + + + diff --git a/interface/forms/newpatient/view.php b/interface/forms/newpatient/view.php dissimilarity index 86% index 57a0faf3b..4f8dbca87 100644 --- a/interface/forms/newpatient/view.php +++ b/interface/forms/newpatient/view.php @@ -1,132 +1,205 @@ - - - - - - -Patient Encounter - - - topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> - -
- - -Patient Encounter Form -
- - - - - - - - - - - - - - -
Chief Complaint:
-
Date Of Service: - -
Date of onset or hospitalization: - -
- -[Save] -                     -" class="link" target=Main>[Don't Save Changes] - -
- - - + + + + + + +Patient Encounter + + + + + topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0' + marginwidth='2' marginheight='0'> + +
+ + +Patient Encounter Form +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Chief Complaint: + Issues (Problems, Medications, Surgeries, Allergies): +
+ + + +
Facility: + +
Date of Service: + + + +
Onset/hospitalization date: + + + +
+ +

+[Save] +    +" class="link_submit" target='Main'>[Cancel] +    +[Add Issue] + +

+ +
+ + + -- 2.11.4.GIT