/**
*  signalNewDiagnosticsReportEvent will set an event instance in the 
*  care_nursing_station_patients_diagnostics_report table
*  signalling the availability of a report.
*  param $report_date = the date (in local format) of the creation of the report
*  param $script_name = the script string that will be used to run the display of the report
*  return 
*/
function signalNewDiagnosticsReportEvent($report_date = '', $script_name)
{
    global $db, $local_user, $sid, $batch_nr, $pn, $target, $dept_nr, $formtitle, $subtarget, $LDDbNoRead, $LDDbNoSave, $date_format, $entry_date, $root_path;
    // $_SESSION;
    # Check if the formatDate2Local function is loaded
    if (!function_exists('formatDate2Local')) {
        include_once $root_path . 'include/inc_date_format_functions.php';
    }
    # Load the visual signalling defined constants
    if (!function_exists('setEventSignalColor')) {
        include_once $root_path . 'include/inc_visual_signalling_fx.php';
    }
    # Create a core object
    include_once $root_path . 'include/care_api_classes/class_core.php';
    $core =& new Core();
    $entry_table = 'care_encounter_diagnostics_report';
    $report_exits = 0;
    # assume that report does not exist yet
    if (empty($report_date)) {
        $report_date = date('Y-m-d');
    } else {
        $report_date = formatDate2Std($report_date, $date_format);
    }
    # Check first if a copy is already existing. If yes = update entry, no = insert new entry
    $sql = "SELECT item_nr FROM {$entry_table} WHERE report_nr={$batch_nr}";
    if ($ergebnis = $db->Execute($sql)) {
        if ($ergebnis->RecordCount()) {
            $report = $ergebnis->FetchRow();
            $sql = "UPDATE {$entry_table} SET\n\t\t\t\t\t\treport_date='" . $report_date . "',\n\t\t\t\t\t\treport_time='" . date('H:i:s') . "',\n\t\t\t\t\t\tstatus='pending',\n\t\t\t\t\t\thistory=" . $core->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\tmodify_id='" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\tmodify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\tWHERE item_nr='" . $report['item_nr'] . "'";
        } else {
            $sql = "INSERT INTO  {$entry_table}\n\t\t\t\t\t(\n\t\t\t\t\t\treport_nr,\n\t\t\t\t\t\treport_date,\n\t\t\t\t\t\treport_time,\n\t\t\t\t\t\treporting_dept,\n\t\t\t\t\t\treporting_dept_nr,\n\t\t\t\t\t\tencounter_nr,\n\t\t\t\t\t\tscript_call,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t\thistory,\n\t\t\t\t\t\tcreate_id,\n\t\t\t\t\t\tcreate_time\n\t\t\t\t\t)\n\t\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t'{$batch_nr}',\n\t\t\t\t\t\t'" . $report_date . "',\n\t\t\t\t\t\t'" . date('H:i:s') . "',\n\t\t\t\t\t\t'{$formtitle}',\n\t\t\t\t\t\t'{$dept_nr}',\n\t\t\t\t\t\t'{$pn}',\n\t\t\t\t\t\t'" . $script_name . "?entry_date=" . $entry_date . "&target=" . $target . "&subtarget=" . $subtarget . "&dept_nr=" . $dept_nr . "&batch_nr=" . $batch_nr . "&pn=" . $pn . "',\n\t\t\t\t\t\t'pending',\n\t\t\t\t\t\t'Initial report: " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n\r',\n\t\t\t\t\t\t'" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t'" . date('YmdHis') . "'\n\t\t\t\t\t)";
        }
        //echo $sql;
        if ($ergebnis = $core->Transact($sql)) {
            /* If the findings are succesfully saved, make an entry into the care_encounter_diagnostics_report table
             *  for signalling purposes
             */
            if ($script_name == "labor_test_findings_radio") {
                setEventSignalColor($pn, SIGNAL_COLOR_RADIOLOGY_REPORT, SIGNAL_COLOR_LEVEL_FULL);
            } else {
                setEventSignalColor($pn, SIGNAL_COLOR_DIAGNOSTICS_REPORT, SIGNAL_COLOR_LEVEL_FULL);
            }
            return true;
        } else {
            echo "{$sql} {$LDDbNoSave}";
            // for debugging. comment out for normal runs
            return false;
        }
    } else {
        echo "{$sql} {$LDDbNoRead}";
        // for debugging. comment out for normal runs
        return false;
    }
}
     include_once $root_path . 'include/inc_visual_signalling_fx.php';
     if ($presc_obj->GetClassOfItem($article_item_number) == 'drug_list') {
         // Set the visual signal
         setEventSignalColor($encounter_nr, SIGNAL_COLOR_DOCTOR_INFO);
     } else {
         if ($presc_obj->GetClassOfItem($article_item_number) == 'supplies') {
             // Set the visual signal
             setEventSignalColor($encounter_nr, SIGNAL_COLOR_CONSUMABLES);
         } else {
             if ($presc_obj->GetClassOfItem($article_item_number) == 'service') {
                 // Set the visual signal
                 setEventSignalColor($encounter_nr, SIGNAL_COLOR_SERVICES);
             } else {
                 if ($presc_obj->GetClassOfItem($article_item_number) == 'dental' || $presc_obj->GetClassOfItem($article_item_number) == 'minor_proc_op' || $presc_obj->GetClassOfItem($article_item_number) == 'obgyne_op' || $presc_obj->GetClassOfItem($article_item_number) == 'ortho_op' || $presc_obj->GetClassOfItem($article_item_number) == 'surgical_op') {
                     // Set the visual signal
                     setEventSignalColor($encounter_nr, SIGNAL_COLOR_PROCEDURES);
                 }
             }
         }
     }
     //********
     break;
     //if (isset($externalcall))
     //  header("location:".$thisfile.URL_REDIRECT_APPEND."&target=$target&type_nr=$type_nr&allow_update=1&externalcall=".$externalcall."&pid=".$_SESSION['sess_pid']);
     //exit;
     //break;
 //if (isset($externalcall))
 //  header("location:".$thisfile.URL_REDIRECT_APPEND."&target=$target&type_nr=$type_nr&allow_update=1&externalcall=".$externalcall."&pid=".$_SESSION['sess_pid']);
 //exit;
 //break;
 case 'update':
         exit;
     } else {
         echo "<p>{$sql}<p>{$LDDbNoSave}";
         $mode = "";
     }
     break;
     // end of case 'save'
 // end of case 'save'
 case 'update':
     $sql = "UPDATE care_test_request_" . $db_request_table . " SET \n\t\t\t\t\t\t\t\t          dept_nr = '" . $dept_nr . "', \n\t\t\t\t\t\t\t\t\t\t  quick_cut = '" . $quick_cut . "', \n\t\t\t\t\t\t\t\t\t\t  qc_phone = '" . $qc_phone . "', \n\t\t\t\t\t\t\t\t\t\t  quick_diagnosis = '" . $quick_diagnosis . "',\n\t\t\t\t\t\t\t\t\t\t  qd_phone = '" . $qd_phone . "', \n\t\t\t\t\t\t\t\t\t\t  material_type = '" . $material_type . "',\n\t\t\t\t\t\t\t\t\t\t  material_desc = '" . htmlspecialchars($material_desc) . "', \n\t\t\t\t\t\t\t\t\t\t  localization = '" . htmlspecialchars($localization) . "',\n\t\t\t\t\t\t\t\t\t\t  clinical_note = '" . htmlspecialchars($clinical_note) . "', \n\t\t\t\t\t\t\t\t\t\t  extra_note = '" . htmlspecialchars($extra_note) . "', \n\t\t\t\t\t\t\t\t\t\t  repeat_note = '" . htmlspecialchars($repeat_note) . "',\n\t\t\t\t\t\t\t\t\t\t  gyn_last_period = '" . htmlspecialchars($gyn_last_period) . "', \n\t\t\t\t\t\t\t\t\t\t  gyn_period_type = '" . htmlspecialchars($gyn_period_type) . "', \n\t\t\t\t\t\t\t\t\t\t  gyn_gravida = '" . htmlspecialchars($gyn_gravida) . "',\n\t\t\t\t\t\t\t\t\t\t  gyn_menopause_since = '" . htmlspecialchars($gyn_menopause_since) . "', \n\t\t\t\t\t\t\t\t\t\t  gyn_hysterectomy = '" . htmlspecialchars($gyn_hysterectomy) . "',\n\t\t\t\t\t\t\t\t\t\t  gyn_contraceptive = '" . htmlspecialchars($gyn_contraceptive) . "', \n\t\t\t\t\t\t\t\t\t\t  gyn_iud = '" . htmlspecialchars($gyn_iud) . "', \n\t\t\t\t\t\t\t\t\t\t  gyn_hormone_therapy = '" . htmlspecialchars($gyn_hormone_therapy) . "',\n\t\t\t\t\t\t\t\t\t\t  doctor_sign = '" . htmlspecialchars($doctor_sign) . "', \n\t\t\t\t\t\t\t\t\t\t  op_date = '" . formatDate2STD($op_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t\t  status = '" . $status . "', \n\t\t\t\t\t\t\t\t\t\t  history = " . $enc_obj->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t\t\t  modify_id = '" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\t\t  modify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\t\t   WHERE batch_nr = '" . $batch_nr . "'";
     if ($ergebnis = $enc_obj->Transact($sql)) {
         //echo $sql;
         // Load the visual signalling functions
         include_once $root_path . 'include/inc_visual_signalling_fx.php';
         // Set the visual signal
         setEventSignalColor($pn, SIGNAL_COLOR_DIAGNOSTICS_REQUEST);
         header("location:" . $root_path . "modules/laboratory/labor_test_request_aftersave.php" . URL_REDIRECT_APPEND . "&edit={$edit}&saved=update&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&batch_nr={$batch_nr}&noresize={$noresize}");
         exit;
     } else {
         echo "<p>{$sql}<p>{$LDDbNoSave}";
         $mode = "";
     }
     break;
     // end of case 'save'
     /* If mode is edit, get the stored test request when its status is either "pending" or "draft"
      *  otherwise it is not editable anymore which happens when the lab has already processed the request,
      *  or when it is discarded, hidden, locked, or otherwise. 
      *
      *  If the "parameter" element is not empty, parse it to the $stored_param variable
      */
 // end of case 'save'
$radtests = $db->Execute($sql);
$stored_tests = $radtests->FetchRow();
if (!isset($mode) && $batch_nr && $pn) {
    $mode = 'edit';
}
switch ($mode) {
    case 'save':
        $sql = "INSERT INTO care_test_findings_" . $db_request_table . " \n\t\t\t\t\t\t\t\t          (\n\t\t\t\t\t\t\t\t\t\t   batch_nr, encounter_nr, dept_nr, \n\t\t\t\t\t\t\t\t\t\t   findings, diagnosis,\n\t\t\t\t\t\t\t\t\t\t   doctor_id, findings_date, findings_time, \n\t\t\t\t\t\t\t\t\t\t   status, \n\t\t\t\t\t\t\t\t\t\t   history,\n\t\t\t\t\t\t\t\t\t\t  create_id,\n\t\t\t\t\t\t\t\t\t\t  create_time\n\t\t\t\t\t\t\t\t\t\t  )\n\t\t\t\t\t\t\t\t\t\t   VALUES\n\t\t\t\t\t\t\t\t\t\t   (\n\t\t\t\t\t\t\t\t\t\t   '" . $batch_nr . "','" . $pn . "','" . $dept_nr . "', \n\t\t\t\t\t\t\t\t\t\t   '" . addslashes(htmlspecialchars($findings)) . "','" . addslashes(htmlspecialchars($diagnosis)) . "',\n\t\t\t\t\t\t\t\t\t\t   '" . htmlspecialchars($doctor_id) . "', '" . formatDate2Std($findings_date, $date_format) . "', '" . date('H:i:s') . "',\n\t\t\t\t\t\t\t\t\t\t   'initial',  \n\t\t\t\t\t\t\t\t\t\t   'Create: " . date('Y-m-d H:i:s') . " = " . $HTTP_SESSION_VARS['sess_user_name'] . "\n',\n\t\t\t\t\t\t\t\t\t\t  '" . $HTTP_SESSION_VARS['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\t\t  '" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\t\t   )";
        $script_name = "labor_test_findings_radio";
        if ($ergebnis = $enc_obj->Transact($sql)) {
            signalNewDiagnosticsReportEvent($findings_date, $script_name);
            //echo $sql;
            // Load the visual signalling functions
            include_once $root_path . 'include/inc_visual_signalling_fx.php';
            // Set the visual signal
            setEventSignalColor($pn, SIGNAL_COLOR_RADIOLOGY_REPORT);
            header("location:{$thisfile}?sid={$sid}&lang={$lang}&edit={$edit}&saved=insert&mode=edit&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&subtarget={$subtarget}&noresize={$noresize}&batch_nr={$batch_nr}&entry_date={$entry_date}");
            exit;
        } else {
            echo "<p>{$sql}<p>{$LDDbNoSave}";
            $mode = '';
        }
        break;
        // end of case 'save'
    // end of case 'save'
    case 'update':
        $sql = "UPDATE care_test_findings_" . $db_request_table . "  SET \n\t\t\t\t\t\t\t\t\t\t   findings='" . addslashes(htmlspecialchars($findings)) . "', \n\t\t\t\t\t\t\t\t\t\t   diagnosis='" . addslashes(htmlspecialchars($diagnosis)) . "',\n\t\t\t\t\t\t\t\t\t\t   doctor_id='" . htmlspecialchars($doctor_id) . "', \n\t\t\t\t\t\t\t\t\t\t   findings_date='" . formatDate2Std($findings_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t\t   findings_time='" . date('H:i:s') . "', \n\t\t\t\t\t\t\t\t\t\t   history=" . $enc_obj->ConcatHistory("Update: " . date('Y-m-d H:i:s') . " = " . $HTTP_SESSION_VARS['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t\t\t   modify_id = '" . $HTTP_SESSION_VARS['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\t\t   modify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\t\t   WHERE batch_nr = '" . $batch_nr . "'";
        if ($ergebnis = $enc_obj->Transact($sql)) {
            signalNewDiagnosticsReportEvent($findings_date);
            //echo $sql;
            header("location:{$thisfile}?sid={$sid}&lang={$lang}&edit={$edit}&saved=insert&mode=edit&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&subtarget={$subtarget}&noresize={$noresize}&batch_nr={$batch_nr}&entry_date={$entry_date}");
             } else {
                 $saved = false;
                 echo "<p>{$report_obj->sql}{$LDDbNoSave}";
             }
         }
         if ($dateput2 && $berichtput2 && $author2) {
             if (!$_POST['ref_notes_nr']) {
                 $_POST['timeput'] = date('H:i:s');
             }
             if ($dateput2) {
                 $_POST['dateput2'] = formatDate2STD($dateput2, $date_format);
             }
             $_POST['berichtput2'] = deactivateHotHtml($berichtput2);
             if ($report_obj->saveEffectivityReport($_POST)) {
                 // Set the visual signal
                 setEventSignalColor($pn, SIGNAL_COLOR_NURSE_REPORT, SIGNAL_COLOR_LEVEL_FULL);
                 $saved = true;
             } else {
                 $saved = false;
                 echo "<p>{$report_obj->sql}{$LDDbNoSave}";
             }
         }
         if ($saved) {
             header("location:{$thisfile}?sid={$sid}&lang={$lang}&saved=1&pn={$pn}&station={$station}&edit={$edit}");
         }
     } else {
         $saved = false;
     }
 } else {
     // end of if(mode==save)
     $enc_obj->where = " encounter_nr={$pn}";
Exemplo n.º 6
0
                    $parsedParamList['paramater_name'] = $key;
                    $parsedParamList['parameter_value'] = $value;
                    $lab_obj_sub->setDataArray($parsedParamList);
                    $lab_obj_sub->insertDataFromInternalArray();
                }
            }
            $saved = true;
        } else {
            echo "<p>" . $lab_obj->getLastQuery() . "{$LDDbNoSave}";
        }
    }
    # If save successful, jump to display values
    if ($saved) {
        include_once $root_path . 'include/inc_visual_signalling_fx.php';
        # Set the visual signal
        setEventSignalColor($encounter_nr, SIGNAL_COLOR_DIAGNOSTICS_REPORT);
        header("location:labor_test_request_admin_chemlabor.php?sid={$sid}");
        exit;
    }
    # end of if(mode==save)
} else {
    #If mode is not "save" then get the basic personal data
    if ($debug) {
        echo "mode is not save then get the basic personal data<br>";
    }
    # If previously saved, get the values
    if ($saved) {
        if ($result =& $lab_obj->getBatchResult($batch_nr)) {
            while ($row = $result->FetchRow()) {
                $pdata[$row['paramater_name']] = $row['parameter_value'];
            }
            } else {
                $saved = false;
                echo "<p>{$report_obj->sql}{$LDDbNoSave}";
            }
        }
        if ($dateput2 && $berichtput2 && $author2) {
            if (!$_POST['ref_notes_nr']) {
                $_POST['timeput'] = date('H:i:s');
            }
            if ($dateput2) {
                $_POST['dateput2'] = formatDate2STD($dateput2, $date_format);
            }
            $_POST['berichtput2'] = deactivateHotHtml($berichtput2);
            if ($report_obj->saveInquiry($_POST)) {
                // Set the visual signal
                setEventSignalColor($pn, SIGNAL_COLOR_QUERY_DOCTOR, SIGNAL_COLOR_LEVEL_FULL);
                $saved = true;
            } else {
                $saved = false;
                echo "<p>{$report_obj->sql}{$LDDbNoSave}";
            }
        }
        if ($saved) {
            header("location:{$thisfile}?sid={$sid}&lang={$lang}&saved=1&pn={$pn}&station={$station}&edit={$edit}");
        }
    } else {
        $saved = false;
    }
} else {
    // end of if(mode==save)
    $enc_obj->where = " encounter_nr={$pn}";
Exemplo n.º 8
0
        } else {
            continue;
        }
    }
    if ($saved) {
        if ($mark_antibiotic) {
            setEventSignalColor($pn, SIGNAL_COLOR_ANTIBIOTIC);
        }
        if ($mark_diuretic) {
            setEventSignalColor($pn, SIGNAL_COLOR_DIURETIC);
        }
        if ($mark_anticoag) {
            setEventSignalColor($pn, SIGNAL_COLOR_ANTICOAG);
        }
        if ($mark_iv) {
            setEventSignalColor($pn, SIGNAL_COLOR_IV);
        }
        header("location:{$thisfile}?sid={$sid}&lang={$lang}&edit={$edit}&saved=1&pn={$pn}&station={$station}&winid={$winid}&yr={$yr}&mo={$mo}&dy={$dy}&dyidx={$dyidx}&dystart={$dystart}&dyname={$dyname}");
        exit;
    }
}
// end of if(mode==save)
$count = 0;
$medis = $charts_obj->getAllCurrentPrescription($pn);
if (is_object($medis)) {
    $count = $medis->RecordCount();
}
?>

<?php 
html_rtl($lang);
Exemplo n.º 9
0
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2005 Robert Meggle based on the development of Elpidio Latorilla (2002,2003,2004,2005)
* elpidio@care2x.org, meggle@merotech.de
*
* See the file "copy_notice.txt" for the licence notice
*/
//define('NO_2LEVEL_CHK',1);
//require($root_path.'include/inc_front_chain_lang.php');
$lang_tables[] = 'diagnoses_ICD10.php';
require $root_path . 'include/inc_front_chain_lang.php';
//Load the diagnstics-class:
require_once $root_path . 'include/care_api_classes/class_tz_diagnostics.php';
$diagnostic_obj = new Diagnostics();
/*

 print_r ( $_SESSION );
echo "<br>";
echo "das will ich sehen: ".$_SESSION['sess_full_en'];
*/
if ($todo == 'submit') {
    // Load the visual signalling functions
    include_once $root_path . 'include/inc_visual_signalling_fx.php';
    // Set the visual signal
    setEventSignalColor($_SESSION['sess_en'], SIGNAL_COLOR_QUERY_DOCTOR);
    $diagnostic_obj->EnterNewCase($_POST);
}
require "gui/gui_icd10_diagnose.php";