From c3bc923ed482e1c118052a84820d07b4acc8549b Mon Sep 17 00:00:00 2001 From: Teny Date: Thu, 18 Apr 2013 00:25:26 +0530 Subject: [PATCH] Migrate the Clickoption and Issue Type settings into the database. Initial code was signed-off-by: Teny There has been extensive modification and integration work by bradymiller. --- interface/patient_file/summary/add_edit_issue.php | 21 +- interface/super/edit_list.php | 151 ++++++++++++- interface/super/manage_site_files.php | 1 - library/lists.inc | 264 +++++++++++----------- library/sql_upgrade_fx.php | 48 ++++ sites/default/clickoptions.txt | 4 + sql/4_1_1-to-4_1_2_upgrade.sql | 39 ++++ sql/database.sql | 84 +++++++ version.php | 2 +- 9 files changed, 457 insertions(+), 157 deletions(-) rewrite library/lists.inc (61%) diff --git a/interface/patient_file/summary/add_edit_issue.php b/interface/patient_file/summary/add_edit_issue.php index e29f4841d..662374fb1 100644 --- a/interface/patient_file/summary/add_edit_issue.php +++ b/interface/patient_file/summary/add_edit_issue.php @@ -290,26 +290,13 @@ div.section { var aitypes = new Array(); // issue type attributes var aopts = new Array(); // Option objects $value) { echo " aitypes[$i] = " . attr($value[3]) . ";\n"; echo " aopts[$i] = new Array();\n"; - foreach($clickoptions as $line) { - $line = trim($line); - if (substr($line, 0, 1) != "#") { - if (strpos($line, $key) !== false) { - $text = addslashes(substr($line, strpos($line, "::") + 2)); - echo " aopts[$i][aopts[$i].length] = new Option('$text', '$text', false, false);\n"; - } - } + $qry = sqlStatement("SELECT * FROM list_options WHERE list_id = ?",array($key."_issue_list")); + while($res = sqlFetchArray($qry)){ + echo " aopts[$i][aopts[$i].length] = new Option('".attr($res['option_id'])."', '".attr(xl_list_label($res['title']))."', false, false);\n"; } ++$i; } diff --git a/interface/super/edit_list.php b/interface/super/edit_list.php index 73def14e3..ca8623cb9 100644 --- a/interface/super/edit_list.php +++ b/interface/super/edit_list.php @@ -1,14 +1,34 @@ -// -// 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. +/** + * library/sql_upgrade_fx.php Upgrading and patching functions of database. + * + * Functions to allow safe database modifications + * during upgrading and patches. + * + * Copyright (C) 2007-2011 Rod Roark + * + * LICENSE: 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see ;. + * + * @package OpenEMR + * @author Rod Roark + * @author Brady Miller + * @author Teny + * @link http://www.open-emr.org + */ require_once("../globals.php"); require_once("$srcdir/acl.inc"); require_once("$srcdir/formdata.inc.php"); +require_once("$srcdir/lists.inc"); require_once("../../custom/code_types.inc.php"); $list_id = empty($_REQUEST['list_id']) ? 'language' : $_REQUEST['list_id']; @@ -87,6 +107,36 @@ if ($_POST['formaction']=='save' && $list_id) { } } } + else if ($list_id == 'issue_types') { + // special case for issue_types + sqlStatement("DELETE FROM issue_types"); + for ($lino = 1; isset($opt["$lino"]['category']); ++$lino) { + $iter = $opt["$lino"]; + $it_category = formTrim($iter['category']); + $it_ordering = formTrim($iter['ordering']); + $it_type = formTrim($iter['type']); + $it_plural = formTrim($iter['plural']); + $it_singular = formTrim($iter['singular']); + $it_abbr = formTrim($iter['abbreviation']); + $it_style = formTrim($iter['style']); + $it_fshow = formTrim($iter['force_show']); + + if ( (strlen($it_category) > 0) && (strlen($it_type) > 0) ) { + sqlInsert("INSERT INTO issue_types ( " . + "`category`,`ordering`, `type`, `plural`, `singular`, `abbreviation`, `style`, `force_show` " . + ") VALUES ( " . + "'$it_category' , " . + "'$it_ordering' , " . + "'$it_type' , " . + "'$it_plural' , " . + "'$it_singular' , " . + "'$it_abbr' , " . + "'$it_style', " . + "'$it_fshow' " . + ")"); + } + } + } else { // all other lists // @@ -350,6 +400,24 @@ function writeFSLine($category, $option, $codes) { echo " \n"; } + +/** + * Helper function for writeITLine(). + * itGenCell() generates cells for data display (Issue Type list). + */ + +function itGenCell($opt_line_no, $it_array, $name, $size, $maxlength, $title='') { + $value = isset($it_array[$name]) ? $it_array[$name] : ''; + $s = " 1) { + echo " " . xlt($ct_array['ct_label']) . "\n"; + } echo ctGenCell($opt_line_no, $ct_array, 'ct_seq' , 2, 3, xl('Numeric display order')); echo ctGenCell($opt_line_no, $ct_array, 'ct_mod' , 1, 2, @@ -430,6 +502,38 @@ function writeCTLine($ct_array) { echo "\n"; echo " \n"; } + +/** + * Special case of Issue Types + */ +function writeITLine($it_array) { + global $opt_line_no; + ++$opt_line_no; + $bgcolor = "#" . (($opt_line_no & 1) ? "ddddff" : "ffdddd"); + echo " \n"; + echo itGenCell($opt_line_no, $it_array, 'category' , 20, 20, xl('OpenEMR Application Category (Default vs Sports Teams vs IPPF)')); + echo itGenCell($opt_line_no, $it_array, 'ordering' , 10, 10, xl('Order')); + echo itGenCell($opt_line_no, $it_array, 'type' , 20, 75, xl('Issue Type')); + echo itGenCell($opt_line_no, $it_array, 'plural' , 20, 75, xl('Plural')); + // if not english and translating lists then show the translation + if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { + echo " " . xlt($it_array['plural']) . "\n"; + } + echo itGenCell($opt_line_no, $it_array, 'singular' , 20, 75, xl('Singular')); + // if not english and translating lists then show the translation + if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { + echo " " . xlt($it_array['singular']) . "\n"; + } + echo itGenCell($opt_line_no, $it_array, 'abbreviation' , 10, 10, xl('Abbreviation')); + // if not english and translating lists then show the translation + if ($GLOBALS['translate_lists'] && $_SESSION['language_choice'] > 1) { + echo " " . xlt($it_array['abbreviation']) . "\n"; + } + echo itGenCell($opt_line_no, $it_array, 'style', 6, 6, xl('0 - Normal; 1 - Simplified: only title, start date, comments and an Active checkbox;no diagnosis, occurrence, end date, referred-by or sports fields.; 2 - Football Injury;')); + echo itGenCell($opt_line_no, $it_array, 'force_show', 10, 10, xl('0 - Do not show this category on the patient summary screen if there have been no issues entered in for this category; 1 - Show this category on the patient summary screen even if no issues have been entered for this category.')); + echo " \n"; +} + ?> @@ -686,6 +790,10 @@ while ($row = sqlFetchArray($res)) { + 1) { + echo "".xl('Translation')." (?)"; + } ?> @@ -699,6 +807,27 @@ while ($row = sqlFetchArray($res)) { + + + + + + 1) { + echo "".xl('Translation')." (?)"; + } ?> + + 1) { + echo "".xl('Translation')." (?)"; + } ?> + + 1) { + echo "".xl('Translation')." (?)"; + } ?> + + > @@ -751,6 +880,16 @@ if ($list_id) { writeCTLine(array()); } } + else if ($list_id == 'issue_types') { + $res = sqlStatement("SELECT * FROM issue_types " . + "ORDER BY category, ordering ASC"); + while ($row = sqlFetchArray($res)) { + writeITLine($row); + } + for ($i = 0; $i < 3; ++$i) { + writeITLine(array()); + } + } else { $res = sqlStatement("SELECT * FROM list_options WHERE " . "list_id = '$list_id' ORDER BY seq,title"); diff --git a/interface/super/manage_site_files.php b/interface/super/manage_site_files.php index 0b257c1f3..a90f8f3bd 100644 --- a/interface/super/manage_site_files.php +++ b/interface/super/manage_site_files.php @@ -23,7 +23,6 @@ if (!acl_check('admin', 'super')) die(htmlspecialchars(xl('Not authorized'))); // Prepare array of names of editable files, relative to the site directory. $my_files = array( - 'clickoptions.txt', 'config.php', 'faxcover.txt', 'faxtitle.eps', diff --git a/library/lists.inc b/library/lists.inc dissimilarity index 61% index 8170a7ea5..cffeabb4a 100644 --- a/library/lists.inc +++ b/library/lists.inc @@ -1,132 +1,132 @@ - array(xl('Medical Problems'),xl('Problem') ,xl('P'),0,1), - 'allergy' => array(xl('Allergies') ,xl('Allergy') ,xl('Y'),0,1), - 'medication' => array(xl('Medications') ,xl('Medication') ,xl('M'),0,1), - 'surgery' => array(xl('Surgeries') ,xl('Surgery') ,xl('S'),0,0), - 'ippf_gcac' => array(xl('Abortions') ,xl('Abortion') ,xl('A'),3,0), - 'contraceptive' => array(xl('Contraception') ,xl('Contraception'),xl('C'),4,0), -// 'ippf_srh' => array(xl('SRH') ,xl('SRH') ,xl('R'),5), - ); -} -else if (!empty($GLOBALS['athletic_team'])) { - $ISSUE_TYPES = array( - 'football_injury' => array(xl('Football Injuries'),xl('Injury') ,xl('I'),2,1), - 'medical_problem' => array(xl('Medical Problems') ,xl('Medical'),xl('P'),0,0), - 'allergy' => array(xl('Allergies') ,xl('Allergy'),xl('A'),1,0), - 'general' => array(xl('General') ,xl('General'),xl('G'),1,0), - ); -} -else { // default version - $ISSUE_TYPES = array( - // table type, plural, singular, abbrev, style, force show patient summary screen - 'medical_problem' => array(xl('Medical Problems'),xl('Problem') ,xl('P'),0,1), - 'allergy' => array(xl('Allergies') ,xl('Allergy') ,xl('A'),0,1), - 'medication' => array(xl('Medications') ,xl('Medication'),xl('M'),0,1), - 'surgery' => array(xl('Surgeries') ,xl('Surgery') ,xl('S'),0,0), - 'dental' => array(xl('Dental Issues') ,xl('Dental') ,xl('D'),0,0), - // - // Styles are: - // 0 - Normal, as in 2.8.1. - // 1 - Simplified: only title, start date, comments and an Active checkbox; - // no diagnosis, occurrence, end date, referred-by or sports fields. - // Internally we'll still use a null end date to indicate active. - // 2 - Football Injury. - // - // force show patient summary screen is: - // 0 - Do not show this category on the patient summary screen if there have - // been no issues entered in for this category. - // 1 - Show this category on the patient summary screen even if no issues have - // been entered for this category. - // - ); -} - -// -// 06/2009 - BM Migrated the ISSUE_OCCURRENCES to list_options -// - -$ISSUE_CLASSIFICATIONS = array( - 0 => xl('Unknown or N/A'), - 1 => xl('Trauma'), - 2 => xl('Overuse') -); - -function getListById ($id, $cols = "*") -{ - return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1"); -} - -function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0") -{ - if($active == "all") - $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC"; - else - $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC"; - if ($limit != "all") - $sql .= " limit $offset,$limit"; - - - $res = sqlStatement($sql); - for($iter =0;$row = sqlFetchArray($res);$iter++) - $all[$iter] = $row; - return $all; - -} - -function addList ($pid, $type, $title, $comments, $activity = "1") -{ - return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')"); -} - -function disappearList ($id) -{ - sqlStatement("update lists set activity = '0' where id='$id'"); - return true; -} - -function reappearList ($id) -{ - sqlStatement("update lists set activity = '1' where id='$id'"); - return true; -} - -function getListTouch ($patient_id,$type) -{ - $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) ); - - if (!empty($ret)) { - return $ret['date']; - } - else { - return false; - } -} - -function setListTouch ($patient_id,$type) -{ - $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) ); - - if (!empty($ret)) { - // Already touched, so can exit - return; - } - else { - sqlStatement("INSERT INTO `lists_touch` ( `pid`,`type`,`date` ) VALUES ( ?, ?, NOW() )", array($patient_id,$type) ); - } -} -?> +Attributes of the $ISSUE_TYPES array are: + * key - The identifier. (Do NOT create element with token 'prescription_erx' since this is reserved by NewCropRx Module that leverages lists_touch table to support MU calculations) + * 0 - The plural title. + * 1 - The singular title. + * 2 - The abbreviated title (one letter abbreviation). + * 3 - Style (integer from 0 to 5). Normal behavior is 0; not sure what others do; will document this later. + * 4 - Force show this issue category in the patient summary screen even if empty (setting to 1 will force it to show and setting it to 0 will turn this off). + * + * + * Note there is a mechanism to show whether a category is explicitly set to + * 'Nothing' via the getListTouch() and setListTouch() functions that store + * applicable information in the lists_touch sql table. + * + * + * + * LICENSE: 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see ;. + * + * @package OpenEMR + * @author Rod Roark + * @author Brady Miller + * @author Teny + * @link http://www.open-emr.org + */ + +/** + * Will return the current issue type category that is being used. + * @return string The current issue type category that is being used. + */ +function collect_issue_type_category() { + if (!empty($GLOBALS['ippf_specific'])) { // IPPF version + return "ippf_specific"; + } + else if (!empty($GLOBALS['athletic_team'])) { // Athletic team version + return "athletic_team"; + } + else { // Default version + return "default"; + } +} + +// Build the $ISSUE_TYPES array (see script header for description) +$res = sqlStatement("SELECT * FROM `issue_types` WHERE `category`=? ORDER BY `ordering` ASC", array( collect_issue_type_category() )); +while($row = sqlFetchArray($res)){ + $ISSUE_TYPES[$row['type']] = array(xl($row['plural']),xl($row['singular']),xl($row['abbreviation']),$row['style'],$row['force_show']); +} + +$ISSUE_CLASSIFICATIONS = array( + 0 => xl('Unknown or N/A'), + 1 => xl('Trauma'), + 2 => xl('Overuse') +); + +function getListById ($id, $cols = "*") +{ + return sqlQuery("select $cols from lists where id='$id' order by date DESC limit 0,1"); +} + +function getListByType ($pid, $type, $cols = "*", $active = "all", $limit = "all", $offset="0") +{ + if($active == "all") + $sql = "select $cols from lists where pid='$pid' and type='$type' order by date DESC"; + else + $sql = "select $cols from lists where pid='$pid' and type='$type' and activity='$active' order by date DESC"; + if ($limit != "all") + $sql .= " limit $offset,$limit"; + + + $res = sqlStatement($sql); + for($iter =0;$row = sqlFetchArray($res);$iter++) + $all[$iter] = $row; + return $all; + +} + +function addList ($pid, $type, $title, $comments, $activity = "1") +{ + return sqlInsert("insert into lists (date, pid, type, title, activity, comments, user, groupname) values (NOW(), '$pid', '$type', '$title', '$activity', '$comments', '".$_SESSION['authUser']."', '".$_SESSION['authProvider']."')"); +} + +function disappearList ($id) +{ + sqlStatement("update lists set activity = '0' where id='$id'"); + return true; +} + +function reappearList ($id) +{ + sqlStatement("update lists set activity = '1' where id='$id'"); + return true; +} + +function getListTouch ($patient_id,$type) +{ + $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) ); + + if (!empty($ret)) { + return $ret['date']; + } + else { + return false; + } +} + +function setListTouch ($patient_id,$type) +{ + $ret = sqlQuery("SELECT `date` FROM `lists_touch` WHERE pid=? AND type=?", array($patient_id,$type) ); + + if (!empty($ret)) { + // Already touched, so can exit + return; + } + else { + sqlStatement("INSERT INTO `lists_touch` ( `pid`,`type`,`date` ) VALUES ( ?, ?, NOW() )", array($patient_id,$type) ); + } +} +?> diff --git a/library/sql_upgrade_fx.php b/library/sql_upgrade_fx.php index cd9762a72..ab2f77db4 100644 --- a/library/sql_upgrade_fx.php +++ b/library/sql_upgrade_fx.php @@ -21,6 +21,7 @@ * @package OpenEMR * @author Rod Roark * @author Brady Miller +* @author Teny * @link http://www.open-emr.org */ @@ -144,6 +145,39 @@ function tableHasIndex($tblname, $colname) { } /** +* Function to migrate the Clickoptions settings (if exist) from the codebase into the database. +* Note this function is only run once in the sql upgrade script (from 4.1.1 to 4.1.2) if the +* issue_types sql table does not exist. +*/ +function clickOptionsMigrate() { + // If the clickoptions.txt file exist, then import it. + if (file_exists(dirname(__FILE__)."/../sites/".$_SESSION['site_id']."/clickoptions.txt")) { + $file_handle = fopen(dirname(__FILE__)."/../sites/".$_SESSION['site_id']."/clickoptions.txt", "rb"); + $seq = 10; + $prev = ''; + echo "Importing clickoption setting
"; + while (!feof($file_handle) ) { + $line_of_text = fgets($file_handle); + if (preg_match('/^#/', $line_of_text)) continue; + if ($line_of_text == "") continue; + $parts = explode('::', $line_of_text); + $parts[0] = str_replace("\r\n","",$parts[0]); + $parts[1] = str_replace("\r\n","",$parts[1]); + if ($parts[0] != $prev) { + $sql1 = "INSERT INTO list_options (`list_id`,`option_id`,`title`) VALUES (?,?,?)"; + SqlStatement($sql1, array('lists',$parts[0].'_issue_list',ucwords(str_replace("_"," ",$parts[0])).' Issue List') ); + $seq = 10; + } + $sql2 = "INSERT INTO list_options (`list_id`,`option_id`,`title`,`seq`) VALUES (?,?,?,?)"; + SqlStatement($sql2, array($parts[0].'_issue_list', $parts[1], $parts[1], $seq) ); + $seq = $seq + 10; + $prev = $parts[0]; + } + fclose($file_handle); + } +} + +/** * Upgrade or patch the database with a selected upgrade/patch file. * * The following "functions" within the selected file will be processed: @@ -201,6 +235,9 @@ function tableHasIndex($tblname, $colname) { * arguments: table_name colname * behavior: If the index does not exist, it will be created * +* #IfNotMigrateClickOptions +* Custom function for the importing of the Clickoptions settings (if exist) from the codebase into the database +* * #EndIf * all blocks are terminated with a #EndIf statement. * @@ -349,6 +386,17 @@ function upgradeFromSqlFile($filename) { } if ($skipping) echo "Skipping section $line
\n"; } + else if (preg_match('/^#IfNotMigrateClickOptions/', $line)) { + if (tableExists("issue_types")) { + $skipping = true; + } + else { + // Create issue_types table and import the Issue Types and clickoptions settings from codebase into the database + clickOptionsMigrate(); + $skipping = false; + } + if ($skipping) echo "Skipping section $line
\n"; + } else if (preg_match('/^#EndIf/', $line)) { $skipping = false; } diff --git a/sites/default/clickoptions.txt b/sites/default/clickoptions.txt index 6d764eebf..a65fce39f 100644 --- a/sites/default/clickoptions.txt +++ b/sites/default/clickoptions.txt @@ -1,3 +1,7 @@ +# THIS PAGE IS DEPRECATED AND NO LONGER USED AS OF OPENEMR VERSION 4.1.2 +# (It is being kept indefinitely for upgrading purposes) +# (This file should never be deleted) +# # CLICKOPTIONS by Mark Leeds # This is a new addition to OpenEMR written in April of 2005. # The purpose is to minimize typing in places where a select box or drop down menu diff --git a/sql/4_1_1-to-4_1_2_upgrade.sql b/sql/4_1_1-to-4_1_2_upgrade.sql index 9a0e6662e..095e160fc 100644 --- a/sql/4_1_1-to-4_1_2_upgrade.sql +++ b/sql/4_1_1-to-4_1_2_upgrade.sql @@ -54,6 +54,9 @@ -- arguments: table_name colname -- behavior: If the index does not exist, it will be created +-- #IfNotMigrateClickOptions +-- Custom function for the importing of the Clickoptions settings (if exist) from the codebase into the database + -- #EndIf -- all blocks are terminated with a #EndIf statement. @@ -363,3 +366,39 @@ UPDATE procedure_order SET date_transmitted = date_ordered WHERE date_transmitted IS NULL AND date_ordered IS NOT NULL; #EndIf +#IfNotRow2D list_options list_id lists option_id issue_types +INSERT INTO list_options (`list_id`,`option_id`,`title`) VALUES ('lists','issue_types','Issue Types'); +#EndIf + +#IfNotMigrateClickOptions +#EndIf + +#IfNotTable issue_types +CREATE TABLE `issue_types` ( + `category` varchar(75) NOT NULL DEFAULT '', + `type` varchar(75) NOT NULL DEFAULT '', + `plural` varchar(75) NOT NULL DEFAULT '', + `singular` varchar(75) NOT NULL DEFAULT '', + `abbreviation` varchar(75) NOT NULL DEFAULT '', + `style` smallint(6) NOT NULL DEFAULT '0', + `force_show` smallint(6) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`category`,`type`) +) ENGINE=MyISAM; +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('10','default','medical_problem','Medical Problems','Problem','P','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('30','default','medication','Medications','Medication','M','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('20','default','allergy','Allergies','Allergy','A','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('40','default','surgery','Surgeries','Surgery','S','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('50','default','dental','Dental Issues','Dental','D','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('10','athletic_team','football_injury','Football Injuries','Injury','I','2','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('20','athletic_team','medical_problem','Medical Problems','Medical','P','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('30','athletic_team','allergy','Allergies','Allergy','A','1','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('40','athletic_team','general','General','General','G','1','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('10','ippf_specific','medical_problem','Medical Problems','Problem','P','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('30','ippf_specific','medication','Medications','Medication','M','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('20','ippf_specific','allergy','Allergies','Allergy','Y','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('40','ippf_specific','surgery','Surgeries','Surgery','S','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('50','ippf_specific','ippf_gcac','Abortions','Abortion','A','3','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('60','ippf_specific','contraceptive','Contraception','Contraception','C','4','0'); +#EndIf + diff --git a/sql/database.sql b/sql/database.sql index 44502ee4d..740a7fccc 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -2354,6 +2354,45 @@ CREATE TABLE `issue_encounter` ( -- -------------------------------------------------------- +-- +-- Table structure for table `issue_types` +-- + +DROP TABLE IF EXISTS `issue_types`; +CREATE TABLE `issue_types` ( + `category` varchar(75) NOT NULL DEFAULT '', + `type` varchar(75) NOT NULL DEFAULT '', + `plural` varchar(75) NOT NULL DEFAULT '', + `singular` varchar(75) NOT NULL DEFAULT '', + `abbreviation` varchar(75) NOT NULL DEFAULT '', + `style` smallint(6) NOT NULL DEFAULT '0', + `force_show` smallint(6) NOT NULL DEFAULT '0', + `ordering` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`category`,`type`) +) ENGINE=MyISAM; + +-- +-- Dumping data for table `issue_types` +-- + +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('10','default','medical_problem','Medical Problems','Problem','P','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('30','default','medication','Medications','Medication','M','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('20','default','allergy','Allergies','Allergy','A','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('40','default','surgery','Surgeries','Surgery','S','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('50','default','dental','Dental Issues','Dental','D','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('10','athletic_team','football_injury','Football Injuries','Injury','I','2','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('20','athletic_team','medical_problem','Medical Problems','Medical','P','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('30','athletic_team','allergy','Allergies','Allergy','A','1','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('40','athletic_team','general','General','General','G','1','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('10','ippf_specific','medical_problem','Medical Problems','Problem','P','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('30','ippf_specific','medication','Medications','Medication','M','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('20','ippf_specific','allergy','Allergies','Allergy','Y','0','1'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('40','ippf_specific','surgery','Surgeries','Surgery','S','0','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('50','ippf_specific','ippf_gcac','Abortions','Abortion','A','3','0'); +INSERT INTO issue_types(`ordering`,`category`,`type`,`plural`,`singular`,`abbreviation`,`style`,`force_show`) VALUES ('60','ippf_specific','contraceptive','Contraception','Contraception','C','4','0'); + +-- -------------------------------------------------------- + -- -- Table structure for table `lang_constants` -- @@ -3577,6 +3616,50 @@ insert into list_options (list_id, option_id, title, seq, option_value, mapping, insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','DOB' ,'Date of Birth' ,'40','3','',''); insert into list_options (list_id, option_id, title, seq, option_value, mapping, notes) values('ptlistcols','pubpid' ,'External ID' ,'50','3','',''); +-- Medical Problem Issue List +INSERT INTO list_options(list_id,option_id,title) VALUES ('lists','medical_problem_issue_list','Medical Problem Issue List'); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medical_problem_issue_list', 'HTN', 'HTN', 10); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medical_problem_issue_list', 'asthma', 'asthma', 20); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medical_problem_issue_list', 'diabetes', 'diabetes', 30); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medical_problem_issue_list', 'hyperlipidemia', 'hyperlipidemia', 40); + +-- Medication Issue List +INSERT INTO list_options(list_id,option_id,title) VALUES ('lists','medication_issue_list','Medication Issue List'); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medication_issue_list', 'Norvasc', 'Norvasc', 10); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medication_issue_list', 'Lipitor', 'Lipitor', 20); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('medication_issue_list', 'Metformin', 'Metformin', 30); + +-- Allergy Issue List +INSERT INTO list_options(list_id,option_id,title) VALUES ('lists','allergy_issue_list','Allergy Issue List'); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('allergy_issue_list', 'penicillin', 'penicillin', 10); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('allergy_issue_list', 'sulfa', 'sulfa', 20); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('allergy_issue_list', 'iodine', 'iodine', 30); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('allergy_issue_list', 'codeine', 'codeine', 40); + +-- Surgery Issue List +INSERT INTO list_options(list_id,option_id,title) VALUES ('lists','surgery_issue_list','Surgery Issue List'); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('surgery_issue_list', 'tonsillectomy', 'tonsillectomy', 10); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('surgery_issue_list', 'appendectomy', 'appendectomy', 20); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('surgery_issue_list', 'cholecystectomy', 'cholecystectomy', 30); + +-- Dental Issue List +INSERT INTO list_options(list_id,option_id,title) VALUES ('lists','dental_issue_list','Dental Issue List'); + +-- General Issue List +INSERT INTO list_options(list_id,option_id,title) VALUES ('lists','general_issue_list','General Issue List'); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Osteopathy', 'Osteopathy', 10); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Chiropractic', 'Chiropractic', 20); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Prevention Rehab', 'Prevention Rehab', 30); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Podiatry', 'Podiatry', 40); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Strength and Conditioning', 'Strength and Conditioning', 50); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Nutritional', 'Nutritional', 60); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Fitness Testing', 'Fitness Testing', 70); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Pre Participation Assessment', 'Pre Participation Assessment', 80); +INSERT INTO list_options(list_id,option_id,title,seq) VALUES ('general_issue_list', 'Screening / Testing', 'Screening / Testing', 90); + +-- Issue Types List +INSERT INTO list_options (`list_id`,`option_id`,`title`) VALUES ('lists','issue_types','Issue Types'); + -- -------------------------------------------------------- -- @@ -5673,3 +5756,4 @@ CREATE TABLE `product_warehouse` ( PRIMARY KEY (`pw_drug_id`,`pw_warehouse`) ) ENGINE=MyISAM; +-- -------------------------------------------------------- diff --git a/version.php b/version.php index 45b9ead6c..cf4bed9c7 100644 --- a/version.php +++ b/version.php @@ -17,7 +17,7 @@ $v_realpatch = '0'; // is a database change in the course of development. It is used // internally to determine when a database upgrade is needed. // -$v_database = 91; +$v_database = 92; // Access control version identifier, this is to be incremented whenever there // is a access control change in the course of development. It is used -- 2.11.4.GIT