//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=insert&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&noresize={$noresize}&batch_nr={$batch_nr}"); 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"
$op_start .= ':00:00'; } $op_end = strtr($op_end, '.;,', ':::'); $s_count = substr_count($op_end, ':'); switch ($s_count) { case 0: $op_end .= ':00:00'; break; case 1: $op_end .= ':00'; break; case '': $op_end .= ':00:00'; } if ($update) { $sql = "UPDATE {$dbtable} SET\n\t\t\t\t\t\t\t\t\top_date='" . formatDate2STD($op_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\toperator='{$operator}',\n\t\t\t\t\t\t\t\t\tdiagnosis='{$diagnosis}',\n\t\t\t\t\t\t\t\t\tlocalize='{$localize}',\n\t\t\t\t\t\t\t\t\ttherapy='{$therapy}',\n\t\t\t\t\t\t\t\t\tspecial='" . $_POST['notes'] . "',\n\t\t\t\t\t\t\t\t\tclass_s='{$class_s}',\n\t\t\t\t\t\t\t\t\tclass_m='{$class_m}',\n\t\t\t\t\t\t\t\t\tclass_l='{$class_l}',\n\t\t\t\t\t\t\t\t\top_start='{$op_start}',\n\t\t\t\t\t\t\t\t\top_end='{$op_end}',\n\t\t\t\t\t\t\t\t\tscrub_nurse='{$scrub_nurse}',\n assistant='{$assistant}',\n\t\t\t\t\t\t\t\t\top_room='{$op_room}',\n\t\t\t\t\t\t\t\t\thistory=" . $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\tmodify_id='" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\tmodify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t\tWHERE nr='{$nr}'"; if ($ergebnis = $enc_obj->Transact($sql)) { header("location:op-doku-start.php?sid={$sid}&lang={$lang}&target={$target}&mode=saveok&pn={$pn}&nr={$nr}&dept_nr={$dept_nr}"); exit; } else { echo "{$sql}<br>{$LDDbNoUpdate}"; } } else { $sql = "INSERT INTO {$dbtable}\n\t\t\t\t\t\t\t\t(\tdept_nr,\n\t\t\t\t\t\t\t\t\top_date,\n\t\t\t\t\t\t\t\t\toperator,\n\t\t\t\t\t\t\t\t\tencounter_nr,\n\t\t\t\t\t\t\t\t\tdiagnosis,\n\t\t\t\t\t\t\t\t\tlocalize,\n\t\t\t\t\t\t\t\t\ttherapy,\n\t\t\t\t\t\t\t\t\tspecial,\n\t\t\t\t\t\t\t\t\tclass_s,\n\t\t\t\t\t\t\t\t\tclass_m,\n\t\t\t\t\t\t\t\t\tclass_l,\n\t\t\t\t\t\t\t\t\top_start,\n\t\t\t\t\t\t\t\t\top_end,\n\t\t\t\t\t\t\t\t\tscrub_nurse,\n assistant, \n\t\t\t\t\t\t\t\t\top_room,\n\t\t\t\t\t\t\t\t\thistory,\n\t\t\t\t\t\t\t\t\tcreate_id,\n\t\t\t\t\t\t\t\t\tcreate_time\n\t\t\t\t\t\t\t\t\t ) \n\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t'{$dept_nr}',\n\t\t\t\t\t\t\t\t\t'" . formatDate2STD($op_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t'{$operator}', \n\t\t\t\t\t\t\t\t\t'{$pn}',\n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($diagnosis) . "', \n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($localize) . "', \n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($therapy) . "', \n\t\t\t\t\t\t\t\t\t'" . htmlspecialchars($_POST['notes']) . "', \n\t\t\t\t\t\t\t\t\t'{$class_s}', \n\t\t\t\t\t\t\t\t\t'{$class_m}', \n\t\t\t\t\t\t\t\t\t'{$class_l}', \n\t\t\t\t\t\t\t\t\t'{$op_start}',\n\t\t\t\t\t\t\t\t\t'{$op_end}',\n\t\t\t\t\t\t\t\t\t'{$scrub_nurse}',\n '{$assistant}', \n\t\t\t\t\t\t\t\t\t'{$op_room}',\n\t\t\t\t\t\t\t\t\t'Create: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\t'" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t)"; //echo $sql; if ($ergebnis = $enc_obj->Transact($sql)) { $oid = $db->Insert_ID(); $enc_obj->coretable = $dbtable; $nr = $enc_obj->LastInsertPK('nr', $oid); header("location:op-doku-start.php?sid={$sid}&lang={$lang}&target={$target}&mode=saveok&pn={$pn}&nr={$nr}&dept_nr={$dept_nr}"); exit;
//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}"); exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ''; } break; // end of case 'save' // end of case 'save' case 'done': $sql = "UPDATE care_test_findings_" . $db_request_table . " SET \n\t\t\t\t\t\t\t\t\t\t status='done',\n\t\t\t\t\t\t\t\t\t\t history=" . $enc_obj->ConcatHistory("Done: " . 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)) {
} else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ""; } } //end of prepareTestElements() break; // end of case 'save' // end of case 'save' case 'update': $material_type_list =& prepareTestParameters('_mx_'); /* _mx_ = test material */ $test_type_list =& prepareTestParameters('_tx_'); /* _tx_ = test type */ if ($material_type_list || $test_type_list) { $sql = "UPDATE care_test_request_" . $db_request_table . " SET\n\t\t\t\t\t\t\t\t\t\t dept_nr='" . $dept_nr . "',\n\t\t\t\t\t\t\t\t\t\t material='" . $material_type_list . "',\n\t\t\t\t\t\t\t\t\t\t test_type='" . $test_type_list . "',\n\t\t\t\t\t\t\t\t\t\t material_note='" . htmlspecialchars($material_note) . "', \n\t\t\t\t\t\t\t\t\t\t diagnosis_note='" . htmlspecialchars($diagnosis_note) . "',\n\t\t\t\t\t\t\t\t\t\t immune_supp='" . $immune_supp . "',\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='" . $_COOKIE[$local_user . $sid] . "',\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?sid={$sid}&lang={$lang}&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 = ""; } } //end of prepareTestElements() break;
if ($released) { if (!empty($info)) { $data_array['notes'] = $info; $data_array['encounter_nr'] = $pn; $data_array['date'] = $date; $data_array['time'] = $time; $data_array['personell_name'] = $encoder; $enc_obj->saveDischargeNotesFromArray($data_array); } # If patient died if ($relart == 7) { include_once $root_path . 'include/care_api_classes/class_person.php'; $person = new Person(); $death['death_date'] = $date; $death['death_encounter_nr'] = $pn; $death['history'] = $enc_obj->ConcatHistory("Discharged (cause: death) " . date('Y-m-d H:i:s') . " {$encoder}\n"); $death['modify_id'] = $encoder; $death['modify_time'] = date('YmdHis'); @$person->setDeathInfo($enc_obj->PID(), $death); //echo $person->getLastQuery(); } //echo ("location:$thisfile?sid=$sid&lang=$lang&pn=$pn&bd=$bd&rm=$rm&pyear=$pyear&pmonth=$pmonth&pday=$pday&mode=$mode&released=1&lock=1&x_date=$x_date&x_time=$x_time&relart=$relart&encoder=".strtr($encoder," ","+")."&info=".strtr($info," ","+")."&station=$station&ward_nr=$ward_nr"); header("location:{$thisfile}?sid={$sid}&lang={$lang}&pn={$pn}&bd={$bd}&rm={$rm}&pyear={$pyear}&pmonth={$pmonth}&pday={$pday}&mode={$mode}&released=1&lock=1&x_date={$x_date}&x_time={$x_time}&relart={$relart}&encoder=" . strtr($encoder, " ", "+") . "&info=" . strtr($info, " ", "+") . "&station={$station}&ward_nr={$ward_nr}"); exit; } } // end of if (mode=release) include_once $root_path . 'include/care_api_classes/class_globalconfig.php'; $GLOBAL_CONFIG = array(); $glob_obj = new GlobalConfig($GLOBAL_CONFIG); $glob_obj->getConfig('patient_%');
/* Set script mode to no edit*/ $formtitle = $LDChemicalLaboratory; $dept_nr = 24; // 24 = department Nr. chemical lab $subtarget = 'chemlabor'; require_once $root_path . 'include/care_api_classes/class_encounter.php'; $enc_obj = new Encounter(); require_once $root_path . 'include/care_api_classes/class_lab.php'; $lab_obj = new Lab(); /* Here begins the real work */ if (!isset($mode)) { $mode = ''; } switch ($mode) { case 'done': $sql = "UPDATE care_test_request_" . $subtarget . "\r\n\t\t\t\t\t\t\t\t\t\t\tSET status = 'done',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory=" . $enc_obj->ConcatHistory("Done: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmodify_id = '" . $_SESSION['sess_user_name'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tmodify_time = '" . date('YmdHis') . "'\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE batch_nr = '" . $batch_nr . "'"; if ($ergebnis = $enc_obj->Transact($sql)) { include_once $root_path . 'include/inc_diagnostics_report_fx.php'; //echo $sql; /* If the findings are saved, signal the availability of report */ signalNewDiagnosticsReportEvent('', 'labor_test_request_printpop.php'); if (!$discharge) { header("location:" . $thisfile . URL_REDIRECT_APPEND . "&edit={$edit}&pn={$pn}&user_origin={$user_origin}&status={$status}&target={$target}&subtarget={$subtarget}&noresize={$noresize}"); } else { header('Location: ../ambulatory/amb_clinic_discharge.php' . URL_REDIRECT_APPEND . '&pn=' . $pn . '&pyear=' . date("Y") . '&pmonth=' . date("n") . '&pday=' . date(j) . '&tb=' . str_replace("#", "", $cfg['top_bgcolor']) . '&tt=' . str_replace("#", "", $cfg['top_txtcolor']) . '&bb=' . str_replace("#", "", $cfg['body_bgcolor']) . '&d=' . $cfg['dhtml'] . '&station=' . $station . '&backpath=' . urlencode('../laboratory/labor_test_request_admin_chemlabor.php') . '&dept_nr=' . $dept_nr); } exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = "";
//include_once('../include/inc_editor_fx.php'); if (!isset($mode)) { $mode = ''; } switch ($mode) { case 'update': $sql = "UPDATE care_test_request_blood SET \n status = 'received', blood_pb = '" . htmlspecialchars($blood_pb) . "', blood_rb = '" . htmlspecialchars($blood_rb) . "', blood_llrb = '" . htmlspecialchars($blood_llrb) . "', \n\t\t\t\t\t\t\t\t blood_wrb = '" . htmlspecialchars($blood_wrb) . "',blood_prp = '" . htmlspecialchars($blood_prp) . "', blood_tc = '" . htmlspecialchars($blood_tc) . "', \n\t\t\t\t\t\t\t\t blood_ffp = '" . htmlspecialchars($blood_ffp) . "', b_group_count = '" . $b_group_count . "', \n\t\t\t\t\t\t\t\t b_group_price = '" . $b_group_price . "', a_subgroup_count = '" . $a_subgroup_count . "', a_subgroup_price = '" . $a_subgroup_price . "', \n\t\t\t\t\t\t\t\t extra_factors_count = '" . $extra_factors_count . "', extra_factors_price = '" . $extra_factors_price . "', coombs_count = '" . $coombs_count . "', \n\t\t\t\t\t\t\t\t coombs_price = '" . $coombs_price . "', ab_test_count = '" . $ab_test_count . "', ab_test_price = '" . $ab_test_price . "', \n\t\t\t\t\t\t\t\t crosstest_count = '" . $crosstest_count . "', crosstest_price = '" . $crosstest_price . "', ab_diff_count = '" . $ab_diff_count . "', \n\t\t\t\t\t\t\t\t ab_diff_price = '" . $ab_diff_price . "', x_test_1_code = '" . $x_test_1_code . "', x_test_1_name = '" . htmlspecialchars($x_test_1_name) . "', \n\t\t\t\t\t\t\t\t x_test_1_count = '" . $x_test_1_count . "', x_test_1_price = '" . $x_test_1_price . "', x_test_2_code = '" . $x_test_2_code . "', \n\t\t\t\t\t\t\t\t x_test_2_name = '" . htmlspecialchars($x_test_2_name) . "', x_test_2_count = '" . $x_test_2_count . "', x_test_2_price = '" . $x_test_2_price . "', \n\t\t\t\t\t\t\t\t x_test_3_code = '" . $x_test_3_code . "', x_test_3_name = '" . htmlspecialchars($x_test_3_name) . "', x_test_3_count = '" . $x_test_3_count . "', \n\t\t\t\t\t\t\t\t x_test_3_price = '" . $x_test_3_price . "', lab_stamp = '" . $lab_stamp . "', release_via = '" . htmlspecialchars($release_via) . "', \n\t\t\t\t\t\t\t\t receipt_ack = '" . htmlspecialchars($receipt_ack) . "', mainlog_nr = '" . htmlspecialchars($mainlog_nr) . "', lab_nr = '" . htmlspecialchars($lab_nr) . "'"; $lab_date = formatDate2STD($lab_date, $date_format); if (!empty($lab_date)) { $sql .= ", lab_date = '" . $lab_date . "'"; } $mainlog_date = formatDate2STD($mainlog_date, $date_format); if (!empty($mainlog_date)) { $sql .= ", mainlog_date = '" . $mainlog_date . "'"; } $sql .= ", mainlog_sign = '" . htmlspecialchars($mainlog_sign) . "', lab_sign = '" . htmlspecialchars($lab_sign) . "',\n\t\t\t\t\t\t\t\t history = " . $enc_obj->ConcatHistory("Ack: " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t modify_id = '" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\tmodify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t WHERE batch_nr = '" . $batch_nr . "'"; if ($ergebnis = $enc_obj->Transact($sql)) { //echo $sql; signalNewDiagnosticsReportEvent('', 'labor_test_request_printpop.php'); header("location:" . $thisfile . "?sid={$sid}&lang={$lang}&edit={$edit}&saved=update&pn={$pn}&station={$station}&user_origin={$user_origin}&status={$status}&target={$target}&subtarget={$subtarget}&batch_nr={$batch_nr}&noresize={$noresize}"); exit; } else { echo "<p>{$sql}<p>{$LDDbNoSave}"; $mode = ""; } break; // end of case 'save' // end of case 'save' case 'done': $sql = "UPDATE care_test_request_blood SET \n\t\t\t\t\t\t\t\t status = 'done',\n\t\t\t\t\t\t\t\t history = " . $enc_obj->ConcatHistory("Done " . date('Y-m-d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n") . ",\n\t\t\t\t\t\t\t\t modify_id = '" . $_SESSION['sess_user_name'] . "',\n\t\t\t\t\t\t\t\t\tmodify_time='" . date('YmdHis') . "'\n\t\t\t\t\t\t\t\t WHERE batch_nr = '" . $batch_nr . "'"; if ($ergebnis = $enc_obj->Transact($sql)) {
case 'save': $sql = "INSERT INTO care_test_findings_" . $db_request_table . " \n (\n\t\t\t\t\t\t\t\t\t\t batch_nr, encounter_nr, room_nr, dept_nr, \n\t\t\t\t\t\t\t\t\t\t notes, findings_init, findings_current, \n\t\t\t\t\t\t\t\t\t\t findings_final, entry_nr, rec_date, \n\t\t\t\t\t\t\t\t\t\t type_general, resist_anaerob, \n\t\t\t\t\t\t\t\t\t\t resist_aerob, findings, doctor_id, findings_date, \n\t\t\t\t\t\t\t\t\t\t findings_time, status, 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 . "','" . $room_nr . "','" . $dept_nr . "',\n\t\t\t\t\t\t\t\t\t\t '" . htmlspecialchars($notes) . "','" . $findings_init . "','" . $findings_current . "',\n\t\t\t\t\t\t\t\t\t\t '" . $findings_final . "','" . $entry_nr . "','" . formatDate2Std($rec_date, $date_format) . "',\n\t\t\t\t\t\t\t\t\t\t '" . $type_general . "','" . $resist_anaerob . "',\n\t\t\t\t\t\t\t\t\t\t '" . $resist_aerob . "','" . $findings . "','" . $doctor_id . "','" . date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t '" . date('H:i') . "','initial','Create: " . date('Y-m.d H:i:s') . " = " . $_SESSION['sess_user_name'] . "\n',\n\t\t\t\t\t\t\t\t\t\t '" . $_SESSION['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 )"; if ($ergebnis = $enc_obj->Transact($sql)) { signalNewDiagnosticsReportEvent(); //echo $sql; header("location:{$thisfile}?sid={$sid}&lang={$lang}&edit={$edit}&saved=insert&mode=edit_findings&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 notes = '" . htmlspecialchars($notes) . "', findings_init = '" . $findings_init . "', findings_current = '" . $findings_current . "', \n\t\t\t\t\t\t\t\t\t\t findings_final = '" . $findings_final . "', entry_nr = '" . $entry_nr . "', rec_date = '" . formatDate2Std($rec_date, $date_format) . "', \n\t\t\t\t\t\t\t\t\t\t type_general = '" . $type_general . "', resist_anaerob ='" . $resist_anaerob . "', resist_aerob = '" . $resist_aerob . "', \n\t\t\t\t\t\t\t\t\t\t findings = '" . $findings . "', doctor_id = '', findings_date = '" . date('Y-m-d') . "', \n\t\t\t\t\t\t\t\t\t\t findings_time = '" . date('H:i') . "', \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)) { signalNewDiagnosticsReportEvent(); //echo $sql; header("location:{$thisfile}?sid={$sid}&lang={$lang}&edit={$edit}&saved=insert&mode=edit_findings&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 'done': $sql = "UPDATE care_test_findings_" . $db_request_table . " SET \n\t\t\t\t\t\t\t\t\t\t status='done', \n\t\t\t\t\t\t\t\t\t\t history =" . $enc_obj->ConcatHistory("Done: " . 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)) {
// 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); //echo $sql; header("location:" . $root_path . "modules/laboratory/labor_test_request_aftersave.php?sid=" . $sid . "&lang=" . $lang . "&edit=" . $edit . "&saved=insert&pn=" . $pn . "&station=" . $station . "&user_origin=" . $user_origin . "&status=" . $status . "&target=" . $target . "&noresize=" . $noresize . "&batch_nr=" . $batch_nr); 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\t\t batch_nr='" . $batch_nr . "', \n\t\t\t\t\t\t\t\t\t\t encounter_nr='" . $pn . "', \n\t\t\t\t\t\t\t\t\t\t dept_nr='" . $dept_nr . "', \n\t\t\t\t\t\t\t\t\t\t blood_group='" . $blood_group . "', \n\t\t\t\t\t\t\t\t\t\t rh_factor='" . $rh_factor . "', \n\t\t\t\t\t\t\t\t\t\t kell='" . $kell . "', \n\t\t\t\t\t\t\t\t\t\t date_protoc_nr='" . htmlspecialchars($date_protoc_nr) . "', \n\t\t\t\t\t\t\t\t\t\t pure_blood='" . $pure_blood . "', \n\t\t\t\t\t\t\t\t\t\t red_blood='" . $red_blood . "', \n\t\t\t\t\t\t\t\t\t\t leukoless_blood='" . $leukoless_blood . "', \n\t\t\t\t\t\t\t\t\t\t washed_blood='" . $washed_blood . "', \n\t\t\t\t\t\t\t\t\t\t prp_blood='" . $prp_blood . "', \n\t\t\t\t\t\t\t\t\t\t thrombo_con='" . $thrombo_con . "', \n\t\t\t\t\t\t\t\t\t\t ffp_plasma='" . $ffp_plasma . "', \n\t\t\t\t\t\t\t\t\t\t transfusion_dev='" . $transfusion_dev . "', \n\t\t\t\t\t\t\t\t\t\t match_sample='" . $match_sample . "', \n\t\t\t\t\t\t\t\t\t\t transfusion_date='" . formatDate2Std($transfusion_date, $date_format) . "', \n\t\t\t\t\t\t\t\t\t\t diagnosis='" . htmlspecialchars($diagnosis) . "', \n\t\t\t\t\t\t\t\t\t\t notes='" . htmlspecialchars($notes) . "', \n\t\t\t\t\t\t\t\t\t\t send_date='" . formatDate2Std($send_date, $date_format) . "', \n\t\t\t\t\t\t\t\t\t\t doctor='" . $doctor . "', \n\t\t\t\t\t\t\t\t\t\t phone_nr='" . $phone_nr . "', \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='" . $_COOKIE[$local_user . $sid] . "',\n\t\t\t\t\t\t\t\t\t\t modify_time='" . date('YmdHis') . "'\n WHERE batch_nr = '" . $batch_nr . "'"; if ($ergebnis = $enc_obj->Transact($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); //echo $sql; header("location:" . $root_path . "modules/laboratory/labor_test_request_aftersave.php?sid=" . $sid . "&lang=" . $lang . "&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"
$sql = "UPDATE {$dbtable} \n\t\t\t\t\t\t\t\t\tSET encoding='" . $content['encoding'] . "'"; if (!empty($diagnosis)) { $sql .= ",diagnosis=" . $enc_obj->ConcatFieldString('diagnosis', htmlspecialchars($diagnosis) . "\n"); $updateitem .= ' diagnosis;'; } $sql .= ",anesthesia='{$anesthesia}',\n\t\t\t\t\t\t\t\t\tentry_out='" . $content['entry_out'] . "',\n\t\t\t\t\t\t\t\t\tcut_close='" . $content['cut_close'] . "'"; if (!empty($op_therapy)) { $sql .= ",op_therapy=" . $enc_obj->ConcatFieldString('op_therapy', htmlspecialchars($op_therapy) . "\n"); $updateitem .= ' op_therapy;'; } if (!empty($result_info)) { $sql .= ",result_info=" . $enc_obj->ConcatFieldString('result_info', htmlspecialchars($result_info) . "\n"); $updateitem .= ' result_info;'; } # Append update item names to history $sql .= ",history = " . $enc_obj->ConcatHistory("Updated " . $updateitem . " " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n"); $sql .= "\tWHERE nr=" . $item['nr']; if ($ergebnis = $enc_obj->Transact($sql)) { //echo $sql." new update <br>"; header("location:{$thisfile}?sid={$sid}&lang={$lang}&mode=saveok&enc_nr={$enc_nr}&dept_nr={$dept_nr}&saal={$saal}&thisday={$thisday}&op_nr={$op_nr}"); exit; } else { echo "{$sql}<br>{$LDDbNoSave}<br>"; } } else { // Else no record yet, create new entry # first get the last op number $dbtable = 'care_encounter_op'; $sql = "SELECT op_nr FROM {$dbtable} WHERE dept_nr='{$dept_nr}' AND op_room='{$saal}' ORDER BY op_nr DESC"; //echo $sql; if ($ergebnis = $db->Execute($sql)) {