Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improvements in problem lists for MU2.
1) Added a new field "modifydate" in table "lists" which
   will be updated each time the medication is updated.
2) Added new field "ct_problem" in the table "code_types"
   for setting the code types to be displayed while
   adding a "Medical Problem".
3) Made modifications in Add/Edit issue interface to list
   the code types set as "ct_problem".

Signed-off-by: vinish <vinish@zhservices.com>
  • Loading branch information
vinish authored and bradymiller committed Mar 15, 2013
1 parent d06123a commit ba952a1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 18 deletions.
12 changes: 10 additions & 2 deletions custom/code_types.inc.php
Expand Up @@ -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
*
* </pre>
*
* Copyright (C) 2006-2010 Rod Roark <rod@sunsetsystems.com>
Expand Down Expand Up @@ -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'];
}
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
}
Expand Down
19 changes: 17 additions & 2 deletions interface/patient_file/summary/add_edit_issue.php
Expand Up @@ -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 != '') {
Expand Down Expand Up @@ -420,18 +421,32 @@ 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;
} else {
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=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
<?php
if($irow['type'] == 'medical_problem')
{
?>
dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("medical_problem","csv")) ?>', '_blank', 500, 400);
<?php
}
else{
?>
dlgopen('../encounter/find_code_popup.php?codetype=<?php echo attr(collect_codetypes("diagnosis","csv")) ?>', '_blank', 500, 400);
<?php
}
?>
}

// Check for errors when the form is submitted.
Expand Down
9 changes: 7 additions & 2 deletions interface/super/edit_list.php
Expand Up @@ -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' , " .
Expand All @@ -80,7 +81,8 @@
"'$ct_external', " .
"'$ct_claim', " .
"'$ct_proc', " .
"'$ct_term' " .
"'$ct_term', " .
"'$ct_problem' " .
")");
}
}
Expand Down Expand Up @@ -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 " <td title='" . xla('Is this using external sql tables? If it is, then choose the format.') . "' align='center' class='optcell'>";
Expand Down Expand Up @@ -693,6 +697,7 @@ function mysubmit() {
<td><b><?php xl('Procedure' ,'e'); ?></b></td>
<td><b><?php xl('Diagnosis' ,'e'); ?></b></td>
<td><b><?php xl('Clinical Term','e'); ?></b></td>
<td><b><?php xl('Medical Problem' ,'e'); ?></b></td>
<td><b><?php xl('External' ,'e'); ?></b></td>
<?php } else { ?>
<td title=<?php xl('Click to edit','e','\'','\''); ?>><b><?php xl('ID','e'); ?></b></td>
Expand Down
12 changes: 12 additions & 0 deletions sql/4_1_1-to-4_1_2_upgrade.sql
Expand Up @@ -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

26 changes: 14 additions & 12 deletions sql/database.sql
Expand Up @@ -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`)
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit ba952a1

Please sign in to comment.