diff --git a/custom/code_types.inc.php b/custom/code_types.inc.php index 90a3d680779..7d668cd10a7 100644 --- a/custom/code_types.inc.php +++ b/custom/code_types.inc.php @@ -32,6 +32,8 @@ * 9 for storing codes in external SNOMED (RF1) Procedure Term tables * 10 for storing codes in external SNOMED (RF2) Procedure Term tables (for future) * term - 1 if this code type is used as a clinical term + * problem - 1 if this code type is used as a medical problem + * * * * Copyright (C) 2006-2010 Rod Roark @@ -74,7 +76,8 @@ 'external'=> $ctrow['ct_external'], 'claim' => $ctrow['ct_claim'], 'proc' => $ctrow['ct_proc'], - 'term' => $ctrow['ct_term'] + 'term' => $ctrow['ct_term'], + 'problem'=> $ctrow['ct_problem'] ); if ($default_search_type === '') $default_search_type = $ctrow['ct_key']; } @@ -243,7 +246,7 @@ function convert_type_id_to_key($id) { * as 1) an array and as 2) a comma-separated lists that has been * process by urlencode() in order to place into URL address safely. * - * @param string $category category of code types('diagnosis', 'procedure', 'clinical_term' or 'active') + * @param string $category category of code types('diagnosis', 'procedure', 'clinical_term', 'active' or 'medical_problem') * @param string $return_format format or returned code types ('array' or 'csv') * @return string/array */ @@ -275,6 +278,11 @@ function collect_codetypes($category,$return_format="array") { array_push($return,$ct_key); } } + else if ($category == "medical_problem") { + if ($ct_arr['problem']) { + array_push($return,$ct_key); + } + } else { //return nothing since no supported category was chosen } diff --git a/interface/patient_file/summary/add_edit_issue.php b/interface/patient_file/summary/add_edit_issue.php index 6b50a74896b..573f0616cd7 100644 --- a/interface/patient_file/summary/add_edit_issue.php +++ b/interface/patient_file/summary/add_edit_issue.php @@ -147,7 +147,8 @@ function issueTypeIndex($tstr) { "outcome = '" . add_escape_custom($_POST['form_outcome']) . "', " . "destination = '" . add_escape_custom($_POST['form_destination']) . "', " . "reaction ='" . add_escape_custom($_POST['form_reaction']) . "', " . - "erx_uploaded = '0' " . + "erx_uploaded = '0', " . + "modifydate = NOW() " . "WHERE id = '" . add_escape_custom($issue) . "'"; sqlStatement($query); if ($text_type == "medication" && enddate != '') { @@ -420,6 +421,7 @@ function outcomeClicked(cb) { function set_related(codetype, code, selector, codedesc) { var f = document.forms[0]; var s = f.form_diagnosis.value; + var title = f.form_title.value; if (code) { if (s.length > 0) s += ';'; s += codetype + ':' + code; @@ -427,11 +429,24 @@ function set_related(codetype, code, selector, codedesc) { s = ''; } f.form_diagnosis.value = s; + if(title == '') f.form_title.value = codedesc; } // This invokes the find-code popup. function sel_diagnosis() { - dlgopen('../encounter/find_code_popup.php?codetype=', '_blank', 500, 400); + + dlgopen('../encounter/find_code_popup.php?codetype=', '_blank', 500, 400); + + dlgopen('../encounter/find_code_popup.php?codetype=', '_blank', 500, 400); + } // Check for errors when the form is submitted. diff --git a/interface/super/edit_list.php b/interface/super/edit_list.php index dac3eaef403..73def14e314 100644 --- a/interface/super/edit_list.php +++ b/interface/super/edit_list.php @@ -61,9 +61,10 @@ $ct_claim = empty($iter['ct_claim']) ? 0 : 1; $ct_proc = empty($iter['ct_proc']) ? 0 : 1; $ct_term = empty($iter['ct_term']) ? 0 : 1; + $ct_problem = empty($iter['ct_problem']) ? 0 : 1; if (strlen($ct_key) > 0 && $ct_id > 0) { sqlInsert("INSERT INTO code_types ( " . - "ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_mask, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term " . + "ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_mask, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem " . ") VALUES ( " . "'$ct_key' , " . "'$ct_id' , " . @@ -80,7 +81,8 @@ "'$ct_external', " . "'$ct_claim', " . "'$ct_proc', " . - "'$ct_term' " . + "'$ct_term', " . + "'$ct_problem' " . ")"); } } @@ -413,6 +415,8 @@ function writeCTLine($ct_array) { xl('Is this a diagnosis type?')); echo ctGenCBox($opt_line_no, $ct_array, 'ct_term', xl('Is this a Clinical Term code type?')); + echo ctGenCBox($opt_line_no, $ct_array, 'ct_problem', + xl('Is this a Medical Problem code type?')); // Show the external code types selector $value_ct_external = isset($ct_array['ct_external']) ? $ct_array['ct_external'] : ''; echo " "; @@ -693,6 +697,7 @@ function mysubmit() { + > 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 de53a80374d..f513cf406f0 100644 --- a/sql/4_1_1-to-4_1_2_upgrade.sql +++ b/sql/4_1_1-to-4_1_2_upgrade.sql @@ -340,3 +340,15 @@ UPDATE procedure_order_code AS pc, procedure_order AS po ALTER TABLE `procedure_order` DROP COLUMN diagnoses; #EndIf +#IfMissingColumn lists modifydate +ALTER TABLE `lists` ADD COLUMN `modifydate` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; +#EndIf + +#IfMissingColumn code_types ct_problem +ALTER TABLE `code_types` ADD COLUMN `ct_problem` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1 if this code type is used as a medical problem'; +UPDATE code_types SET ct_problem = 1 WHERE ct_key='ICD9'; +UPDATE code_types SET ct_problem = 1 WHERE ct_key='DSMIV'; +UPDATE code_types SET ct_problem = 1 WHERE ct_key='ICD10'; +UPDATE code_types SET ct_problem = 1 WHERE ct_key='SNOMED'; +#EndIf + diff --git a/sql/database.sql b/sql/database.sql index 335d7facd63..5caf70a6413 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -3612,6 +3612,7 @@ CREATE TABLE `lists` ( `external_allergyid` INT(11) DEFAULT NULL, `erx_source` ENUM('0','1') DEFAULT '0' NOT NULL COMMENT '0-OpenEMR 1-External', `erx_uploaded` ENUM('0','1') DEFAULT '0' NOT NULL COMMENT '0-Pending NewCrop upload 1-Uploaded TO NewCrop', + `modifydate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `pid` (`pid`), KEY `type` (`type`) @@ -5546,21 +5547,22 @@ CREATE TABLE code_types ( ct_claim tinyint(1) NOT NULL default 0 COMMENT '1 if this is used in claims', ct_proc tinyint(1) NOT NULL default 0 COMMENT '1 if this is a procedure type', ct_term tinyint(1) NOT NULL default 0 COMMENT '1 if this is a clinical term', + ct_problem tinyint(1) NOT NULL default 0 COMMENT '1 if this code type is used as a medical problem', PRIMARY KEY (ct_key) ) ENGINE=MyISAM; -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('ICD9' , 2, 1, 0, '' , 0, 0, 0, 1, 1, 'ICD9 Diagnosis', 4, 1, 0, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('CPT4' , 1, 2, 12, 'ICD9', 1, 0, 0, 0, 1, 'CPT4 Procedure/Service', 0, 1, 1, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('HCPCS', 3, 3, 12, 'ICD9', 1, 0, 0, 0, 1, 'HCPCS Procedure/Service', 0, 1, 1, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('CVX' , 100, 100, 0, '', 0, 0, 1, 0, 1, 'CVX Immunization', 0, 0, 0, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('DSMIV' , 101, 101, 0, '', 0, 0, 0, 1, 0, 'DSMIV Diagnosis', 0, 1, 0, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('ICD10' , 102, 102, 0, '', 0, 0, 0, 1, 0, 'ICD10 Diagnosis', 1, 1, 0, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('SNOMED' , 103, 103, 0, '', 0, 0, 0, 1, 0, 'SNOMED Diagnosis', 2, 1, 0, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('CPTII' , 104, 104, 0, 'ICD9', 0, 0, 0, 0, 0, 'CPTII Performance Measures', 0, 1, 0, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('ICD9-SG' , 105, 105, 12, 'ICD9', 1, 0, 0, 0, 0, 'ICD9 Procedure/Service', 5, 1, 1, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('ICD10-PCS' , 106, 106, 12, 'ICD10', 1, 0, 0, 0, 0, 'ICD10 Procedure/Service', 6, 1, 1, 0); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('SNOMED-CT' , 107, 107, 0, '', 0, 0, 1, 0, 0, 'SNOMED Clinical Term', 7, 0, 0, 1); -INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term ) VALUES ('SNOMED-PR' , 108, 108, 0, 'SNOMED', 1, 0, 0, 0, 0, 'SNOMED Procedure', 9, 1, 1, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('ICD9' , 2, 1, 0, '' , 0, 0, 0, 1, 1, 'ICD9 Diagnosis', 4, 1, 0, 0, 1); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('CPT4' , 1, 2, 12, 'ICD9', 1, 0, 0, 0, 1, 'CPT4 Procedure/Service', 0, 1, 1, 0, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('HCPCS', 3, 3, 12, 'ICD9', 1, 0, 0, 0, 1, 'HCPCS Procedure/Service', 0, 1, 1, 0, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('CVX' , 100, 100, 0, '', 0, 0, 1, 0, 1, 'CVX Immunization', 0, 0, 0, 0, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('DSMIV' , 101, 101, 0, '', 0, 0, 0, 1, 0, 'DSMIV Diagnosis', 0, 1, 0, 0, 1); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('ICD10' , 102, 102, 0, '', 0, 0, 0, 1, 0, 'ICD10 Diagnosis', 1, 1, 0, 0, 1); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('SNOMED' , 103, 103, 0, '', 0, 0, 0, 1, 0, 'SNOMED Diagnosis', 2, 1, 0, 0, 1); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('CPTII' , 104, 104, 0, 'ICD9', 0, 0, 0, 0, 0, 'CPTII Performance Measures', 0, 1, 0, 0, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('ICD9-SG' , 105, 105, 12, 'ICD9', 1, 0, 0, 0, 0, 'ICD9 Procedure/Service', 5, 1, 1, 0, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('ICD10-PCS' , 106, 106, 12, 'ICD10', 1, 0, 0, 0, 0, 'ICD10 Procedure/Service', 6, 1, 1, 0, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('SNOMED-CT' , 107, 107, 0, '', 0, 0, 1, 0, 0, 'SNOMED Clinical Term', 7, 0, 0, 1, 0); +INSERT INTO code_types (ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_fee, ct_rel, ct_nofs, ct_diag, ct_active, ct_label, ct_external, ct_claim, ct_proc, ct_term, ct_problem ) VALUES ('SNOMED-PR' , 108, 108, 0, 'SNOMED', 1, 0, 0, 0, 0, 'SNOMED Procedure', 9, 1, 1, 0, 0); INSERT INTO list_options ( list_id, option_id, title, seq ) VALUES ('lists', 'code_types', 'Code Types', 1);