From 11b55dcfa9b30d3140f5aca5305166db40018573 Mon Sep 17 00:00:00 2001 From: sunsetsystems Date: Sun, 3 Jul 2005 07:18:03 +0000 Subject: [PATCH] new and improved history data --- interface/patient_file/history/history.inc.php | 50 +++++ interface/patient_file/history/history.php | 219 ++++++++---------- interface/patient_file/history/history_full.php | 284 +++++++++++------------- interface/patient_file/history/history_save.php | 22 +- library/patient.inc | 8 +- sql/2_7_2-to-2_7_3_upgrade.sql | 22 ++ sql/database.sql | 26 ++- 7 files changed, 346 insertions(+), 285 deletions(-) create mode 100644 interface/patient_file/history/history.inc.php rewrite interface/patient_file/history/history.php (92%) rewrite interface/patient_file/history/history_full.php (97%) diff --git a/interface/patient_file/history/history.inc.php b/interface/patient_file/history/history.inc.php new file mode 100644 index 000000000..e44ca9a8d --- /dev/null +++ b/interface/patient_file/history/history.inc.php @@ -0,0 +1,50 @@ + + // + // This program is free software; you can redistribute it and/or + // modify it under the terms of the GNU General Public License + // as published by the Free Software Foundation; either version 2 + // of the License, or (at your option) any later version. + + // This describes information stored in the history_data table. + + // Exams: database name and descriptive name, in order of on-screen + // presentation, and with the exam results index for last_exam_results: + // + if ($GLOBALS['athletic_team']) { + $exams = array( + "last_cardiac_echo" => '08 Cardiac Echo', + "last_ecg" => '07 ECG', + "last_physical_exam" => '05 Physical Exam', + "last_breast_exam" => '00 Breast Exam', + "last_mammogram" => '01 Mammogram' + ); + } else { + $exams = array( + "last_breast_exam" => '00 Breast Exam', + "last_cardiac_echo" => '08 Cardiac Echo', + "last_ecg" => '07 ECG', + "last_gynocological_exam" => '02 Gynecological Exam', + "last_mammogram" => '01 Mammogram', + "last_physical_exam" => '05 Physical Exam', + "last_prostate_exam" => '04 Prostate Exam', + "last_rectal_exam" => '03 Rectal Exam', + "last_sigmoidoscopy_colonoscopy" => '06 Sigmoid/Colonoscopy' + ); + } + + // Deprecated surgery date items that should be shown only if there + // is data, and which should be moved to the lists table: + // + $obsoletes = array( + 'cataract_surgery' => 'Cataract Surgery', + 'tonsillectomy' => 'Tonsillectomy', + 'appendectomy' => 'Appendectomy', + 'cholecystestomy' => 'Cholecystestomy', + 'heart_surgery' => 'Heart Surgery', + 'hysterectomy' => 'Hysterectomy', + 'hernia_repair' => 'Hernia Repair', + 'hip_replacement' => 'Hip Replacement', + 'knee_replacement' => 'Knee Replacement' + ); +?> diff --git a/interface/patient_file/history/history.php b/interface/patient_file/history/history.php dissimilarity index 92% index 685aeae95..7b772476e 100644 --- a/interface/patient_file/history/history.php +++ b/interface/patient_file/history/history.php @@ -1,122 +1,97 @@ - - - - - - - - - - - topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> - - - -Patient History / Lifestyle
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-Family History:
-Father:
-Mother:
-Siblings:
-Spouse:
-Offspring:
-
-Surgeries:
-Cataract Surgery:
-Tonsillectomy:
-Appendectomy:
-Cholecystestomy:
-Heart Surgery:
-Hysterectomy:
-Hernia Repair:
-Hip Replacement:
-Knee Replacement:
-
-Lifestyle:
-Coffee:
-Tobacco:
-Alcohol:
-Sleep Patterns:
-Exercise Patterns:
-Seatbelt Use:
-Counseling:
-Hazardous Activities:
- - - - -
-Relatives:
-Cancer:
-Tuberculosis:
-Diabetes:
-High Blood Pressure:
-Heart Problems:
-Stroke:
-Epilepsy:
-Mental Illness:
-Suicide:
- - -
-Date of Last:
-Breast Exam:
-Mammogram:
-Gynocological Exam:
-Rectal Exam:
-Prostate Exam:
-Physical Exam:
-Sigmoidoscopy/Colonoscopy:
- -
-:
-:
-
-
-
- - - - - - - - + + + + + + topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> + + + +Patient History / Lifestyle
+ + + + + + + + + + + + + + + + + + + +
+ Family History:
+ Father:
+ Mother:
+ Siblings:
+ Spouse:
+ Offspring:
+
+ Relatives:
+ Cancer:
+ Tuberculosis:
+ Diabetes:
+ High Blood Pressure:
+ Heart Problems:
+ Stroke:
+ Epilepsy:
+ Mental Illness:
+ Suicide:
+
+ Lifestyle:
+ Coffee:
+ Tobacco:
+ Alcohol:
+ Sleep Patterns:
+ Exercise Patterns:
+ Seatbelt Use:
+ Counseling:
+ Hazardous Activities:
+
 
+ Date of Last: + $value) { + if ($result[$key]) { + $testresult = substr($result['last_exam_results'], substr($value, 0, 2), 1); + echo "
"; + if ($testresult == '2') echo ""; + echo substr($value, 3) . ": " . $result[$key]; + if ($testresult == '2') echo " (abn)"; + echo "\n"; + } + } + + foreach ($obsoletes as $key => $value) { + if ($result[$key] && $result[$key] != '0000-00-00 00:00:00') { + echo "
$value: " . substr($result[$key], 0, 10) . "\n"; + } + } +?> +
+ Additional History:
+ :
+ :
+ +
+
+ + + diff --git a/interface/patient_file/history/history_full.php b/interface/patient_file/history/history_full.php dissimilarity index 97% index 4259ac4fc..9841621b1 100644 --- a/interface/patient_file/history/history_full.php +++ b/interface/patient_file/history/history_full.php @@ -1,149 +1,135 @@ - - - - - - - - - - - topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> - - - - -
- - - -Patient History / Lifestyle
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
Family History:
Father:">
Mother:">
Siblings:">
Spouse:">
Offspring:">
-
- - - - - - - - - - - - - -
Relatives:
Cancer:">
Tuberculosis:">
Diabetes:">
High Blood Pressure:">
Heart Problems: ">
Stroke:">
Epilepsy:">
Mental Illness:">
Suicide:">
-
- - - - - - - - - - -
Lifestyle:
Coffee:">
Tobacco:">
Alcohol:">
Sleep Patterns:">
Exercise Patterns:">
Seatbelt Use:">
Counseling:">
Hazardous Activities:">
-
- -
- - - - - - - - -
Date of Last:
Cataract Surgery:">
Tonsillectomy:">
Appendectomy:">
Cholecystestomy:">
Heart Surgery:">
Hysterectomy:">
-
- - - - - - - - -
Date of Last:
Hernia Repair:">
Hip Replacement:">
Knee Replacement:">
Breast Exam:">
Mammogram:">
-
- - - - - - - -
Date of Last:
Gynocological Exam:">
Rectal Exam:">
Prostate Exam:">
Physical Exam:">
Sigmoidoscopy/Colonoscopy:">
-
- - - - -
Additional History:
">:">
">:">

- -
-[Save Patient History] - -
- - - - + + + + + + topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0' marginwidth='2' marginheight='0'> + + + +
+ + +Patient History / Lifestyle
+ + + + + + + + + +
+ + + + + + + +
Family History:
Father">
Mother">
Siblings">
Spouse">
Offspring ">
+
+ + + + + + + + + + + +
Relatives:
Cancer">
Tuberculosis">
Diabetes">
High Blood Pressure ">
Heart Problems">
Stroke">
Epilepsy">
Mental Illness">
Suicide">
+
+ + + + + + + + + + +
Lifestyle:
Coffee">
Tobacco">
Alcohol">
Sleep Patterns">
Exercise Patterns">
Seatbelt Use">
Counseling">
Hazardous Activities ">
+
+
+ + + + + + +
+ + + + + + + $value) { + $testresult = substr($result['last_exam_results'], substr($value, 0, 2), 1); + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + + $needwarning = false; + foreach ($obsoletes as $key => $value) { + if ($result[$key] && $result[$key] != '0000-00-00 00:00:00') { + $needwarning = true; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + } + if ($needwarning) { + echo " \n"; + echo " \n"; + echo " \n"; + } +?> +
Date/Notes of Last:Nor Abn
" . substr($value, 3) . "  
$value  **
** Please move surgeries to Issues!
+
+ + + + +
Additional History:
">:">
">:">

+ +

+   +   + + +

+ +
+ + + diff --git a/interface/patient_file/history/history_save.php b/interface/patient_file/history/history_save.php index c7e99a697..ba58c38a9 100644 --- a/interface/patient_file/history/history_save.php +++ b/interface/patient_file/history/history_save.php @@ -1,8 +1,7 @@ $val) { if ($val == "YYYY-MM-DD") { @@ -12,7 +11,18 @@ foreach ($_POST as $key => $val) { } } - +// Compute the string of radio button values representing +// normal/abnormal exam results. +// +$ltr = "000000000"; +foreach ($exams as $key => $value) { + if ($_POST[$key]) { + $tmp = $_POST['rb_' . $key]; + $digit = ($tmp == '1') ? '1' : (($tmp == '2') ? '2' : '0'); + $index = substr($value, 0, 2); + $ltr = substr($ltr, 0, $index) . $digit . substr($ltr, $index + 1); + } +} newHistoryData($pid, $_POST["coffee"], @@ -57,9 +67,11 @@ $_POST["name_1"], $_POST["value_1"], $_POST["name_2"], $_POST["value_2"], -$_POST["additional_history"] +$_POST["additional_history"], +$_POST["last_ecg"], +$_POST["last_cardiac_echo"], +$ltr ); include_once("patient_history.php"); ?> - diff --git a/library/patient.inc b/library/patient.inc index b2543fa28..db19081dc 100644 --- a/library/patient.inc +++ b/library/patient.inc @@ -728,7 +728,10 @@ function newHistoryData( $pid, $value_1 = "", $name_2 = "", $value_2 = "", - $additional_history = "" + $additional_history = "", + $last_ecg = "", + $last_cardiac_echo = "", + $last_exam_results = "" ) { return sqlInsert("insert into history_data set @@ -747,6 +750,9 @@ function newHistoryData( $pid, last_prostate_exam='$last_prostate_exam', last_physical_exam='$last_physical_exam', last_sigmoidoscopy_colonoscopy='$last_sigmoidoscopy_colonoscopy', + last_ecg='$last_ecg', + last_cardiac_echo='$last_cardiac_echo', + last_exam_results='$last_exam_results', history_mother='$history_mother', history_father='$history_father', history_siblings='$history_siblings', diff --git a/sql/2_7_2-to-2_7_3_upgrade.sql b/sql/2_7_2-to-2_7_3_upgrade.sql index b121344f7..f8e58d3cc 100644 --- a/sql/2_7_2-to-2_7_3_upgrade.sql +++ b/sql/2_7_2-to-2_7_3_upgrade.sql @@ -8,3 +8,25 @@ ALTER TABLE lists ALTER TABLE patient_data ADD squad int(11) NOT NULL DEFAULT 0, ADD fitness int(11) NOT NULL DEFAULT 0; + +ALTER TABLE history_data + CHANGE last_breast_exam last_breast_exam varchar(255) DEFAULT '', + CHANGE last_mammogram last_mammogram varchar(255) DEFAULT '', + CHANGE last_gynocological_exam last_gynocological_exam varchar(255) DEFAULT '', + CHANGE last_rectal_exam last_rectal_exam varchar(255) DEFAULT '', + CHANGE last_prostate_exam last_prostate_exam varchar(255) DEFAULT '', + CHANGE last_physical_exam last_physical_exam varchar(255) DEFAULT '', + CHANGE last_sigmoidoscopy_colonoscopy last_sigmoidoscopy_colonoscopy varchar(255) DEFAULT '', + ADD last_ecg varchar(255) NOT NULL DEFAULT '', + ADD last_cardiac_echo varchar(255) NOT NULL DEFAULT '', + -- here is 1 digit for each of the above exams, in order, with values + -- 0=n/a, 1=normal, 2=abnormal: + ADD last_exam_results varchar(255) NOT NULL DEFAULT '000000000'; + +UPDATE history_data SET last_breast_exam = '' WHERE last_breast_exam = '0000-00-00 00:00:00'; +UPDATE history_data SET last_mammogram = '' WHERE last_mammogram = '0000-00-00 00:00:00'; +UPDATE history_data SET last_gynocological_exam = '' WHERE last_gynocological_exam = '0000-00-00 00:00:00'; +UPDATE history_data SET last_rectal_exam = '' WHERE last_rectal_exam = '0000-00-00 00:00:00'; +UPDATE history_data SET last_prostate_exam = '' WHERE last_prostate_exam = '0000-00-00 00:00:00'; +UPDATE history_data SET last_physical_exam = '' WHERE last_physical_exam = '0000-00-00 00:00:00'; +UPDATE history_data SET last_sigmoidoscopy_colonoscopy = '' WHERE last_sigmoidoscopy_colonoscopy = '0000-00-00 00:00:00'; diff --git a/sql/database.sql b/sql/database.sql index 36da0d529..95dbd6dd9 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -26754,6 +26754,8 @@ CREATE TABLE `groups` ( -- -- Table structure for table `history_data` +-- See interface/patient_file/history/history.inc.php which should be +-- modified whenever corresponding changes are made to this table. -- DROP TABLE IF EXISTS `history_data`; @@ -26767,13 +26769,19 @@ CREATE TABLE `history_data` ( `seatbelt_use` longtext, `counseling` longtext, `hazardous_activities` longtext, - `last_breast_exam` datetime default NULL, - `last_mammogram` datetime default NULL, - `last_gynocological_exam` datetime default NULL, - `last_rectal_exam` datetime default NULL, - `last_prostate_exam` datetime default NULL, - `last_physical_exam` datetime default NULL, - `last_sigmoidoscopy_colonoscopy` datetime default NULL, + -- Exams begin here. + `last_breast_exam` varchar(255) NOT NULL default '', + `last_mammogram` varchar(255) NOT NULL default '', + `last_gynocological_exam` varchar(255) NOT NULL default '', + `last_rectal_exam` varchar(255) NOT NULL default '', + `last_prostate_exam` varchar(255) NOT NULL default '', + `last_physical_exam` varchar(255) NOT NULL default '', + `last_sigmoidoscopy_colonoscopy` varchar(255) NOT NULL default '', + `last_ecg` varchar(255) NOT NULL DEFAULT '', + `last_cardiac_echo` varchar(255) NOT NULL DEFAULT '', + -- here is 1 digit for each of the above exams, in order, with values + -- 0=n/a, 1=normal, 2=abnormal: + `last_exam_results` varchar(255) NOT NULL DEFAULT '000000000'; `history_mother` longtext, `history_father` longtext, `history_siblings` longtext, @@ -26788,6 +26796,7 @@ CREATE TABLE `history_data` ( `relatives_epilepsy` longtext, `relatives_mental_illness` longtext, `relatives_suicide` longtext, + -- The following are deprecated and should be removed at some point. `cataract_surgery` datetime default NULL, `tonsillectomy` datetime default NULL, `cholecystestomy` datetime default NULL, @@ -26796,9 +26805,10 @@ CREATE TABLE `history_data` ( `hernia_repair` datetime default NULL, `hip_replacement` datetime default NULL, `knee_replacement` datetime default NULL, + `appendectomy` datetime default NULL, + -- End of deprecated variables. `date` datetime default NULL, `pid` bigint(20) NOT NULL default '0', - `appendectomy` datetime default NULL, `name_1` varchar(255) default NULL, `value_1` varchar(255) default NULL, `name_2` varchar(255) default NULL, -- 2.11.4.GIT