74 lines
2.1 KiB
PHP
74 lines
2.1 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include('log_entry.php');
|
|
error_log("Start Printing Request Attributes for device order save");
|
|
$requestStr = "";
|
|
foreach ($_REQUEST as $key => $value) {
|
|
$requestStr .= $key . " : " . $value . "\n";
|
|
error_log($key . " : " . $value . "<br />\r\n");
|
|
}
|
|
error_log("End Printing Request Attributes end here");
|
|
|
|
save_log($requestStr, 'Device Order', 'SAVE', 'save_device_order.php');
|
|
begin();
|
|
$id = $_REQUEST['device_order_id'];
|
|
|
|
error_log("param " . print_r($_POST['param_name'], true));
|
|
|
|
$param_arr = $_POST['param_name'];
|
|
|
|
$param_arr = array_unique($param_arr);
|
|
|
|
|
|
$patient_id = $_POST['emp_id'];
|
|
|
|
$checkup_id = $_POST['checkup_id'];
|
|
|
|
|
|
$section_ids = $_POST['checkup_section_id'];
|
|
|
|
|
|
$second_part = 0;
|
|
|
|
if (is_array($section_ids)) {
|
|
sort($section_ids);
|
|
$second_part = $section_ids[0];
|
|
} else {
|
|
$second_part = $section_ids[0];
|
|
}
|
|
|
|
|
|
for ($i = 0; $i < sizeof($param_arr); $i++) {
|
|
|
|
$query = "select * from device_param_map where checkup_parameter_id = '" . $param_arr[$i] . "'";
|
|
|
|
error_log("query to get data " . $query);
|
|
|
|
$result = mysqli_query($conn, $query);
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$accession_no = "";
|
|
|
|
$device_id = $row['device_id'];
|
|
|
|
$device_name = getTableFieldValue('device_master', 'device_name', 'device_id', $device_id);
|
|
|
|
// $section_id = getTableFieldValue('checkup_parameter', 'checkup_form_section_id', 'checkup_parameter_id', $row['checkup_parameter_id']);
|
|
|
|
|
|
$param_name = trim($row['device_param_code']);
|
|
|
|
$accession_no = $checkup_id . $second_part;
|
|
|
|
$order_query = "insert into device_order (accession_number,online_testcode,patient_id,device_id,device_name,checkup_id) values ('" . $accession_no . "','" . $param_name . "','" . $patient_id . "','" . $device_id . "','" . $device_name . "','" . $checkup_id . "'); ";
|
|
|
|
error_log("Device Order::" . $order_query);
|
|
if (!$order_result = @mysqli_query($conn, $order_query)) {
|
|
error_log("error " . mysqli_error($conn) . " query " . $order_query);
|
|
rollback();
|
|
}
|
|
}
|
|
}
|
|
commit();
|