<?php include('techsyn_emp_header.php'); error_reporting(E_ERROR | E_PARSE); ?> <link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" /> <script src="assets/js/bootstrap-datepicker.min.js"></script> <?php if(isset($_SESSION['__SSOAuthenticated_username'])){ //to allow SSO Employee Users for whom specific role setup is not in place but still can access as Patient their individual records. $emp_id = getFieldFromTable('id', 'patient_master', 'offiial_email_id', $_SESSION['__SSOAuthenticated_username'] ); $_SESSION['logged_user_empid'] =$emp_id; }else{ $emp_id = getTableFieldValue('tbl_users', 'emp_id', 'user_id', $_SESSION['user_id']); } $id = $emp_id; $sql = "select * from patient_master where id = '$id' "; $result = @mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { $row = @mysqli_fetch_array($result); } foreach($row as $x => $val) { if($val=='' || $val==null){ $row[$x]='NA'; } } $sql2 = "select * from health_advice"; $result2 = @mysqli_query($conn, $sql2); if (mysqli_num_rows($result2) > 0) { $row2 = @mysqli_fetch_array($result2); } $sql3 = "select * from health_risk"; $result3 = @mysqli_query($conn, $sql3); if (mysqli_num_rows($result3) > 0) { $row3 = @mysqli_fetch_array($result3); } $sql4 = "select * from training"; // training table not present ==> training_master $result4 = mysqli_query($conn, $sql4); $row4 = mysqli_fetch_array($result4); $query5 = "SELECT height, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and height != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='height') order by dat desc limit 1"; error_log("height " . $query5); $result5 = @mysqli_query($conn, $query5); $row5 = mysqli_fetch_array($result5); $query6 = "SELECT `weight`, date(appointment_date) as dat FROM employee_appointment where emp_id='$id' and `weight` != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='weight') order by dat desc limit 1"; error_log("weight " . $query6); $result6 = @mysqli_query($conn, $query6); $row6 = mysqli_fetch_array($result6); $query7 = "SELECT heart_rate as pulse, date(appointment_date) as dat FROM employee_appointment where emp_id='$id' and heart_rate != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='pulse') order by dat desc limit 1"; error_log("pulse " . $query7); $result7 = @mysqli_query($conn, $query7); $row7 = mysqli_fetch_array($result7); $query8 = "SELECT bmi, date(appointment_date) as dat FROM employee_appointment where emp_id='$id' and bmi != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='bmi') order by dat desc limit 1"; error_log("bmi " . $query8); $result8 = @mysqli_query($conn, $query8); $row8 = mysqli_fetch_array($result8); $query9 = "SELECT bp_sbp as sbp, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and bp_sbp != '' UNION SELECT cf.checkup_form_value as sbp ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and (cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp') or cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp/dbp')) order by dat desc limit 1"; error_log("systolic_blood_pressure " . $query9); $result9 = @mysqli_query($conn, $query9); $row9 = mysqli_fetch_array($result9); $query11 = "SELECT bp_dbp as dbp, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and bp_sbp != '' UNION SELECT cf.checkup_form_value as dbp ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and (cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='dbp') or cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp/dbp')) order by dat desc limit 1"; error_log("systolic_blood_pressure " . $query11); $result11 = @mysqli_query($conn, $query11); $row11 = mysqli_fetch_array($result11); $sbp = ""; $dbp = ""; $bp_arr = explode("/", $row9['sbp']); error_log("size " . sizeof($bp_arr)); if (sizeof($bp_arr) > 1) { $sbp = $bp_arr[0]; } else { $sbp = $bp_arr[0]; } $bp_arr = explode("/", $row11['dbp']); error_log("size " . sizeof($bp_arr)); if (sizeof($bp_arr) > 1) { $dbp = $bp_arr[1]; } else { $dbp = $bp_arr[0]; } $bp = $sbp ; if($dbp!='' && $dbp!=null){ $bp .= "/" . $dbp; } $query10 = "SELECT health_index from checkup_form where emp_id='$id' order by checkup_date desc limit 1"; error_log("health index query " . $query10); $result10 = @mysqli_query($conn, $query10); $row10 = mysqli_fetch_array($result10); $query12 = "SELECT blood_sugar_fbs as fbs, date(appointment_date) as dat FROM employee_appointment where emp_id='$id' and blood_sugar_fbs != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='fbs') order by dat desc limit 1"; error_log("fbs " . $query12); $result12 = @mysqli_query($conn, $query12); $row12 = mysqli_fetch_array($result12); $query13 = "SELECT blood_sugar_rbs as rbs, date(appointment_date) as dat FROM employee_appointment where emp_id='$id' and blood_sugar_rbs != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='rbs') order by dat desc limit 1"; error_log("fbs " . $query13); $result13 = @mysqli_query($conn, $query13); $row13 = mysqli_fetch_array($result13); $query14 = "SELECT blood_sugar_ppbs as ppbs, date(appointment_date) as dat FROM employee_appointment where emp_id='$id' and blood_sugar_ppbs != '' UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='ppbs') order by dat desc limit 1"; error_log("fbs " . $query14); $result14 = @mysqli_query($conn, $query14); $row14 = mysqli_fetch_array($result14); function calcBMI($weight, $height) { $bmi = ($weight / ($height * $height)) * 10000; return round($bmi, 1) . PHP_EOL; } function ppa($past_illness) { $params = ''; $param_present = explode(', ', $past_illness); foreach ($param_present as $x => $val) { $params .= getFieldFromTable('param_name', 'history_parameter', 'param_id', $val) . "<br>"; } return $params; } function healthAdvices($past_advices) { $params = ''; $param_present = explode(', ', $past_advices); foreach ($param_present as $x => $val) { $params .= getFieldFromTable('health_advice_name', 'health_advice', 'health_advice_id', $val) . "<br>"; } return $params; } ?> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="js/Chart.min.js"></script> <script src=" https://cdn.jsdelivr.net/npm/sweetalert2@11.7.12/dist/sweetalert2.all.min.js "></script> <link href=" https://cdn.jsdelivr.net/npm/sweetalert2@11.7.12/dist/sweetalert2.min.css " rel="stylesheet"> <style type="text/css"> #empHistory thead th, #familyMembersTable thead th, #medical_exam_history_table thead th, #dose-table thead th, #opd_injury_table thead th, #sickness_table thead th, #health_advices_and_risks thead th, #document-table thead th, #past-illness thead th { background-color: #0d6efd; color: white; } #past_travel_details td, #past_travel_feedback td { font-size: 11px; } .main_icon { width: 60px; height: 60px; background: #F3F3F3; /* color:#201B1B;*/ display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; border: none; margin: 20px 10px; } .rounded-button { width: 60px; height: 60px; background: #F3F3F3; color: #201B1B; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; border: none; text-decoration: none; margin: 20px 10px; box-sizing: border-box; transition: all 1s; } .rounded-button { position: relative; } /* .rounded-button:hover { color: white; } */ .rounded-button::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-top-left-radius: 30px; border-bottom-left-radius: 30px; border-top-right-radius: 30px; border-bottom-right-radius: 30px; background-color: #F3F3F3; transition: width 0.4s ease-in-out; } .rounded-button:hover::before { width: 100px; background-color: #0079B4; border-top-right-radius: 30px; border-bottom-right-radius: 30px; border-top-left-radius: 30px; border-bottom-left-radius: 30px; } .hover-text { display: none; position: absolute; /* top: 100%;*/ left: 50px; transition: all 0.5s; transform: translateX(-50%); } .rounded-button:hover .hover-text { color: white; display: block; } /*.active ion-icon{ color: #0079B4; } */ .active i { color: #0079B4; } .tab-pane { color: black; } .division-box2 { margin: 0px; border-radius: 0px 10px 10px 0px; } .label_box { text-align: left; font-size: 14px; font-weight: bold; color: rgba(37, 34, 34, 0.7); } #travel_form select { background-color: #EDF4F7; border: 1px solid rgba(249, 249, 249, 0.7); transition: all 0.2s; } #travel_form select:hover { box-shadow: 3px 3px 0px 3px #3A99FF; } #travel_form input { background-color: #EDF4F7; border: 1px solid rgba(249, 249, 249, 0.7); transition: all 0.2s; } #travel_form input:hover { box-shadow: 3px 3px 0px 3px #3A99FF; } #travel_form input::placeholder { color: darkgray; /* Set the color to a lighter shade */ font-weight: normal; font-size: 16px; /* Remove the font weight */ } #travel, #past_travel { box-shadow: rgba(0, 0, 0, 0.07) 0px 1px 2px, rgba(0, 0, 0, 0.07) 0px 2px 4px, rgba(0, 0, 0, 0.07) 0px 4px 8px, rgba(0, 0, 0, 0.07) 0px 8px 16px, rgba(0, 0, 0, 0.07) 0px 16px 32px, rgba(0, 0, 0, 0.07) 0px 32px 64px; } #advisory_table { width: 100%; border-collapse: separate; border-spacing: 0 10px; } #advisory_table th { /* background-color: rgba(0, 87, 211, 0.9);*/ background-color: #0d6efd; color: rgba(255, 255, 255, 1.0); font-size: 12px; } #advisory_table tr { border-radius: 10px; outline: none; border: none; box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px; font-size: 14px; } #past_travel_details th, #past_travel_feedback th { font-size: 12px; width: 20%; } #past_travel_details td, #past_travel_feedback td { transition: all 0.5s; } #past_travel_details td:hover, #past_travel_feedback td:hover { background-color: #EBF3FF; } .container { display: flex; flex-direction: column; align-items: center; gap: 40px; max-width: 400px; width: 100%; } .container .steps { display: flex; width: 100%; align-items: center; justify-content: space-between; position: relative; } .steps .circle { display: flex; align-items: center; justify-content: center; height: 50px; width: 50px; color: #999; font-size: 22px; font-weight: 500; border-radius: 50%; background: #fff; border: 4px solid #e0e0e0; transition: all 200ms ease; transition-delay: 0s; } .steps .circle.active { transition-delay: 100ms; border-color: #4070f4; color: #4070f4; } .steps .progress-bar { position: absolute; height: 4px; width: 100%; background: #e0e0e0; z-index: -1; } .progress-bar .indicator { position: absolute; height: 10px; width: 0%; background: #4070f4; transition: all 300ms ease; } .container .buttons { display: flex; gap: 20px; } .buttons button { padding: 8px 25px; background: #4070f4; border: none; border-radius: 8px; color: #fff; font-size: 16px; font-weight: 400; cursor: pointer; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05); transition: all 200ms linear; } .buttons button:active { transform: scale(0.97); } .buttons button:disabled { background: #87a5f8; cursor: not-allowed; } .add_row_btn { background: #F3F3F3; color: #201B1B; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 5px; border: none; text-decoration: none; /* margin: 20px 10px;*/ box-sizing: border-box; } .main { display: flex; flex-direction: row; justify-content: space-evenly; align-items: baseline; padding: 10px; /* margin: 10px; */ color: black; background: linear-gradient(to right, white, skyblue); } .prescription-medicine, .travel-medicine, .essentials-medicine, .first-aid-medicine { display: flex; flex-direction: column; justify-content: center; align-items: baseline; flex-wrap: wrap; width: 25%; } .h1 { font-size: large; font-weight: bold; } input[type="checkbox"] { cursor: pointer; } .item { padding: 5px; /* margin: 10px; */ display: flex; flex-direction: row; justify-content: center; } /*PART A*/ .emp-details, .health-details, .curr-health-div { display: flex; flex-direction: row; justify-content: space-between; align-items: center; background: whitesmoke; font-size: 12px; } .emp-details .detail, .curr-health-div .detail { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 15px; color: black; animation-duration: 2s; animation-iteration-count: infinite; /* transform-origin: bottom; */ cursor: pointer; border-radius: 10px; } .emp-details .detail:hover { background-color: #388087; color: white; } /* @keyframes bounce { 0% { transform: translateY(0); } 50% { transform: translateY(-50px); } 100% { transform: translateY(0); } } */ .emp-details> :first-child, .curr-health-div> :first-child { background: linear-gradient(45deg, #c2edce, transparent); width: 10rem; } .curr-health-div textarea { width: 16rem; height: 70px; border-radius: 10px; border: none; resize: none; } .curr-health-div label { background: linear-gradient(45deg, #c2edce, transparent); padding: 10px; margin: 5px; border-radius: inherit; } .header { background: rgb(45, 180, 243); color: white; text-align: center; } .header p { margin: 0 5rem 0 5rem; } .header svg { display: block; } .main-form { width: 50%; margin-left: 25%; margin-top: -150px; background-color: whitesmoke; position: absolute; } .main-form form { padding: 25px; margin: 25px; } .form-group { padding: 5px; margin: 5px; } </style> <div style="margin-top:115px"></div> <div class="container-fluid row p-2"> <div class="col-1"> <ul class="nav flex-column" id="myTabs"> <?php $sql_root = "select distinct(m.menu_id),m.menu_name,m.menu_description,trim(m.menu_url) as menu_url,m.parent_id,m.icon_text from assign_menu a, menu_master m where a.menu_id= m.menu_id and parent_id<=0 and a.role_id='" . $_SESSION['RoleId'] . "' order by disp_seq"; error_log("menu query " . $sql_root); $res_root = mysqli_query($conn, $sql_root); $num_rows_root = @mysqli_num_rows($res_root); if ($num_rows_root > 0) { while ($root_rowmaster = @mysqli_fetch_array($res_root)) { ?> <li class="nav-item"> <div class="mt-2 main_icon"> <a data-toggle="tab" class="nav-link rounded-button" aria-current="page" href="#<?= $root_rowmaster['menu_url'] ?>"> <i class="<?= $root_rowmaster['icon_text'] ?>"></i> <span class="hover-text"><?= $root_rowmaster['menu_name'] ?></span> </a> </div> </li> <?php } } ?> </ul> </div> <form style="display: none" name="flex_medical_form_pdf" method="post" action="" target="_blank" id="flex_medical_form_pdf"> <input type="hidden" name="medical_exam_id" id="medical_exam_id"> </form> <form style="display: none" name="flex_fitness_form_pdf" method="post" action="" target="_blank" id="flex_fitness_form_pdf"> <input type="hidden" name="flex_sickness_id" id="flex_sickness_id"> </form> <form style="display: none" name="flex_form_pdf" method="post" action="" target="_blank" id="flex_form_pdf"> <input type="hidden" name="medical_examform_id" id="medical_examform_id"> </form> <form style="display: none" name="flex_opd_injury_pdf" method="post" action="" target="_blank" id="flex_opd_injury_pdf"> <input type="hidden" name="appointment_idpdf" id="appointment_idpdf"> </form> <!-- TAB DATA --> <div class="container-fluid tab-content col-11"> <div id="patient_details" class="tab-pane fade show active"> <div class="row rounded-4" style="width: 100%;"> <ul class="nav nav-pills mb-3 shadow rounded nav-fill" id="pills-tab" role="tablist" style="background-color: white; font-size: small;"> <li class="nav-item" role="presentation"> <button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">Info <i class="fa fa-circle-user fa-spin"></i></button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">Contact <i class="fas fa-phone fa-shake"></i></button> </li> <!-- <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-family-tab" data-bs-toggle="pill" data-bs-target="#pills-family" type="button" role="tab" aria-controls="pills-family" aria-selected="false">Family Members <i class="fas fa-users fa-fade"></i></button> </li> --> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-medical-tab" data-bs-toggle="pill" data-bs-target="#pills-medical" type="button" role="tab" aria-controls="pills-medical" aria-selected="false">Medical Examination <i class="fas fa-book-medical fa-flip"></i></button> </li> <!-- <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-vaccine-tab" data-bs-toggle="pill" data-bs-target="#pills-vaccine" type="button" role="tab" aria-controls="pills-vaccine" aria-selected="false">Vaccination <i class="fas fa-syringe fa-beat-fade"></i></button> </li> --> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-opd-injury-tab" data-bs-toggle="pill" data-bs-target="#pills-opd-injury" type="button" role="tab" aria-controls="pills-opd-injury" aria-selected="false">Opd/Injury <i class="fas fa-capsules fa-spin"></i></button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-sickness-tab" data-bs-toggle="pill" data-bs-target="#pills-sickness" type="button" role="tab" aria-controls="pills-sickness" aria-selected="false">Sickness/Fitness <i class="fa-solid fa-disease fa-beat"></i></button> </li> <!-- <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-risk-tab" data-bs-toggle="pill" data-bs-target="#pills-risk" type="button" role="tab" aria-controls="pills-risk" aria-selected="false">Risk/Advice  <i class="fa-solid fa-comment-medical fa-flip"></i></button> </li> --> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-document-tab" data-bs-toggle="pill" data-bs-target="#pills-document" type="button" role="tab" aria-controls="pills-document" aria-selected="false">Document  <i class="fa-solid fa-folder-open fa-fade"></i></button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-illness-tab" data-bs-toggle="pill" data-bs-target="#pills-illness" type="button" role="tab" aria-controls="pills-illness" aria-selected="false">Chronic Illness  <i class="fa-regular fa-face-surprise"></i></button> </li> <!-- <li class="nav-item" role="presentation"> <button class="nav-link" id="problem-detail-tab" data-bs-toggle="pill" data-bs-target="#problem-detail" type="button" role="tab" aria-controls="problem-detail" aria-selected="false">Problem Detail <i class="fas fa-exclamation-triangle fa-shake"></i></button> </li> --> <!-- <li class="nav-item" role="presentation"> <button class="nav-link" id="problem-solved-tab" data-bs-toggle="pill" data-bs-target="#problem-solved" type="button" role="tab" aria-controls="problem-solved" aria-selected="false">Solved Problem <i class="fas fa-check-circle fa-shake"></i></button> </li> --> <li class="nav-item" role="presentation"> <button class="nav-link" id="book-appointment-tab" data-bs-toggle="pill" data-bs-target="#book-appointment" type="button" role="tab" aria-controls="book-appointment" aria-selected="false">Book Appointment <i class="fas fa-phone fa-shake"></i></button> </li> </ul> <div class="tab-content" id="pills-tabContent"> <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div class="card mb-3" style="border-radius: .5rem;"> <div class="row g-0 shadow"> <div class="col-md-2 text-center text-white" style="border-top-left-radius: .5rem; border-bottom-left-radius: .5rem;background: linear-gradient(to right bottom, #0d6efd, rgba(100,150,200,.5))"> <?php if (isset($row['photo']) && $row['photo'] != null && $row['photo'] != 'NA') { ?> <img src="data:<?php echo $row['image_type'] ?>;base64,<?php echo base64_encode($row['photo']) ?>" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;" /> <?php } else { $gender = $row['gender']; if ($gender == 'M') { ?> <img src="images/male-profile.png" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;" /> <?php } else { ?> <img src="images/female-profile.png" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;border-radius: 50px;" /> <?php } } ?> <div> <!-- <i class="fa-solid fa-droplet fa-bounce" style="color: red;"></i> --> <?php if($row['blood_group']!='NA') {echo 'Blood Group :'.$row['blood_group'];} ?> </div> <div> <h5 class="mt-5"> <?php echo $patient_name; ?> <?php if (isset($father_name) && $father_name != '') { ?><br>S/O <?php echo $father_name; } ?> </h5> </div> <div><?php echo $emp_code; ?></div> <div><?php if ($gender == 'M') { echo "Male"; } else if ($gender == 'F') { echo "Female"; } else echo "Other"; ?> , <?php echo floor((time() - strtotime($row['dob'])) / 31556926); ?></div> </div> <div class="col-md-10"> <div class="card-body p-4"> <h6>Profile</h6> <hr class="mt-0 mb-4"> <div class="row pt-1"> <div class="col-3 mb-3"> <h6>DOB :</h6> <p class="text-muted"> <?php if(!empty( $row['dob'])){ echo date_format(date_create($row['dob']), "d-M-Y "); }else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>Patient Category</h6> <p class="text-muted"> <?php $patient_cat_id=$row['patient_cat_id']; echo getTableFieldValue('patient_category', 'patient_cat_name', 'patient_cat_id', $patient_cat_id) ?> </p> </div> <?php if ($patient_cat_id != "2") { ?> <div class="col-3 mb-3"> <h6>Department</h6> <p class="text-muted"> <?php echo getTableFieldValue('department', 'dept_name', 'dept_id', $row['dept_id']); ?> </p> </div> <div class="col-3 mb-3"> <h6>Designation </h6> <p class="text-muted"> <?php if($row['designation_id']!=0 && $row['designation_id']!='NA' ) {echo getTableFieldValue('designation', 'designation_name', 'designation_id', $row['designation_id']);}else{ echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>Employee Cadre </h6> <p class="text-muted"> <?php if($row['employer_contractor_id']!=0 && $row['employer_contractor_id']!='NA' ) {echo getTableFieldValue('employer_contractor', 'employer_contractor_name', 'id', $row['employer_contractor_id']);}else{ echo 'NA';} ?> </p> </div> <div class="col-3 mb-3 "> <h6>Is First Aider</h6> <p class="text-muted"> <?php echo ($row['is_first_aid'] == 1) ? "Yes" : "No" ?></p> </div> <?php } ?> <div class="col-3 mb-3 "> <h6>Phone Number </h6> <p class="text-muted"> <?php if($row['primary_phone']!='' && $row['primary_phone']!=null) {echo $row['primary_phone'];}else {echo $row['personal_phone'];} ?> </p><br> </div> <div class="col-3 mb-3"> <h6>Aadhar Number </h6> <p class="text-muted"><?php echo $row['aadhar_no'] ?></p> </div> <div class="col-3 mb-3 "> <h6>Ohc Location </h6> <p class="text-muted"> <?php if($row['ohc_type_id']!=0 ) {echo getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', $row['ohc_type_id']);}else{ echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>Date Of Joining </h6> <p class="text-muted"> <?php if(!empty($row['doj'])){ echo date_format(date_create($row['doj']), "d-M-Y "); } ?> </p> </div> <div class="col-3 mb-3"> <h6>Status </h6> <p class="text-muted"> <?php echo $row['status'] == '0' ? 'InActive' : 'Active' ?> </p> </div> </div><br> <h6>Address</h6> <hr class="mt-0 mb-4"> <div class="row pt-1"> <div class="col-3 mb-3"> <h6>Residing Village :</h6> <p class="text-muted"><?php echo $row['village'] ?></p> </div> <div class="col-3 mb-3"> <h6>Post :</h6> <p class="text-muted"><?php echo $row['post'] ?></p> </div> <div class="col-3 mb-3"> <h6>Ps :</h6> <p class="text-muted"><?php echo $row['ps'] ?></p> </div> <div class="col-3 mb-3"> <h6>Tehsil :</h6> <p class="text-muted"><?php echo $row['tehsil'] ?></p> </div> <div class="col-3 mb-3"> <h6>District :</h6> <p class="text-muted"><?php echo $row['district'] ?></p> </div> <div class="col-3 mb-3"> <h6>State :</h6> <p class="text-muted"><?php echo $row['state'] ?></p> </div> </div> </div> </div> </div> </div> </div> </div> </div> <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div class="card mb-3" style="border-radius: .5rem;"> <div class="row g-0 shadow"> <!-- <div class="col-md-4 text-center text-white" style="border-top-left-radius: .5rem; border-bottom-left-radius: .5rem;background: linear-gradient(to right bottom, #0d6efd, rgba(100,150,200,.5))"> <img src="images/telephone-receiver-copy-space.jpg" alt="contact" class="img-fluid my-2" style="width: 80px;" /> </div> --> <div class="col-md-12"> <div class="card-body p-4"> <h6>Contact</h6> <hr class="mt-0 mb-4"> <div class="row pt-1"> <div class="col-3 mb-3"> <h6>Email :</h6> <p class="text-muted"><?php echo $row['email_id']; ?></p> </div> <div class="col-3 mb-3"> <h6>Personal Phone :</h6> <p class="text-muted"><?php echo $row['personal_phone'] ?></p> </div> </div><br> <h6>Emergency Contact</h6> <hr class="mt-0 mb-4"> <div class="row pt-1"> <div class="col-3 mb-3"> <h6>Primary Contact Person :</h6> <p class="text-muted"> <?php echo $row['primary_contact_person'] ?></p> </div> <div class="col-3 mb-3"> <h6>Primary Contact Number :</h6> <p class="text-muted"><?php echo $row['primary_contact_no'] ?> </p> </div> <div class="col-3 mb-3"> <h6>Secondary Contact Person :</h6> <p class="text-muted"> <?php echo $row['secondary_contact_person'] ?> </p> </div> <div class="col-3 mb-3"> <h6>Secondary Contact Number :</h6> <p class="text-muted"><?php echo $row['secondary_contact_no'] ?> </p> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!-- <div class="tab-pane fade" id="problem-detail" role="tabpanel" aria-labelledby="problem-detail-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div class="card mb-3" style="border-radius: .5rem;"> <div class="row g-0 shadow"> <div class="col-md-12"> <div class="card-body p-4"> <h6>Problem Details</h6> <hr class="mt-0 mb-4"> <div class="row pt-1" style="overflow:scroll; height:300px;"> <table class="table table-striped" style="overflow-y:scroll; height:100px;"> <thead> <tr> <th scope="col">Sr. No.</th> <th scope="col">Problem Detail</th> <th scope="col">Diagnosis Date</th> <th scope="col">Remission Date</th> <th style="width: 14%;" scope="col"></th> </tr> </thead> <tbody> <?php $sql_pro_data = "SELECT a.* , b.pid ,b.patient_id FROM problem_response_details a INNER JOIN problem_response b ON a.rid = b.rid WHERE b.patient_id ='$id' and a.remission_date is NULL ORDER by `pid` DESC,diagnosis_date"; error_log($sql_pro_data."get problem"); $results_pro = mysqli_query($conn, $sql_pro_data); $count_sr = 0; while ($get_pro_result = mysqli_fetch_array($results_pro)) { $count_sr = $count_sr + 1; $diagnosis_date = date('d-m-Y', strtotime($get_pro_result['diagnosis_date'])); $problem_detail = getFieldFromTable('allergy_name', 'allergies', 'allergy_id', $get_pro_result['rvalue']); ?> <tr> <th scope="row"><?php echo $count_sr ?></th> <td><?php echo $problem_detail ?></td> <td><?php echo $diagnosis_date ?></td> <td> <form role="form" id="problem_form" name="problem_form" action="#" method="post"> <input type="hidden" name="problem_id" id="problem_id" value="<?php echo $get_pro_result['vid'] ?>"> <input type="date" name="remission_date" id="remission_date"> </form> </td> <td><button type="button" onclick="save_problem();" class="btn btn-success btn-sm">save</button> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> --> <!-- <div class="tab-pane fade" id="problem-solved" role="tabpanel" aria-labelledby="problem-solved-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div class="card mb-3" style="border-radius: .5rem;"> <div class="row g-0 shadow"> <div class="col-md-12"> <div class="card-body p-4"> <h6>Solved Problem</h6> <hr class="mt-0 mb-4"> <div class="row pt-1" style="overflow:scroll; height:300px;"> <table class="table table-striped" style="overflow-y:scroll; height:100px;"> <thead> <tr> <th scope="col">Sr. No.</th> <th scope="col">Problem Detail</th> <th scope="col">Diagnosis Date</th> <th scope="col">Remission Date</th> </tr> </thead> <tbody> <?php $sql_pro_data = "SELECT a.* , b.pid ,b.patient_id FROM problem_response_details a INNER JOIN problem_response b ON a.rid = b.rid WHERE b.patient_id ='$id' and a.remission_date is NOT NULL ORDER by `pid` DESC,diagnosis_date"; error_log($sql_pro_data."get problem"); $results_pro = mysqli_query($conn, $sql_pro_data); $count_sr = 0; while ($get_pro_result = mysqli_fetch_array($results_pro)) { $count_sr = $count_sr + 1; if(!empty($get_pro_result['diagnosis_date'])){ $diagnosis_date = date('d-m-Y', strtotime($get_pro_result['diagnosis_date'])); } if(!empty($get_pro_result['remission_date'])){ $remission_date = date('d-m-Y', strtotime($get_pro_result['remission_date'])); } $problem_detail = getFieldFromTable('allergy_name', 'allergies', 'allergy_id', $get_pro_result['rvalue']); ?> <tr> <th scope="row"><?php echo $count_sr ?></th> <td><?php echo $problem_detail ?></td> <td><?php echo $diagnosis_date ?></td> <td><?php echo $remission_date ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> --> <div class="tab-pane" id="book-appointment" role="tabpanel" aria-labelledby="book-appointment-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <form role="form" id="appointment_form" name="appointment_form" action="#" method="post"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div class="card mb-3" style="border-radius: .5rem;"> <div class="row g-0 shadow"> <div class="col-md-12"> <div class="card-body p-4"> <h6>Book Appointment</h6> <hr class="mt-0 mb-4"> <div class="row pt-1"> <div class="col-4 mb-4"> <br> <label for=""> Appointment Type :</label> <div class="form-group"> <div class="input-group"> <input type="hidden" class="form-control" name="appointment_book_id" id="appointment_book_id" value="" /> <input type="hidden" class="form-control" name="patient_name_cc" id="patient_name_cc" value="<?= $emp_id ?>" /> <input type="hidden" class="form-control" name="available_slot" id="available_slot" value="0" /> <select class="form-control" id="appointment_booking_type" name="appointment_booking_type" onchange='is_medical(this.value),getSlotCount()' data-placeholder="Choose Doctor Names"> <option disabled selected>PLEASE SELECT OPTION </option> <!-- <option value="OPD">OPD</option> <option value="FIT">Sickness/Fitness</option> --> <option value="MED">Periodic Health Checkup </option> </select> </div> </div> </div> <div class="col-4 mb-4"><br> <h6> Select Date :</h6> <div class="form-group"> <div class="input-group"> <input class="form-control" type="date" name="appointment_book_date" id="appointment_book_date" onchange="getDocs(this.value,'');getSlotCount()"> </div> </div> </div> <div class="col-4 mb-4" id='doc_div' hidden> <br> <label for=""> Select Doctor :</label> <div class="form-group"> <div class="input-group"> <select class="form-control" id="doctor_name" name="doctor_name" onchange='getSlots(this.value,"");getSlotCount()' data-placeholder="Choose Doctor Names"> <option disabled selected value=''>Select Doctor </option> </select> </div> </div> </div> <div class="col-4 mb-4"><br> <h6> Select Slot :</h6> <div class="form-group"> <div class="input-group" id="slots"> <select class="form-control" id="doctor_slot" name="doctor_slot" onchange='getSlotCount()' data-placeholder="Choose Doctor Names"> <option disabled selected>PLEASE SELECT OPTION </option> </select> </div> </div> </div> </form> </div> <center> <div class="col-4 mb-4"> <div class="form-group"> <div id='slot_count'></div> <button style="align-items: center;" id='save_app' type="button" onclick="save_appointment();" class="btn btn-success">Book Appointment <i class="fa-solid fa-calendar-check" style="color: #fcfcfc;"></i></button> </div> </div> </center> <hr class="mt-0 mb-4"> <div class="row pt-1" style="overflow:scroll; height:300px;"> <table class="table table-striped" style="overflow-y:scroll; height:100px;"> <thead> <tr> <th scope="col">Sr. No.</th> <!-- <th scope="col">Doctor Name</th> --> <th scope="col">Date</th> <th scope="col">Time</th> <th scope="col">Appointment Type</th> <th scope="col">Status</th> <th scope="col"></th> </tr> </thead> <tbody> <?php $sql_get_data = "SELECT *,TIME_FORMAT(appoinment_slots.slot, '%h:%i %p') as slot,TIME_FORMAT(appoinment_slots.slot_end, '%h:%i %p') as slot_end,appointment_details.id as id FROM appointment_details left join appoinment_slots on appoinment_slots.slot_id=appointment_details.time WHERE emp_id='$id'"; error_log('xxx '.$sql_get_data); $results_section = mysqli_query($conn, $sql_get_data); $count_sr = 0; while ($get_result = mysqli_fetch_array($results_section)) { $count_sr = $count_sr + 1; $date_cc = date('d-m-Y', strtotime($get_result['date'])); $docter_name_cc = getFieldFromTable('patient_name', 'patient_master', 'id', $get_result['doctor_id']); ?> <tr> <th scope="row"><?php echo $count_sr ?></th> <!-- <td><?php if($get_result['app_type']=='MED'){ echo 'Medical Examiner';}else{echo $docter_name_cc;} ?> </td> --> <td><?php echo $date_cc ?></td> <td><?php if($get_result['app_type']=='MED'){ echo $get_result['slot'].' to '.$get_result['slot_end'];}else{echo $get_result['slot'];} ?> </td> <td><?php if($get_result['app_type']=='MED'){ echo 'Periodic Health Checkup';}elseif($get_result['app_type']=='FIT'){ echo 'Sickness/Fitness';}else{echo 'OPD';} ?> </td> <td><?php if($get_result['status']=='BOOKED'){ $status = "<p> <font color=red>Pending</font> </p>"; }else if($get_result['status']=='DRP'){ $status = "<p> <font color=red>Pending</font> </p>"; }else if($get_result['status']=='DRA'){ $status = "<p> <font color=green>Approved</font> </p>"; }else if($get_result['status']=='CANCELLED'){ $status = "<p> <font color=red>Cancelled</font> </p>"; } echo $status; ?></td> <td><?php if($get_result['status']=='BOOKED'){?> <a href="#" class="blue" onclick="open_employee_appointment(<?=$get_result['id']?>);"><i class="ace-icon fa fa-edit" style="font-size: 20px;"></i></a> <a href="#" class="red" onclick="delete_employee_appointment(<?=$get_result['id']?>);"><i class="ace-icon fa fa-trash-o" style="font-size: 20px;"></i></a> <?php }?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> <div class="tab-pane fade" id="pills-family" role="tabpanel" aria-labelledby="pills-family-tab"> <div class="table-responsive"> <table class="table table-bordered table-hover shadow rounded" id="familyMembersTable"> <thead style="background-color: #0d6efd; color: white;"> <tr> <th style="text-align:center">Sr</th> <th style="text-align:center">Name</th> <th style="text-align:center">Age</th> <!-- <th style="text-align:center">Gender</th> --> <th style="text-align:center">Relation Type</th> </tr> </thead> <tbody> <?php $count = 0; $sql_family_members = "select * from patient_master where primary_patient_id='$emp_id' "; $result_family_members = @mysqli_query($conn, $sql_family_members); $no_of_rows = mysqli_num_rows($result_family_members); if ($no_of_rows > 0) { ?> <input type="hidden" name="rowCount" id="rowCount" value="<?php echo $no_of_rows; ?>" /> <?php } else { ?> <input type="hidden" name="rowCount" id="rowCount" value="1" /> <?php } ?> <?php if ($no_of_rows > 0) { while ($row_family_members = @mysqli_fetch_array($result_family_members)) { ?> <tr id="familyMembersTableRow<?php echo $count; ?>"> <td align="center"> <?php echo $count + 1; ?></td> <td align="center"><?php echo $row_family_members['patient_name'] ?></td> <td align="center"><?php $from = new DateTime($row_family_members['dob']); $to = new DateTime('today'); echo $from->diff($to)->y; ?></td> <!-- <td align="center"> <?php echo ($row_family_members['gender'] == "M") ? " Male" : (($row_family_members['gender'] == "F"))? " Female": (($row_family_members['gender'] == "O") ? "Others" : "NA") ?> </td> --> <td align="center"> <?php echo $row_family_members['relation_type'] ?></td> </tr> <?php ++$count; } }else{ ?> <tr> <td align="center" colspan='4'> No Data Available</td> <tr> <?php } ?> </tbody> </table> </div> </div> <div class="tab-pane fade" id="pills-medical" role="tabpanel" aria-labelledby="pills-medical-tab"> <div class="table-responsive"> <table class="table table-bordered" id="medical_exam_history_table" style="width: 100%"> <thead> <tr align="center"> <th width="15%" style="text-align: center">S.No.</th> <th width="15%" style="text-align: center">Medical Examination Type</th> <th width="15%" style="text-align: center">Medical Examination Date</th> <th width="15%" style="text-align: center">Review By Doctor</th> <th width="15%" style="text-align: center">Medical forms</th> <th width="15%" style="text-align: center">Other Supporting Documents </th> </tr> </thead> <tbody> <?php $count = 1; $sql_for_medical_examination = "select * from checkup_form where emp_id=$emp_id order by checkup_date DESC " ; error_log("med history" . $sql_for_medical_examination); $result_for_medical_examination = mysqli_query($conn, $sql_for_medical_examination); if(mysqli_num_rows($result_for_medical_examination) > 0){ while ($row_for_medical_examination = mysqli_fetch_assoc($result_for_medical_examination)) { ?> <tr> <td align="center"><?php echo $count; ?> </td> <td align="center"><?php $chechup_type = getTableFieldValue('checkup_type', 'checkup_type_name', 'checkup_type_id', $row_for_medical_examination['checkup_type_id']); echo $chechup_type; ?> </td> <td align="center"> <?php echo strtoupper(date_format(date_create($row_for_medical_examination['checkup_date']), "d-M-Y ")); ?> </td> <td align="center"><?php $emp_id_doc = getTableFieldValue('tbl_users', 'emp_id', 'user_id', $row_for_medical_examination['doc_attend']); echo getTableFieldValue('patient_master', 'patient_name', 'id', $emp_id_doc); ?> </td> <td align="center"><?php $row_for_medical_examination['task'] = getTableFieldValue('checkup_type', 'checkup_type_code', 'checkup_type_id', $row_for_medical_examination['checkup_type_id']); $space = " "; echo $space . "<a href=\"checkup_form_pdf.php?checkup_id=" . $row_for_medical_examination['checkup_id'] . "\"class=\"red\" target=\"_blank\"><i class=\"fa fa-file-pdf-o\" style=\"font-size: 20px;\"></i></a>"; if ($row_for_medical_examination['task'] == 'pme' || $row_for_medical_examination['task'] == 'pme_short') echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_medical_pdf('peme_card.php','" . $row_for_medical_examination['medical_exam_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; else if ($row_for_medical_examination['task'] == 'pohc' || $row_for_medical_examination['task'] == 'pohc_half') echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_medical_pdf('pohc_card.php','" . $row_for_medical_examination['medical_exam_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; else if ($row_for_medical_examination['task'] == 'eye_check') echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_medical_pdf('eye_checkup_pdf.php','" . $row_for_medical_examination['medical_exam_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; else if ($row_for_medical_examination['task'] == 'foodhand_exam') echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_medical_pdf('food_handler_exam_pdf.php','" . $row_for_medical_examination['medical_exam_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; $sql_form = "select form_id,form_type,medical_exam_id from form_data where medical_exam_id = (select max(medical_exam_id) from medical_examination where patient_id = " . $emp_id . ")"; error_log("formmmmm" . $sql_form); $result_form = mysqli_query($conn, $sql_form); $row_form = mysqli_fetch_array($result_form); if (isset($row_form['form_id'])) { if ($row_form['form_type'] == 'form_25') { echo $space . "<a target=\"_blank\" class=\"red\" href=\"form_25_pdf.php?medical_exam_id=" . $row_form['medical_exam_id'] . "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Form 32\" ><i class=\"fa-solid fa-file-pdf\" style=\"font-size: 20px;\"></i></a> (Form 25)";; } else if ($row_form['form_type'] == 'form_O') { echo $space . "<a target=\"_blank\" class=\"red\" href=\"form_o_pdf.php?medical_exam_id=" . $row_form['medical_exam_id'] . "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Form 32\" ><i class=\"fa-solid fa-file-pdf\" style=\"font-size: 20px;\"></i></a> (Form O)"; } } ?> </td> <?php // $sql_id = "select medical_exam_id from medical_examination where patient_id = '".$_REQUEST['emp_id']."'"; // $result_id = mysqli_query($conn,$sql_id); // $row_id = mysqli_fetch_array($result_id); $sql_medical_doc = "select * from medical_document where checkup_id='" . $row_for_medical_examination['checkup_id'] . "' "; error_log("MEDICAL DOCUMENT QUERY::" . $sql_medical_doc); //echo $emp_id; $result_medical_doc = @mysqli_query($conn, $sql_medical_doc); $sql_medical_doc1 = "select * from checkup_section_medical_document where checkup_id='" . $row_for_medical_examination['checkup_id'] . "' "; error_log("MEDICAL DOCUMENT QUERY1::" . $sql_medical_doc1); //echo $emp_id; $result_medical_doc1 = @mysqli_query($conn, $sql_medical_doc1); ?> <td> <?php while ($row_medical_doc = @mysqli_fetch_array($result_medical_doc)) { if ($row_medical_doc['medical_doc_type'] == 'application/pdf') { ?> <a href='#'><img src='images/pdf.png' width='35' height='35' onclick='$("#med_doc_<?php echo $row_medical_doc['id'] ?>").click()'></a> <img id="med_doc_<?php echo $row_medical_doc['id'] ?>" style='display:none' <?php echo ' src = "data:' . $row_medical_doc['medical_doc_type'] . ';base64,' . base64_encode($row_medical_doc['medical_doc']) . '"' ?> alt="pdf" onclick="pdf_preview(this,'<?php echo $row_medical_doc['medical_doc_desc'] ?>')" /> <?php } else { ?> <img width="50" height="50" <?php echo ' src = "data:' . $row_medical_doc['medical_doc_type'] . ';base64,' . base64_encode($row_medical_doc['medical_doc']) . '"' ?> alt="new image" onclick="image(this,'<?php echo $row_medical_doc['medical_doc_desc'] ?>')" /> <?php } } ?> <!-- //// --> <?php while ($row_medical_doc1 = @mysqli_fetch_array($result_medical_doc1)) { if ($row_medical_doc1['medical_doc_type'] == 'application/pdf') { ?> <a href='#'><img src='images/pdf.png' width='35' height='35' onclick='$("#med_doc_<?php echo $row_medical_doc1['id'] ?>").click()'></a> <img id="med_doc_<?php echo $row_medical_doc1['id'] ?>" style='display:none' <?php echo ' src = "data:' . $row_medical_doc1['medical_doc_type'] . ';base64,' . base64_encode($row_medical_doc1['medical_doc']) . '"' ?> alt="pdf" onclick="pdf_preview(this,'<?php echo $row_medical_doc1['medical_doc_desc'] ?>')" /> <?php } else { ?> <img width="50" height="50" <?php echo ' src = "data:' . $row_medical_doc1['medical_doc_type'] . ';base64,' . base64_encode($row_medical_doc1['medical_doc']) . '"' ?> alt="new image" onclick="image(this,'<?php echo $row_medical_doc1['medical_doc_desc'] ?>')" /> <?php } } ?> </td> <tr> <?php $count++; }}else{ ?> <tr> <td align="center" colspan='6'> No Data Available</td> <tr> <?php } ?> </tbody> </table> </div> </div> <!-- <div class="tab-pane fade" id="pills-vaccine" role="tabpanel" aria-labelledby="pills-vaccine-tab"> <div class="row"> <div class="space"></div> <div class="space"></div> <form id="ambulance_form" method="post"> <div class="box-body"> <div class="row"> <div class="col-sm-12"> <table id="dose-table" class="table table-bordered order-list"> <thead> <tr> <th>S.No.</th> <th>Vaccine Name</th> <th>1st Dose</th> <th>2nd Dose</th> <th>3rd Dose</th> <th>Remarks</th> </tr> </thead> <?php $i = 0; $s_no = 0; $sql_vac = "select * from vaccination_details where emp_id=" . $emp_id . ""; //echo $sql; error_log("query vaccination_details: " . $sql_vac); $result_vac = @mysqli_query($conn, $sql_vac); $num_rows_vac = @mysqli_num_rows($result_vac); if(mysqli_num_rows($result_vac) > 0){ while ($row_vac = @mysqli_fetch_array($result_vac)) { $i++; $s_no++; ?> <tbody> <tr> <td style="width:2%"> <input type="hidden" name="vac_id<?php echo $i ?>" id="vac_id<?php echo $i ?>" value="<?php echo $row_vac['id'] ?>" /> <div class="input-group"> <label><?php echo $s_no; ?></label> </div> </td> <td style="width:8%"> <?php echo getFieldFromTable('vaccine_name', 'vaccine_master', 'id', $row_vac['vac_id']) ?> </td> <td style="width:8%"> <?php echo $row_vac['vac_d1'] ?> </td> <td style="width:8%"> <?php echo $row_vac['vac_d2'] ?> </td> <td style="width:8%"> <?php echo $row['vac_d3'] ?> </td> <td style="width:14%"><?php echo $row_vac['remarks'] ?></td> <?php if ($i == 1) { ?> <?php } else { ?> <td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a> </td> <?php } ?> </tr> <?php }}else{ ?> <tr > <td align="center" colspan='6'> No Data Available</td> <tr> <?php } //end of while ?> <input type="hidden" name="count_items" id="count_items" value="<?php echo $i ?>" /> <input type="hidden" name="s_no" id="s_no" value="<?php echo $s_no ?>" /> </tbody> <tfoot> <tr> </tr> </tfoot> </table> </div> </div> </div> </form> </div> </div> --> <div class="tab-pane fade" id="pills-opd-injury" role="tabpanel" aria-labelledby="pills-opd-injury-tab"> <div class="table-responsive" style="text-align: center; text-align: center; width: 100%;"> <table class="table table-bordered" id="opd_injury_table" style="width: 100%"> <thead> <tr> <th style="text-align: center">Sr No</th> <th style="text-align: center">OPD/Injury</th> <th style="text-align: center">Appointment Date</th> <th style="text-align: center">Attended By</th> <th style="text-align: center">Prescription</th> <th style="text-align: center;">Other Supporting Documents</th> </tr> </thead> <?php $count = 1; $sql_for_employee_appointment = "select * from employee_appointment where emp_id=" . $emp_id . " order by appointment_date DESC "; error_log("OPD QUERY::" . $sql_for_employee_appointment); $result_for_employee_appointment = mysqli_query($conn, $sql_for_employee_appointment); if(mysqli_num_rows($result_for_employee_appointment) > 0){ while ($row_for_employee_appointment = mysqli_fetch_assoc($result_for_employee_appointment)) { ?> <tr> <td align="center"><?php echo $count; ?> </td> <td align="center"><?php if ($row_for_employee_appointment['appointment_type'] == 'O') echo "OPD"; else if ($row_for_employee_appointment['appointment_type'] == 'I') echo "INJURY"; ?> </td> <td align="center"> <?php echo strtoupper(date_format(date_create($row_for_employee_appointment['appointment_date']), "d-M-Y ")); ?> </td> <td align="center"><?php $emp_id = getTableFieldValue('tbl_users', 'emp_id', 'user_id', $row_for_employee_appointment['doctor_last_attended']); error_log("ATTENDED BY:" . $emp_id); echo getTableFieldValue('patient_master', 'patient_name', 'id', $emp_id); ?> </td> <td align="center"> <?php if ($row_for_employee_appointment['appointment_type'] == 'O') echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_appointment_pdf('opd_form_pdf.php','" . $row_for_employee_appointment['appointment_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; else if ($row_for_employee_appointment['appointment_type'] == 'I') echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_appointment_pdf('injury_form_pdf.php','" . $row_for_employee_appointment['appointment_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; ?> </td> <?php $count = 1; $sql_medical_doc = "select * from medical_document where appointment_id='" . $row_for_employee_appointment["appointment_id"] . "' "; error_log("OPD DOCUMENT:" . $sql_medical_doc); $result_medical_doc = @mysqli_query($conn, $sql_medical_doc); ?> <td> <?php while ($row_medical_doc = @mysqli_fetch_array($result_medical_doc)) { if ($row_medical_doc['medical_doc_type'] == 'application/pdf') { ?> <a href='#'><img src='images/pdf.png' width='35' height='35' onclick='$("#med_doc_<?php echo $row_medical_doc['id'] ?>").click()'></a> <img id="med_doc_<?php echo $row_medical_doc['id'] ?>" style='display:none' <?php echo ' src = "data:' . $row_medical_doc['medical_doc_type'] . ';base64,' . base64_encode($row_medical_doc['medical_doc']) . '"' ?> alt="pdf" onclick="pdf_preview(this,'<?php echo $row_medical_doc['medical_doc_desc'] ?>')" /> <?php } else { ?> <img width="50" height="50" <?php echo ' src = "data:' . $row_medical_doc['medical_doc_type'] . ';base64,' . base64_encode($row_medical_doc['medical_doc']) . '"' ?> alt="new image" onclick="image(this,'<?php echo $row_medical_doc['medical_doc_desc'] ?>')" /> <?php } } ?> </td> <tr> <?php $count++; }}else{ ?> <tr> <td align="center" colspan='6'> No Data Available</td> <tr> <?php } //end of while ?> </tbody> </table> </div> </div> <div class="tab-pane fade" id="pills-sickness" role="tabpanel" aria-labelledby="pills-sickness-tab"> <table class="table table-bordered" id="sickness_table" style="width: 100%"> <thead> <tr> <th style="text-align:center">Sr No</th> <th style="text-align:center">sicknes Date</th> <th style="text-align:center">Ailment Name</th> <th style="text-align:center">Attended Doctor</th> <th style="text-align:center"></th> </tr> </thead> <?php $count = 1; $sql_for_sickness = "select * from sickness where emp_id=" . $emp_id . " "; //echo $sql_for_sickness; $result_for_sickness = mysqli_query($conn, $sql_for_sickness); if(mysqli_num_rows($result_for_sickness) > 0){ while ($row_for_sickness = mysqli_fetch_assoc($result_for_sickness)) { ?> <tr> <td align="center"><?php echo $count; ?> </td> <td align="center"> <?php echo strtoupper(date_format(date_create($row_for_sickness['sickness_date']), "d-M-Y ")); ?> </td> <td align="center"> <?php echo getTableFieldValue('ailment', 'ailment_name', 'ailment_id', $row_for_sickness['ailment_name']); ?> </td> <td align="center"> <?php //$emp_sickness_id=getTableFieldValue('tbl_users','emp_id','user_id',$row_for_sickness['doctor_last_attended']); echo getTableFieldValue('patient_master', 'patient_name', 'id', $row_for_sickness['doctor_last_attended']); ?> </td> <td align="center"> <?php if ($row_for_sickness['fitness_status'] == 'APPROVED') { echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_pdf_fitness('fitness_certificate.php','" . $row_for_sickness['sickness_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; } else { echo "<a href=\"#\"><i class=\"fa-solid fa-file-pdf\" onclick=\"open_pdf_fitness('unfit_certificate.php','" . $row_for_sickness['sickness_id'] . "')\" style=\"font-size: 20px;\"></i></a>"; } ?> </td> <tr> <?php $count++; }}else{ ?> <tr> <td align="center" colspan='5'> No Data Available</td> <tr> <?php } ?> </tbody> </table> </div> <!-- <div class="tab-pane fade" id="pills-risk" role="tabpanel" aria-labelledby="pills-risk-tab"> <div class="table-responsive"> <table class="table table-bordered table-hover" id="health_advices_and_risks"> <thead> <tr> <th style="text-align:center" width="50%">Known Health Advices</th> <th style="text-align:center" width="50%">Known Health Risks</th> </tr> </thead> <tbody> <tr> <td align="center"><?php $advices = explode(",", trim($row['known_health_advices'], ',')); // echo $advices; $str_advices = ''; for ($i = 0; $i < count($advices); $i++) { if ($i == 0) $str_advices .= getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], ''); else $str_advices .= ',' . getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], ''); } echo $str_advices; ?></td> <td align="center"> <?php $risks = explode(",", trim($row['known_health_risks'], ',')); // echo $advices; $str_risks = ''; for ($i = 0; $i < count($risks); $i++) { if ($i == 0) $str_risks .= getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $risks[$i], ''); else $str_risks .= ',' . getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $risks[$i], ''); } echo $str_risks; ?> </td> </tr> </tbody> </table> </div> </div> --> <div class="tab-pane fade" id="pills-document" role="tabpanel" aria-labelledby="pills-document-tab"> <?php $docs_select_query = "select * from employee_docs where emp_id=" . $emp_id . " "; //echo $docs_select_query; $docs_result = @mysqli_query($conn, $docs_select_query); $no_of_docs = @mysqli_num_rows($docs_result); ?> <div class="table-responsive" style="text-align: center; text-align: center; width: 100%;"> <table class="table table-bordered" style="width: 100%" id="document-table"> <thead> <tr> <th style="text-align:center">S.No.</th> <th style="text-align:center">Document Name</th> <th style="text-align:center">Uploaded Date</th> <th style="text-align:center">Download link</th> <th style="text-align:center">Edit/Delete</th> </tr> </thead> <?php if ($no_of_docs == 0) { ?> <tr> <td align='center' colspan='5'>No Files Found</td> </tr> <?php } ?> <?php $count = 0; while ($row_docs = mysqli_fetch_array($docs_result)) { ?> <tr> <td align="center"><?php echo $count + 1 ?> </td> <td align="center"><?php echo $row_docs['doc_name'] ?> </td> <td align="center"> <?php echo date("d-F-Y", filemtime('files/' . $thelist[$count])) ?> </td> <?php echo '<td align="center"><a href="data:image/jpeg;base64,' . base64_encode($row_docs['document']) . '" download><span class="glyphicon glyphicon-download-alt"></span></a></td>'; ?> <td align="center"> <a href="#" onclick="deletedocs(<?php echo $row_docs['doc_id'] ?>);"><span class="glyphicon glyphicon-trash"></span> </a> </td> </tr> <?php $count++; } ?> <tr> </tr> </table> </div> </div> <div class="tab-pane fade" id="pills-illness" role="tabpanel" aria-labelledby="pills-illness-tab"> <div class="table-responsive" style="text-align: center; text-align: center; width: 100%;"> <table class="table table-bordered" style="width: 100%" id="past-illness"> <thead> <tr align="center"> <th style="text-align: center">Chronic Illness</th> <th style="text-align: center">Chronic Medication</th> </tr> </thead> <tbody> <?php $sql_checkup_cronic = "select diseases,medicine_name,diagnosis from prescription_master where emp_id = '" . $id . "' "; error_log("sql checkup: 1076: " . $sql_checkup_cronic); if (!$result_checkup_cronic = @mysqli_query($conn, $sql_checkup_cronic)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_checkup_cronic) > 0) { while ($row_checkup_cronic = mysqli_fetch_assoc($result_checkup_cronic)) {?> <tr> <td> <?php echo getTableFieldValue('abnormality','abnormality_name','abnormality_id',$row_checkup_cronic['diseases']); ?> </td><?php ?><td> <?php echo getTableFieldValue('tbl_items','item_name','item_id',$row_checkup_cronic['medicine_name']); ?> </td><?php ?> <tr><?php } }else{ echo '<tr><td colspan="3">No Data Available</td><tr>'; } ?> </tr> </tbody> </table> </div> </div> </div> </div> </div> <div id="patient_dashboard" class="tab-pane fade rounded-4" style=' text-align: center;width: 1100px;'> <div> <img src="images/coming_soon.png" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;" /> </div> <div> <h1 align='center'>Coming Soon</h1> </div> </div> <!-- hidden heath dashboard --> <!-- <div id="patient_dashboard" class="tab-pane fade rounded-4"> --> <div class="tab-pane fade rounded-4"> <ul class="nav nav-pills mb-3 shadow rounded nav-fill" id="pills-tab" role="tablist" style="background-color: white; font-size: small;"> <li class="nav-item" role="presentation"> <button class="nav-link active" id="pills-health-tab" data-bs-toggle="pill" data-bs-target="#pills-health" type="button" role="tab" aria-controls="pills-health" aria-selected="true">Health Info <i class="fa fa-circle-user fa-spin"></i></button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-visits-tab" data-bs-toggle="pill" data-bs-target="#pills-visits" type="button" role="tab" aria-controls="pills-visits" aria-selected="false">Patient Latest Visits <i class="fas fa-bed fa-shake"></i></button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="pills-graph-tab" data-bs-toggle="pill" data-bs-target="#pills-graph" type="button" role="tab" aria-controls="pills-graph" aria-selected="false">Health Data Graphical Representation <i class="fas fa-bar-chart fa-beat-fade"></i></button> </li> </ul> <div class="tab-content" id="pills-tabContent"> <div class="tab-pane fade show active" id="pills-health" role="tabpanel" aria-labelledby="pills-health-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div class="card mb-3" style="border-radius: .5rem;"> <div class="row g-0 shadow"> <div class="col-md-2 text-center text-white" style="border-top-left-radius: .5rem; border-bottom-left-radius: .5rem;background: linear-gradient(to right bottom, #0d6efd, rgba(100,150,200,.5))"> <?php if (isset($row['photo']) && $row['photo'] != null && $row['photo'] != 'NA') { ?> <img src="data:<?php echo $row['image_type'] ?>;base64,<?php echo base64_encode($row['photo']) ?>" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;" /> <?php } else { $gender = $row['gender']; if ($gender == 'M') { ?> <img src="images/male-profile.png" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;" /> <?php } else { ?> <img src="images/female-profile.png" alt="Avatar" class="img-fluid my-2 mt-5" style="width: 100px;border-radius: 50px;" /> <?php } } ?> <div> <!-- <i class="fa-solid fa-droplet fa-bounce" style="color: red;"></i> --> <?php if($row['blood_group']!='NA') {echo 'Blood Group : '.$row['blood_group'];} ?> </div> <div> <h5 class="mt-5"> <?php echo $patient_name; ?> <?php if (isset($father_name) && $father_name != '') { ?><br>S/O <?php echo $father_name; } ?> </h5> </div> <div><?php echo $emp_code; ?></div> <div><?php if ($gender == 'M') { echo "Male"; } else if ($gender == 'F') { echo "Female"; } else echo "Other"; ?> , <?php echo floor((time() - strtotime($row['dob'])) / 31556926); ?></div> </div> <div class="col-md-10"> <div class="card-body p-4"> <h6>Employee Health Dashboard</h6> <hr class="mt-0 mb-4"> <div class="row pt-1"> <div class="col-3 mb-3"> <h6>Height </h6> <p class="text-muted"> <?php if($row5['height']!='' && $row5['height']!=null){ echo $row5['height'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>Weight</h6> <p class="text-muted"> <?php if($row6['weight']!='' && $row6['weight']!=null){ echo $row6['weight'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3 "> <h6>BMI </h6> <p class="text-muted"> <?php if($row8['bmi']!='' && $row8['bmi']!=null){ echo $row8['bmi'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>BP </h6> <p class="text-muted"> <?php if($bp!='' && $bp!=null){ echo $bp;}else{echo 'NA';} ?></p> </div> <div class="col-3 mb-3 "> <h6>Pulse</h6> <p class="text-muted"> <?php if($row7['pulse']!='' && $row7['pulse']!=null){ echo $row7['pulse'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>Health Index</h6> <p class="text-muted"> <?php if($row10['health_index']!='' && $row10['health_index']!=null){ echo $row10['health_index'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>FBS </h6> <p class="text-muted"> <?php if($row12['fbs']!='' && $row12['fbs']!=null){ echo $row12['fbs'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>RBS </h6> <p class="text-muted"> <?php if($row13['rbs']!='' && $row13['rbs']!=null){ echo $row13['rbs'];}else{echo 'NA';} ?> </p> </div> <div class="col-3 mb-3"> <h6>PPBS </h6> <p class="text-muted"> <?php if($row14['ppbs']!='' && $row14['ppbs']!=null){ echo $row14['ppbs'];}else{echo 'NA';} ?> </p> </div> </div><br> </div> </div> </div> </div> </div> </div> </div> <div class="tab-pane fade" id="pills-visits" role="tabpanel" aria-labelledby="pills-visits-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="col col-lg-12 col-sm-12 mb-4 mb-lg-0"> <div id="accordionFlushExample" class="accordion accordion-flush"> <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingTwo"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo"> Latest Opd Visit </button> </h2> <div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_opd = "select * from employee_appointment where emp_id = '" . $id . "' and appointment_type='O' order by appointment_date desc limit 1"; error_log("sql opd: 407: " . $sql_opd); if (!$result_opd = @mysqli_query($conn, $sql_opd)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_opd) > 0) { if ($row_opd = @mysqli_fetch_array($result_opd)) { $aiment_ids = $row_opd['ailment_ids']; error_log("explode" . $row_opd['ailment_ids']); ?> <div class="profile-info-row"> <div class="profile-info-name">Date & Time:</div> <div class="profile-info-value"> <?php echo date_format(date_create($row_opd['appointment_date']), "d-M-Y H:i A") ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Diagnosis:</div> <div class="profile-info-value"> <?php echo getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_opd['ailments_new']); ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Treatment:</div> <div class="profile-info-value"> <?php echo getTreatmentText($row_opd['appointment_id']) ?></div> </div> <?php } else { echo "No Results found"; } } else { ?> <div class="profile-info-value">No Record found</div> <?php } ?> </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingThree"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="false" aria-controls="flush-collapseThree"> Latest Injury Visit </button> </h2> <div id="flush-collapseThree" class="accordion-collapse collapse" aria-labelledby="flush-headingThree" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_injury = "select * from employee_appointment where emp_id = '" . $id . "' and appointment_type='I' order by appointment_date desc limit 1"; error_log("sql injury: 525: " . $sql_injury); if (!$result_injury = @mysqli_query($conn, $sql_injury)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_injury) > 0) { if ($row_injury = mysqli_fetch_assoc($result_injury)) { ?> <div class="profile-info-row"> <div class="profile-info-name">Date & Time:</div> <div class="profile-info-value"> <?php echo date_format(date_create($row_injury['appointment_date']), "d-M-Y H:i A") ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Diagnosis:</div> <div class="profile-info-value"> <?php echo getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_injury['ailments_new']); ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Treatment:</div> <div class="profile-info-value"> <?php echo getTreatmentText($row_injury['appointment_id']) ?></div> </div> <?php } else { echo "No Results found"; } } else { ?> <div class="profile-info-value">No Record found</div> <?php } ?> </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingFour"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseFour" aria-expanded="false" aria-controls="flush-collapseFour"> Previous Emergency </button> </h2> <div id="flush-collapseFour" class="accordion-collapse collapse" aria-labelledby="flush-headingFour" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_emergency = "select * from employee_appointment where emp_id = '" . $id . "' and isEmergency='1' order by appointment_date desc limit 1"; error_log("sql emergency: 643: " . $sql_emergency); if (!$result_emergency = @mysqli_query($conn, $sql_emergency)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_emergency) > 0) { if ($row_emergency = mysqli_fetch_assoc($result_emergency)) { ?> <div class="profile-info-row"> <div class="profile-info-name">Date & Time:</div> <div class="profile-info-value"> <?php echo date_format(date_create($row_emergency['appointment_date']), "d-M-Y H:i A") ?> </div> </div> <?php $appointment_type = $row_emergency['appointment_type']; $diagnosis = getCommaSeperatedValuesForInClause("select ailment_name from ailment ", "ailment_id", $row_emergency['ailment_new']); ?> <div class="profile-info-row"> <div class="profile-info-name">Diagnosis:</div> <div class="profile-info-value"><?php echo $diagnosis ?></div> </div> <div class="profile-info-row"> <div class="profile-info-name">Treatment:</div> <div class="profile-info-value"> <?php echo getTreatmentText($row_emergency['appointment_id']) ?> </div> </div> <?php } else { ?> No Results found <?php } } else { ?> <div class="profile-info-value">No Record found</div> <?php } ?> </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingFive"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseFive" aria-expanded="false" aria-controls="flush-collapseFive"> Latest Sickness Absenteeism </button> </h2> <div id="flush-collapseFive" class="accordion-collapse collapse" aria-labelledby="flush-headingFive" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_sickness = "select * from sickness where emp_id = '" . $id . "' order by sickness_date desc limit 1"; error_log("sql sickness: 789: " . $sql_sickness); if (!$result_sickness = @mysqli_query($conn, $sql_sickness)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_sickness) > 0) { if ($row_sickness = mysqli_fetch_assoc($result_sickness)) { ?> <div class="profile-info-row"> <div class="profile-info-name">Date & Time:</div> <div class="profile-info-value"> <?php echo $row_sickness['sickness_date'] ?></div> </div> <div class="profile-info-row"> <div class="profile-info-name">Diagnosis:</div> <div class="profile-info-value"> <?= getFieldFromTable('ailment_name', 'ailment', 'ailment_id', $row_sickness['ailment_name']) ?> </div> </div> <!-- <div class="profile-info-row"> <div class="profile-info-name">Treatment:</div> <div class="profile-info-value"><?php echo $row_sickness['des'] ?></div> </div> --> <?php } else { ?> No Results found <?php } } else { ?> <div class="profile-info-value">No Record found</div> <?php } ?> </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingSix"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseSix" aria-expanded="false" aria-controls="flush-collapseSix"> Training </button> </h2> <div id="flush-collapseSix" class="accordion-collapse collapse" aria-labelledby="flush-headingSix" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_training_complete = "select * from employee_assign_training where emp_id='" . $_SESSION['logged_user_empid'] . "' and status='Y' limit 1"; // echo $sql_training_complete; error_log("sql training complete: 909: " . $sql_training_complete); if (!$result_training_complete = @mysqli_query($conn, $sql_training_complete)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_training_complete) > 0) { if ($row_training_complete = mysqli_fetch_assoc($result_training_complete)) { $query_schedule = "select * from training_schedule where schedule_id='" . $row_training_complete['training_schedule_id'] . "' limit 1"; // echo $query_schedule; error_log("query_schedule: " . $query_schedule); $result_schedule = @mysqli_query($conn, $query_schedule); while ($rows_schedule = mysqli_fetch_assoc($result_schedule)) { $training_name = getTableFieldValue('training_master', 'training_name', 'training_master_id', $rows_schedule['training_id']); $from_date = date_format(date_create($row_training['from_date']), "d-M-Y"); $to_date = date_format(date_create($row_training['to_date']), "d-M-Y"); $trainer_name = $rows_schedule['trainer_name']; $training_location = $rows_schedule['location']; // $training_schedule= $training_name.'('.$rows_schedule['trainer_name'].','.date_format(date_create($row_training['from_date']),"d-M-Y").' '.date_format(date_create($row_training['to_date']),"d-M-Y").')'; } ?> <div class="profile-info-row"> <div class="profile-info-name">Training Name:</div> <div class="profile-info-value"><?php echo $training_name ?></div> </div> <div class="profile-info-row"> <div class="profile-info-name">To Date:</div> <div class="profile-info-value"><?php echo $to_date ?></div> </div> <div class="profile-info-row"> <div class="profile-info-name">From Date:</div> <div class="profile-info-value"><?php echo $from_date ?></div> </div> <div class="profile-info-row"> <div class="profile-info-name">Trainer Name:</div> <div class="profile-info-value"><?php echo $trainer_name ?></div> </div> <div class="profile-info-row"> <div class="profile-info-name">Completion Date:</div> <div class="profile-info-value"> <?php echo $date_completion = date_format(date_create($row_training_complete['completion_date']), "d-M-Y") ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Status Name:</div> <div class="profile-info-value"><?php echo 'complete' ?></div> </div> <?php $date_completion = ""; // if($row_emp_assign_training['completion_date']!=null && $row_emp_assign_training['completion_date']!='0000-00-00' ) // $date_completion= date_format(date_create($row_emp_assign_training['completion_date']),"d-M-Y"); } } else { ?> No Results found<?php } ?> </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingSeven"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseSeven" aria-expanded="false" aria-controls="flush-collapseSeven"> Latest Medical Examination </button> </h2> <div id="flush-collapseSeven" class="accordion-collapse collapse" aria-labelledby="flush-headingSeven" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_checkup = "select * from checkup_form where emp_id = '" . $id . "' order by checkup_date desc limit 1"; error_log("sql checkup: 1076: " . $sql_checkup); if (!$result_checkup = @mysqli_query($conn, $sql_checkup)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_checkup) > 0) { if ($row_checkup = mysqli_fetch_assoc($result_checkup)) { ?> <div class="profile-info-row"> <div class="profile-info-name">Date & Time:</div> <div class="profile-info-value"> <?php echo date_format(date_create($row_checkup['checkup_date']), "d-M-Y H:i A") ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Medications:</div> <div class="profile-info-value"> <?php echo (isset($row_checkup['reglar_medication'])) ? ($row_checkup['reglar_medication']) : ("NA") ?> </div> </div> <?php } else { echo "No Results found"; } } else { ?> <div class="profile-info-value">No Record found</div> <?php } ?> </div> </div> </div> <!-- <div class="accordion-item"> <h2 class="accordion-header" id="flush-headingEight"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseEight" aria-expanded="false" aria-controls="flush-collapseEight"> Past Present Illness </button> </h2> <div id="flush-collapseEight" class="accordion-collapse collapse" aria-labelledby="flush-headingEight" data-bs-parent="#accordionFlushExample"> <div class="accordion-body"> <?php $sql_checkup = "select past_present_illness,medical_entry_date from medical_examination where patient_id = '" . $id . "' order by medical_entry_date desc limit 1"; error_log("sql checkup: 1076: " . $sql_checkup); if (!$result_checkup = @mysqli_query($conn, $sql_checkup)) { exit(error_log(mysqli_error($conn))); } if (mysqli_num_rows($result_checkup) > 0) { if ($row_checkup = mysqli_fetch_assoc($result_checkup)) { ?> <div class="profile-info-row"> <div class="profile-info-name">Date & Time:</div> <div class="profile-info-value"> <?php echo date_format(date_create($row_checkup['medical_entry_date']), "d-M-Y H:i A") ?> </div> </div> <div class="profile-info-row"> <div class="profile-info-name">Medications:</div> <div class="profile-info-value"> <?php echo ppa($row_checkup['past_present_illness']) ?></div> </div> <?php } else { echo "No Results found"; } } else { ?> <div class="profile-info-value">No Record found</div> <?php } ?> </div> </div> </div> --> </div> </div> </div> </div> <div class="tab-pane fade" id="pills-graph" role="tabpanel" aria-labelledby="pills-graph-tab"> <div class="row d-flex justify-content-center align-items-center h-100"> <div class="card"> <div class="card-body"> <h5 class="card-title">Choose date filter to see past data</h5> <form id="filter_report" name="filter_report"> <div class="row mb-2"> <div class="col-sm-3"> <label for="startDate" class="form-label">Start Date</label> <input class="form-control date-picker" id="startDate" name="startDate" value="<?= date('Y-01-01') ?>" type="date" data-date-format="yyyy-mm-dd" placeholder="Start date" /> </div> <div class="col-sm-3"> <label for="endDate" class="form-label">End Date</label> <input class="form-control date-picker" id="endDate" name="endDate" value="<?= date('Y-m-d') ?>" type="date" data-date-format="yyyy-mm-dd" placeholder="End date" /> </div> <div class="col-sm-3"> <label for="health_parameter" class="form-label">Select Health Parameter</label> <select multiple="multiple" class="select form-control" id="health_parameter" name="health_parameter[]" data-placeholder="Select Health Parameter"> <?php echo generateOption('key_health_reportable_parameter_master', 'key_param_name', 'key_param_id', '1', ''); ?> </select> </div> <div class="col-sm-2"> <label for="choose_chart" class="form-label">Select Chart</label> <select class="form-control" name="choose_chart" id="choose_chart" data-placeholder="Choose Chart"> <option value="bar" selected>Bar Chart</option> <option value="line">Line Chart</option> <option value="doughnut">Doughnut Chart</option> <option value="pie">Pie Chart</option> <option value="radar">Radar Chart</option> <!-- <option value="polarArea">PolarArea Chart</option> --> </select> </div> <div class="col-sm-1 d-flex align-items-center"> <button type="button" class="btn btn-primary" id="mybtn" onclick="getShowingData();getParameterData();">GO</button> </div> </div> </form> </div> </div> <?php ?> <div name="data_shower"> <!-- /// --> <br> <div class="row" id="parameter_charts"> </div> <br> <div class="row"> <h5 class="shadow rounded-4" style="background-color:#0d6efd; color: white;"> <center>BMI TRACKING <i class="ace-icon fa fa-star" style="color: white;"></i> </center> </h5> <div class="col-sm-6 card shadow" style="padding-left: 20px;"> <canvas id="patient_bmi"></canvas> <?php include 'chart_employee_bmi_height_weight.php'; ?> </div> <div class="col-sm-6 shadow"> <table style="width: 100%" id="bmi_table" class="table"> <?php $height = array(); $weight = array(); $bmi = array(); $medical_date = array(); $bmi_new = array(); $height_new = array(); $weight_new = array(); $startDate = date("d-m-Y", strtotime("-2 year")); $endDate = date("d-m-Y"); // SQL query to select data from database $sql_height = "SELECT height, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and height != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') UNION SELECT cf.checkup_form_value as height ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='height') and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat asc limit 10"; $result_height = mysqli_query($conn, $sql_height); error_log(" height query for table" . $sql_height); while ($row_height = mysqli_fetch_assoc($result_height)) { array_push($medical_date, $row_height['dat']); $height['height'][$row_height['dat']] = $row_height['height']; } $sql_weight = "SELECT `weight`, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and `weight` != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') UNION SELECT cf.checkup_form_value as weight ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='weight') and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat asc limit 10"; $result_weight = mysqli_query($conn, $sql_weight); while ($row_weight = mysqli_fetch_assoc($result_weight)) { array_push($medical_date, $row_weight['dat']); $weight['weight'][$row_weight['dat']] = $row_weight['weight']; } // SQL query to select data from database $sql_bmi = "SELECT `bmi`, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and `bmi` != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') UNION SELECT cf.checkup_form_value as bmi ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='bmi') and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat asc limit 10"; $result_bmi = mysqli_query($conn, $sql_bmi); error_log("bmi for table query " . $sql_bmi); if (mysqli_num_rows($result_bmi) > 0) { while ($row_bmi = mysqli_fetch_assoc($result_bmi)) { array_push($medical_date, $row_bmi['dat']); $bmi['bmi'][$row_bmi['dat']] = $row_bmi['bmi']; } } $medical_date = array_values(array_unique($medical_date)); for ($i = 0; $i < sizeof($medical_date); $i++) { error_log("inside loop value" . $bmi['bmi'][$medical_date[$i]]); error_log("inside loop value" . $height['height'][$medical_date[$i]]); error_log("inside loop value" . $weight['weight'][$medical_date[$i]]); if ($bmi['bmi'][$medical_date[$i]] == '') { array_push($bmi_new, 0); } else { array_push($bmi_new, $bmi['bmi'][$medical_date[$i]]); } if ($height['height'][$medical_date[$i]] == '') { array_push($height_new, 0); } else { array_push($height_new, $height['height'][$medical_date[$i]]); } if ($weight['weight'][$medical_date[$i]] == '') { array_push($weight_new, 0); } else { array_push($weight_new, $weight['weight'][$medical_date[$i]]); } } ?> <thead> <tr> <td style="font-size: 10px" width="15%"><strong>Date</strong></td> <td style="font-size: 10px" width="15%"><strong>height</strong></td> <td style="font-size: 10px" width="15%"><strong>weight</strong></td> <td style="font-size: 10px" width="15%"><strong>bmi</strong></td> </tr> </thead> <tbody> <?php for ($i = 0; $i < sizeof($medical_date); $i++) { $newDate = date("d-m-Y", strtotime($medical_date[$i])); ?> <tr> <td><?php echo $newDate; ?></td> <td><?php echo $height_new[$i] ?></td> <td><?php echo $weight_new[$i]; ?></td> <td><?php echo $bmi_new[$i] ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> <br> <div class="row"> <h5 class="shadow rounded-4" style="background-color:#0d6efd; color: white;"> <center>OSI TRACKING <i class="ace-icon fa fa-star" style="color: white;"></i> </center> </h5> <div class="col-sm-6 card shadow" style="padding-left: 20px;"> <canvas id="patient_osi"></canvas> <?php include 'chart_employee_OSI.php'; ?> </div> <div class="col-sm-6 shadow"> <table style="width: 100%" id="osi_table" class="table"> <thead> <tr> <td style="font-size: 10px" width="15%"><strong>Months</strong></td> <td style="font-size: 10px" width="15%"><strong>OPD Visits</strong></td> <td style="font-size: 10px" width="15%"><strong>Injury Visits</strong> </td> <td style="font-size: 10px" width="15%"><strong>Sickness Visits</strong> </td> </tr> </thead> <tbody> <?php $startMonth = '1'; $endMonth = '12'; $year = date("Y"); // SQL query to select data from database for ($i = $startMonth; $i <= $endMonth; $i++) { $id = $_SESSION['logged_user_empid']; $query1 = "SELECT COUNT(appointment_id) FROM employee_appointment WHERE MONTH(appointment_date) = $i and YEAR(appointment_date)='$year' AND appointment_type='O' AND emp_id='$id' "; // $testMonth = $endMonth - $m; // if ($testMonth <= 0) { // $testMonth += 12; // } error_log("count query for osi " . $query1); $result1 = mysqli_query($conn, $query1); while ($row1 = $result1->fetch_assoc()) { $month_name = date("F", mktime(0, 0, 0, $i, 10)); ?> <tr> <td> <?php echo $month_name; ?> </td> <td> <?php echo $row1['COUNT(appointment_id)']; ?> </td> <?php } $m++; $query2 = "SELECT COUNT(appointment_id) FROM employee_appointment WHERE MONTH(appointment_date) = $i and YEAR(appointment_date)='$year' AND appointment_type='I' AND emp_id='$id' "; error_log("count query for opd " . $query2); $result2 = mysqli_query($conn, $query2); while ($row2 = $result2->fetch_assoc()) { ?> <td> <?php echo $row2['COUNT(appointment_id)']; ?> </td> <?php $query3 = "SELECT COUNT(sickness_id) FROM sickness WHERE MONTH(sickness_date) = $i and YEAR(sickness_date)='$year' AND emp_id='$id' "; $result3 = mysqli_query($conn, $query3); while ($row3 = $result3->fetch_assoc()) { ?> <td> <?php echo $row3['COUNT(sickness_id)']; ?> </td> </tr> <?php } } } ?> </tbody> </table> </div> </div> <br> <div class="row"> <h5 class="shadow rounded-4" style="background-color:#0d6efd; color: white;"> <center>BP TRACKING <i class="ace-icon fa fa-star" style="color: white;"></i> </center> </h5> <div class="col-sm-6 card shadow" style="padding-left: 20px;"> <canvas id="patient_bp"></canvas> <?php include 'chart_employee_blood_pressure.php'; ?> </div> <div class="col-sm-6 shadow"> <table style="width: 100%" id="bp_table" class="table"> <?php $bp_dbp = array(); $bp_sbp = array(); $medical_date = array(); $sbp_new = array(); $dbp_new = array(); $query = "SELECT bp_sbp as sbp, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and bp_sbp != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y')UNION SELECT cf.checkup_form_value as sbp ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and (cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp') or cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp/dbp')) and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat desc limit 25"; error_log("sbp query " . $query); $result = @mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($medical_date, $row[1]); $bp_arr = explode("/", $row[0]); error_log("size " . sizeof($bp_arr)); if (sizeof($bp_arr) > 1) { $bp_sbp['sbp'][$row[1]] = $bp_arr[0]; } else { $bp_sbp['sbp'][$row[1]] = $bp_arr[0]; } } } $query = "SELECT bp_dbp as dbp, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and bp_dbp != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y')UNION SELECT cf.checkup_form_value as dbp ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and (cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='dbp') or cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='sbp/dbp')) and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat desc limit 25"; error_log("dbp query " . $query); $result = @mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($medical_date, $row[1]); $bp_arr = explode("/", $row[0]); error_log("size " . sizeof($bp_arr)); if (sizeof($bp_arr) > 1) { $bp_dbp['dbp'][$row[1]] = $bp_arr[1]; } else { $bp_dbp['dbp'][$row[1]] = $bp_arr[0]; } } } $medical_date = array_values(array_unique($medical_date)); for ($i = 0; $i < sizeof($medical_date); $i++) { error_log("inside loop value" . $bp_sbp['sbp'][$medical_date[$i]]); error_log("inside loop value" . $bp_dbp['dbp'][$medical_date[$i]]); if ($bp_sbp['sbp'][$medical_date[$i]] == '') { array_push($sbp_new, 0); } else { array_push($sbp_new, $bp_sbp['sbp'][$medical_date[$i]]); } if ($bp_dbp['dbp'][$medical_date[$i]] == '') { array_push($dbp_new, 0); } else { array_push($dbp_new, $bp_dbp['dbp'][$medical_date[$i]]); } } ?> <thead> <tr> <td style="font-size: 10px" width="15%"><strong>Date</strong></td> <td style="font-size: 10px" width="15%"><strong>Sbp</strong></td> <td style="font-size: 10px" width="15%"><strong>Dbp</strong></td> </tr> </thead> <tbody> <?php for ($i = 0; $i < sizeof($medical_date); $i++) { $newDate = date("d-m-Y", strtotime($medical_date[$i])); ?> <tr> <td><?php echo $newDate; ?></td> <td><?php echo $sbp_new[$i] ?></td> <td><?php echo $dbp_new[$i]; ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> <br> <div class="row"> <h5 class="shadow rounded-4" style="background-color:#0d6efd; color: white;"> <center>BLOOD SUGAR TRACKING <i class="ace-icon fa fa-star" style="color: white;"></i> </center> </h5> <div class="col-sm-6 card shadow" style="padding-left: 20px;"> <canvas id="patient_bs"></canvas> <?php include 'chart_employee_blood_sugar.php'; ?> </div> <div class="col-sm-6 shadow"> <table style="width: 100%" id="suger_table" class="table table-striped"> <?php $blood_sugar_ppbs = array(); $blood_sugar_fbs = array(); $blood_sugar_rbs = array(); $medical_date = array(); $fbs_new = array(); $rbs_new = array(); $ppbs_new = array(); $query = "SELECT blood_sugar_rbs as rbs, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and blood_sugar_rbs != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') UNION SELECT cf.checkup_form_value as rbs ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='rbs') and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat desc limit 25"; error_log("rbs query " . $query); $result = @mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($medical_date, $row[1]); $blood_sugar_rbs['rbs'][$row[1]] = $row[0]; } } $query = "SELECT blood_sugar_fbs as fbs, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and blood_sugar_fbs != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') UNION SELECT cf.checkup_form_value as fbs ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='fbs') and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat desc limit 25"; error_log("rbs query " . $query); $result = @mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($medical_date, $row[1]); $blood_sugar_fbs['fbs'][$row[1]] = $row[0]; } } $query = "SELECT blood_sugar_ppbs as ppbs, date(appointment_date) as dat FROM employee_appointment where emp_id='$id'and blood_sugar_ppbs != '' and date(appointment_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') UNION SELECT cf.checkup_form_value as ppbs ,date(c.checkup_date) as dat from checkup_form c left join checkup_form_key_value cf on c.checkup_id=cf.checkup_form_id left join checkup_parameter cp on cp.`column_name` = cf.checkup_form_key where c.emp_id='$id' and cp.key_health_map_name=(select key_param_id from key_health_reportable_parameter_master where key_param_name='ppbs') and date(c.checkup_date) between STR_TO_DATE('" . $startDate . "', '%d-%m-%Y') AND STR_TO_DATE('" . $endDate . "', '%d-%m-%Y') order by dat desc limit 25"; error_log("rbs query " . $query); $result = @mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { while ($row = @mysqli_fetch_array($result)) { array_push($medical_date, $row[1]); $blood_sugar_ppbs['ppbs'][$row[1]] = $row[0]; } } $medical_date = array_values(array_unique($medical_date)); error_log("sugar chart date array " . print_r($medical_date, true)); for ($i = 0; $i < sizeof($medical_date); $i++) { error_log("inside loop value" . $blood_sugar_rbs['rbs'][$medical_date[$i]]); error_log("inside loop value" . $blood_sugar_fbs['fbs'][$medical_date[$i]]); error_log("inside loop value" . $blood_sugar_ppbs['ppbs'][$medical_date[$i]]); if ($blood_sugar_rbs['rbs'][$medical_date[$i]] == '') { array_push($rbs_new, 0); } else { array_push($rbs_new, $blood_sugar_rbs['rbs'][$medical_date[$i]]); } if ($blood_sugar_fbs['fbs'][$medical_date[$i]] == '') { array_push($fbs_new, 0); } else { array_push($fbs_new, $blood_sugar_fbs['fbs'][$medical_date[$i]]); } if ($blood_sugar_ppbs['ppbs'][$medical_date[$i]] == '') { array_push($ppbs_new, 0); } else { array_push($ppbs_new, $blood_sugar_ppbs['ppbs'][$medical_date[$i]]); } } ?> <thead> <tr> <td style="font-size: 10px" width="15%"><strong>Date</strong></td> <td style="font-size: 10px" width="15%"><strong>FBS</strong></td> <td style="font-size: 10px" width="15%"><strong>RBS</strong></td> <td style="font-size: 10px" width="15%"><strong>PPBS</strong></td> </tr> </thead> <tbody> <?php for ($i = 0; $i < sizeof($medical_date); $i++) { $newDate = date("d-m-Y", strtotime($medical_date[$i])); ?> <tr> <td><?php echo $newDate; ?></td> <td><?php echo $fbs_new[$i] ?></td> <td><?php echo $rbs_new[$i]; ?></td> <td><?php echo $ppbs_new[$i] ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> <div id="travel_health_tab" class="tab-pane fade "> <div class="table-responsive"> <table class="table shadow" id="empHistory"> <thead> <tr> <th>Emp No.</th> <th>Mobile No.</th> <th>Name</th> <th>Fathers Name</th> <th>DOB</th> <th>Age</th> <th>Sex</th> <th>Blood Group</th> <th>Passport Country</th> </tr> </thead> <tbody> <tr> <td><?php $tempVar = (!empty($row['emp_code'])) ? $row['emp_code'] : ""; echo $tempVar; ?></td> <td><?php $tempVar = (!empty($row['primary_phone'])) ? $row['primary_phone'] : ""; echo $tempVar; ?></td> <td><?php $tempVar = (!empty($row['patient_name'])) ? $row['patient_name'] : ""; echo $tempVar; ?></td> <td> <?php $tempVar = (!empty($row['father_name'])) ? $row['father_name'] : ""; echo $tempVar; ?></td> <td><?php $tempVar = (!empty($row['dob'])) ? date_format(date_create($row['dob']), "d/m/Y") : ""; echo $tempVar; ?></td> <td> <?php if (!empty($row['dob'])) { $today = new DateTime(); $birthdate = new DateTime($row['dob']); $age = $birthdate->diff($today)->y; echo $age; } else { echo ""; } ?></td> <td> <?php if (!empty($row['gender'])) { if ($row['gender'] == 'M') { echo "Male"; } elseif ($row['gender'] == "F") { echo "Female"; } else { echo "Other"; } } else { echo ""; } ?></td> <td><?php $tempVar = (!empty($row['blood_group'])) ? $row['blood_group'] : ""; echo $tempVar; ?></td> <td><?php if (!empty($row['passport_country'])) { echo getFieldFromTable('country_name', 'country_master', 'country_id', $row['passport_country']); } else { ?> <select class="form-control" name="passport_country" style="width: 100px" id="passport_country" onchange="setPassportCountry()"> <option disabled selected>Select Passport Country</option> <?php echo generateOption('country_master', 'country_name', 'country_id', '', ''); ?> </select> <?php } ?> </td> </tr> </tbody> </table> </div> <div class="container-fluid shadow"> <div class="row"> <div class="col-12 division-box1 p-4 rounded text-center bg-white"> <div class="row" style="width:100%;"> <div class="text-center"> <h4 class="" style="color:#2C3542"><b>Travel Health</b></h4> </div> </div> <br /> <form method="post" id="health_form"> <input type="hidden" name="emp_travel_id" id="emp_travel_id" value=""> <div class="mb-3"> <div class="label_box"><label> <h4>Current Health</h4> </label></div> <div class="label_box"><label>Health Issue</label></div> <div class="input-container"> <input class="form-control" type="text" name="current_health" id="current_health"> </div> <div class="label_box"><label>Medicine(Yes/No ,if Yes Give detail)</label></div> <div class="input-container"> <input class="form-control" type="text" name="current_med" id="current_med"> </div> <div class="label_box"><label>Required Special Assistance</label></div> <div class="input-container"> <input class="form-control" type="text" name="current_assistance" id="current_assistance"> </div> </div> <div class="mb-3"> <div class="label_box"><label> <h4>Allergies</h4> </label></div> <div class="label_box"><label>Health Issue</label></div> <div class="input-container"> <input class="form-control" type="text" name="allergy_health" id="allergy_health"> </div> <div class="label_box"><label>Medicine(Yes/No ,if Yes Give detail)</label></div> <div class="input-container"> <input class="form-control" type="text" name="allergy_med" id="allergy_med"> </div> <div class="label_box"><label>Required Special Assistance</label></div> <div class="input-container"> <input class="form-control" type="text" name="allergy_assistance" id="allergy_assistance"> </div> </div> <div class="mb-3"> <div class="label_box"><label> <h4>Travel Sickness</h4> </label></div> <div class="label_box"><label>Health Issue</label></div> <div class="input-container"> <input class="form-control" type="text" name="travel_health" id="travel_health"> </div> <div class="label_box"><label>Medicine(Yes/No ,if Yes Give detail)</label></div> <div class="input-container"> <input class="form-control" type="text" name="travel_med" id="travel_med"> </div> <div class="label_box"><label>Required Special Assistance</label></div> <div class="input-container"> <input class="form-control" type="text" name="travel_assistance" id="travel_assistance"> </div> </div> <div class="mb-3"> <div class="label_box"><label> <h4>Chronic Medical Conditions</h4> </label></div> <div class="label_box"><label>Health Issue</label></div> <div class="input-container"> <input class="form-control" type="text" name="chronic_health" id="chronic_health"> </div> <div class="label_box"><label>Medicine(Yes/No ,if Yes Give detail)</label></div> <div class="input-container"> <input class="form-control" type="text" name="chronic_med" id="chronic_med"> </div> <div class="label_box"><label>Required Special Assistance</label></div> <div class="input-container"> <input class="form-control" type="text" name="chronic_assistance" id="chronic_assistance"> </div> </div> <div class="mb-3"> <div class="row"> <div class="col-12"> <button type="submit" class="btn btn-primary" id="generate_travel_id" style="width:100%"><b><i class="ace-icon fa fa-save" style="color:white"></i> Save</b></button> </div> </div> </div> </form> </div> </div> </div> </div> <div id="travel" class="tab-pane fade rounded-4"> <div class="row rounded-4" style="width: 100%;"> <div class="col-5 division-box1 p-4 rounded-start-4 text-center bg-white"> <div class="row" style="width:100%;"> <div class="text-center" style="padding-top: 4px;"> <h4 class="mb-5" style="color:#2C3542"><b>Employee Travel Details</b></h4> </div> <!-- <div class="text-start" style="width: 25%;"> <button class="add_row_btn" onclick="addFields()"><ion-icon name="add-outline" size="large"></ion-icon></button> </div> --> </div> <br /> <!-- <input type="button" class="btn btn-sm btn-block " id="addrow" value="Add Row" /> --> <form id="travel_form" method="post"> <div class="mb-3"> <div class="label_box"><label>Origin Country</label></div> <div class="input-container"> <select class="form-control col-sm-4" name="origin_country0" style="width: 100%" id="origin_country0" onchange="mySelectChange()"> <option disabled selected>Select Origin Country</option> <?php echo generateOption('country_master', 'country_name', 'country_id', '', ''); ?> </select> </div> <div class="input-container" id="clone_origin"> </div> </div> <div class="mb-3"> <div class="label_box"><label>Destination Country</label></div> <select class="form-control col-sm-4" name="destination_country0" style="width: 100%" id="destination_country0" onchange="mySelectChange()"> <option disabled selected>Select Destination Country</option> <?php echo generateOption('country_master', 'country_name', 'country_id', '', ''); ?> </select> <div class="input-container" id="clone_destination"> </div> </div> <!-- <div class="mb-3"> <div class="label_box"><label>Destination Accomodation</label></div> <div class="input-container"> <input type="text" class="form-control" style="width: 100%" name="accomodation0" id="accomodation0" placeholder="Destination Accomodation" style="color:white;" /> </div> <div class="input-container" id="clone_accomodation"> </div> </div> --> <div class="mb-3"> <input type="hidden" name="count_items" id="count_items" value="1" /> </div> <div class="mb-3"> <div class="row"> <div class="col-2"> <button class="add_row_btn" onclick="removeFields()"> <ion-icon name="remove-outline" size="large" style="color: red;"></ion-icon> </button> </div> <div class="col-8"> <button type="submit" class="btn btn-primary" id="save_employee_travel" style="width:100%"><b><i class="ace-icon fa fa-save" style="color:white"></i> SAVE</b></button> </div> <div class="col-2"> <button class="add_row_btn" onclick="addFields()"> <ion-icon name="add-outline" size="large" style="color: green;"></ion-icon> </button> </div> </div> </div> </form> </div> <div class="col-7 division-box2 p-4 text-center" id="advisory_emp" style="background-color:#FAFAFA"> <h4 style="color:#2C3542"><b>Advisory For Employee</b></h4><br /> <!-- <div class="d-flex align-items-center justify-content-center" id="instruct" style="margin-top:200px"> <h3 class="text-center" style="color:#2C3542">Fill the Travel Details Form to get Advisory</h3> </div> --> <!-- <div class="container-sm text-center mt-5"> --> <!-- <div class="text-start"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#medDetails" onclick="show_vaccination(<?php echo $emp_id ?>);"> Vaccination History <i class="fa fa-info-circle" style="color:white;"></i> </button> </div> --> <div class="table-responsive" style="margin-top:16px"> <table class="table table-striped border border-0" id="advisory_table" style="width: 100%; display: none;"> <thead> <th>Entry requirement in Destination Country</th> <th>Mandatory Vaccinations/Prophylaxis</th> <th>Other WHO Recommended Vaccinations</th> </thead> </table> </div> <!-- </div> --> </div> </div> </div> <div id="past_travel" class="tab-pane fade rounded-4"> <!-- <div id="user-profile-2"> --> <div class="container-fluid"> <div class="row" id="travel_history"> <!-- MAIN CONTENT START --> <div class="text-center"> <h4 style="color:#2C3542"><b>Travel Health Summary</b></h4> </div> <!-- --------------------------------------- --> <div class="table-responsive" align='center' style=" text-align: center; width: 100%;"> <?php $travel_select_query = "select * from employee_travel_health where emp_id =" . $emp_id . " "; // echo $travel_select_query . "<br>"; $travel_result = @mysqli_query($conn, $travel_select_query); $travel_rows = @mysqli_num_rows($travel_result); // print_r($travel_result); ?> <table class="table table-bordered" id='past_travel_details' style="width: 100%"> <thead> <tr> <th align="center">Sr. No</th> <th>Origin To Destination</th> <th align="center">Current Health</th> <th align="center">Allergies</th> <th align="center">Travel Sickness</th> <th align="center">Chronic medical conditions</th> <th align="center">Medicine Checklist</th> <th align="center">Fill Feedback</th> <th></th> </tr> </thead> <tbody> <?php if ($travel_rows == 0) { ?> <tr> <td align='center' colspan="5">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> </tr> <?php } ?> <?php $count = 0; while ($row_travel = mysqli_fetch_array($travel_result)) { $origin_route = []; $destination_route = []; $travel_route = ""; $travel_query = "select * from patient_travel where emp_travel_id='" . $row_travel['id'] . "'"; error_log("travel detail " . $travel_query); $result_route = mysqli_query($conn, $travel_query); $num = 0; while ($row_route = mysqli_fetch_assoc($result_route)) { $origin_route[$num] = $row_route['origin_country']; $destination_route[$num] = $row_route['destination_country']; $num++; error_log("array " . print_r($origin_route, true)); error_log("array " . print_r($destination_route, true)); } for ($i = 0; $i < sizeof($destination_route); $i++) { if ($i == 0) { $origin = getFieldFromTable('country_name', 'country_master', 'country_id', $origin_route[$i]); $destination = getFieldFromTable('country_name', 'country_master', 'country_id', $destination_route[$i]); $travel_route .= $origin . "->" . $destination; } else { $destination = getFieldFromTable('country_name', 'country_master', 'country_id', $destination_route[$i]); $travel_route .= "-> " . $destination; } } ?> <tr> <td align="center"><?php echo $count + 1 ?></td> <td><?= $travel_route ?></td> <td><?php echo "Health Issue: " . $row_travel['current_issue'] . "<hr>Medicine: " . $row_travel['current_med'] . "<hr>Required Special Assistance: " . $row_travel['current_assistance'] . "" ?> </td> <td><?php echo "Health Issue: " . $row_travel['allergy_issue'] . "<hr>Medicine: " . $row_travel['allergy_med'] . "<hr>Required Special Assistance: " . $row_travel['allergy_assistance'] . "" ?> </td> <td><?php echo "Health Issue: " . $row_travel['travel_issue'] . "<hr>Medicine: " . $row_travel['travel_med'] . "<hr>Required Special Assistance: " . $row_travel['travel_assistance'] . "" ?> </td> <td><?php echo "Health Issue: " . $row_travel['chronic_issue'] . "<hr>Medicine: " . $row_travel['chronic_med'] . "<hr>Required Special Assistance: " . $row_travel['chronic_assistance'] . "" ?> </td> <td style="width: 40%;"> <?php echo getCommaSeperatedValuesForInClause("select medicine_type from travel_medicine_list", 'id', $row_travel['checklist_medicine']) ?> </td> <?php $is_added = getFieldFromTable('feedback_id', 'travel_feedback', 'emp_travel_id', $row_travel['id']); if ($is_added > 0) { ?> <td>Filled <i class="fa fa-check"></i></td> <?php } else { ?> <td align="center"> <button type="button" class="btn btn-primary btn-sm" style="font-size:inherit;" data-bs-toggle="modal" data-bs-target="#feedbackModal" onclick="setId(<?= $row_travel['id'] ?>)">Feedback</button> </td> <?php } ?> <td align="center"> <a href="#" type="button" onclick="delete_travel_details('<?= $row_travel['id'] ?>');"> <i style="font-size: inherit;" class="ace-icon fa fa-trash-o bigger-130"> </i> </a> </td> </tr> <?php $count++; } ?> </tbody> </table> </div> <!-- MAIN CONTENT END --> </div> <!-- END SECI+OND TAB --> </div> <!-- </div> --> </div> <div id="travel_medicine_tab" class="tab-pane fade rounded-4"> <h2 class="text-center">Medicine/Essential/FA Checklist</h2> <form method="post" id="checklist_form"> <?php $pres_arr = []; $travel_arr = []; $essentials = []; $fa = []; $query = "select * from travel_medicine_list"; $result = mysqli_query($conn, $query); while ($row = mysqli_fetch_assoc($result)) { if (strcmp($row['category'], "prescription") == 0) $pres_arr[$row['id']] = $row['medicine_type']; if (strcmp($row['category'], "travel") == 0) $travel_arr[$row['id']] = $row['medicine_type']; if (strcmp($row['category'], "essentials") == 0) $essentials[$row['id']] = $row['medicine_type']; if (strcmp($row['category'], "fa") == 0) $fa[$row['id']] = $row['medicine_type']; } ?> <div class="main shadow-lg rounded"> <div class="prescription-medicine"> <h1 class="h1">Prescription Medicine</h1> <?php $pres_keys = array_keys($pres_arr); for ($i = 0; $i < sizeof($pres_keys); $i++) { ?> <div class="item"> <input type="checkbox" name="sel_med[]" value="<?= $pres_keys[$i] ?>" /> <span for=""><?= $pres_arr[$pres_keys[$i]] ?></span> </div> <? } ?> </div> <hr /> <div class="travel-medicine"> <h1 class="h1">Travel Medicine</h1> <?php $travel_keys = array_keys($travel_arr); for ($i = 0; $i < sizeof($travel_keys); $i++) { ?> <div class="item"> <input type="checkbox" name="sel_med[]" value="<?= $travel_keys[$i] ?>" /> <span for=""><?= $travel_arr[$travel_keys[$i]] ?></span> </div> <? } ?> </div> <hr /> <div class="essentials-medicine"> <h1 class="h1">Essentials</h1> <?php $essentials_keys = array_keys($essentials); for ($i = 0; $i < sizeof($essentials_keys); $i++) { ?> <div class="item"> <input type="checkbox" name="sel_med[]" value="<?= $essentials_keys[$i] ?>" /> <span for=""><?= $essentials[$essentials_keys[$i]] ?></span> </div> <? } ?> </div> <hr /> <div class="first-aid-medicine"> <h1 class="h1">First Aid</h1> <?php $fa_keys = array_keys($fa); for ($i = 0; $i < sizeof($fa_keys); $i++) { ?> <div class="item"> <input type="checkbox" name="sel_med[]" value="<?= $fa_keys[$i] ?>" /> <span for=""><?= $fa[$fa_keys[$i]] ?></span> </div> <? } ?> </div> </div> <div class="shadow rounded" style="background-color: skyblue;"> <h5 class="text-center">You can select from above. If required Travel prescription can be provide </h5> </div> <div class="text-center" style="width:100%;"> <button class="btn btn-primary" type="submit" id="submit_checklist">Save</button> </div> </form> </div> <div id="past_feedback" class="tab-pane fade shadow rounded-4"> <!-- <div id="user-profile-2"> --> <div class="container-fluid"> <div class="row" id="feedback_history"> <!-- MAIN CONTENT START --> <div class="text-center"> <h4 style="color:#2C3542"><b>Feedback Details</b></h4> </div> <!-- --------------------------------------- --> <div class="table-responsive" align='center' style=" text-align: center; width: 100%;"> <?php $travel_select_query = "select a.id,b.* from employee_travel_health a left join travel_feedback b on a.id = b.emp_travel_id where a.emp_id =" . $emp_id . " "; // echo $travel_select_query . "<br>"; $travel_result = @mysqli_query($conn, $travel_select_query); $travel_rows = @mysqli_num_rows($travel_result); // print_r($travel_result); ?> <table class="table table-bordered" id='past_travel_feedback' style="width: 100%"> <thead> <tr> <th align="center">Sr. No</th> <th>Origin To Destination</th> <th>Health Complaints During Current Visit?</th> <th>Health Complaints Post 7 Day Of Travel?</th> <th></th> </tr> </thead> <tbody> <?php if ($travel_rows == 0) { ?> <tr> <td align='center' colspan="5">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> <td class="d-none">No data Found</td> </tr> <?php } ?> <?php $count = 0; while ($row_travel = mysqli_fetch_array($travel_result)) { $origin_route = []; $destination_route = []; $travel_route = ""; $travel_query = "select * from patient_travel where emp_travel_id='" . $row_travel['id'] . "'"; error_log("travel detail " . $travel_query); $result_route = mysqli_query($conn, $travel_query); $num = 0; while ($row_route = mysqli_fetch_assoc($result_route)) { $origin_route[$num] = $row_route['origin_country']; $destination_route[$num] = $row_route['destination_country']; $num++; error_log("array " . print_r($origin_route, true)); error_log("array " . print_r($destination_route, true)); } for ($i = 0; $i < sizeof($destination_route); $i++) { if ($i == 0) { $origin = getFieldFromTable('country_name', 'country_master', 'country_id', $origin_route[$i]); $destination = getFieldFromTable('country_name', 'country_master', 'country_id', $destination_route[$i]); $travel_route .= $origin . "->" . $destination; } else { $destination = getFieldFromTable('country_name', 'country_master', 'country_id', $destination_route[$i]); $travel_route .= "-> " . $destination; } } ?> <tr> <td align="center"><?php echo $count + 1 ?></td> <td><?= $travel_route ?></td> <td><?= $row_travel['complaint_during_travel'] ?></td> <td><?= $row_travel['complaint_post_travel'] ?></td> <td align="center"> <!-- <a href="#" onclick="delete_travel_details('<?= $row_travel['id'] ?>');"> <i style="font-size: 20px;" class="ace-icon fa fa-trash-o bigger-130"> </i> </a> --> </td> </tr> <?php $count++; } ?> </tbody> </table> </div> <!-- MAIN CONTENT END --> </div> <!-- END SECI+OND TAB --> </div> <!-- </div> --> </div> </div> </div> <!-- vaccine modal --> <!-- Modal --> <div class="modal fade" id="med-modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" style="max-width:950px"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="exampleModalLabel"> <?php echo getFieldFromTable('patient_name', 'patient_master', 'id', $emp_id) ?> Vaccination Info </h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <table id="med-detail-table" class="table table-striped" cellspacing="0" width="100%" border="1"> <thead> <tr> <th>Sr No</th> <th>Vaccine Name</th> <th>1st Dose</th> <th>1st Vaccine Center</th> <th>2nd Dose</th> <th>2nd Vaccine Center</th> <th>3rd Dose</th> <th>3rd Vaccine Center</th> <th>Remarks</th> </tr> </thead> <tbody> </tbody> </table> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="modal fade" id="feedbackModal" tabindex="-1" aria-labelledby="feedbackModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header" style="background-color: #0d6efd; color: white;"> <h5 class="modal-title" id="feedbackModalLabel">Feedback Form</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <!-- <div class="main-form shadow rounded"> --> <form method="post" id="feedback_form"> <input type="hidden" name="main_travel_id" id="main_travel_id" value=""> <div class="form-group"> <label for="issue-during">Health complaints during travel</label> <textarea class="form-control" id="issue-during" name="issue-during" rows="2"></textarea> </div> <div class="form-group"> <label for="issue-post">Health complaints post 7 day of travel</label> <textarea class="form-control" id="issue-post" name="issue-post" rows="2"></textarea> </div> </form> <!-- </div> --> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" id="saveFeedback">Save</button> </div> </div> </div> </div> <form style="display: none" name="flex_medical_form_pdf" method="post" action="" target="_blank" id="flex_medical_form_pdf"> <input type="hidden" name="medical_exam_id" id="medical_exam_id"> </form> <form style="display: none" name="flex_opd_injury_pdf" method="post" action="" target="_blank" id="flex_opd_injury_pdf"> <input type="hidden" name="appointment_id_pdf" id="appointment_id_pdf"> </form> <form style="display: none" name="flex_sickness_pdf" method="post" action="" target="_blank" id="flex_sickness_pdf"> <input type="hidden" name="flex_sickness_id" id="flex_sickness_id"> </form> <form name="f1" method="post" id="flex_opd_id_medical" action=""> <div id="flex1" style="width: 100%"></div> <input type="hidden" name="flex_opd_id" id="flex_opd_id" /> </form> <form name="f2" method="post" id="employee_form" action=""> <div id="flex1" style="width: 100%"></div> <input type="hidden" name="flex_patient_id" id="flex_patient_id" /> </form> <script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script> <script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script> <script src="jquery.sumoselect-master/jquery.sumoselect.min.js"></script> <link href="jquery.sumoselect-master/sumoselect.css" rel="stylesheet" /> <script async="" src="./js/analytics.js"></script> <script src="./js/Chart.min.js"></script> <script src="./js/utils.js"></script> <script type="text/javascript"> $('.select').SumoSelect(); function open_appointment_pdf(page, appointtment_id) { $("#appointment_id_pdf").val(appointtment_id); $("#flex_opd_injury_pdf").attr('method', 'POST'); $("#flex_opd_injury_pdf").attr('action', page); $("#flex_opd_injury_pdf").submit(); } console.log("CONSOLE CHECK"); $(document).ready(function() { $('#myTabs a').click(function(e) { e.preventDefault(); $(this).tab('show'); }); }); // to set id in feedback form so that we can use that to save function setId(id) { $("#main_travel_id").val(id); console.log("added id"); } document.addEventListener('DOMContentLoaded', function() { let hsitory_table = new DataTable('#past_travel_details', { responsive: true }); let feedback_table = new DataTable('#past_travel_feedback', { responsive: true }); let vaccine_table = new DataTable('#med-detail-table', { responsive: true }); }); $("#saveFeedback").on('click', (event) => { event.preventDefault(); $.ajax({ type: 'post', url: 'save_feedback.php', data: { formdata: $("#feedback_form").serialize() }, success: function(data) { Swal.fire( 'Thank you!', 'Feedback is added', 'success' ).then(function() { window.location.reload(); }); }, error: function(data) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Something went wrong!', }) } }) }) $("#generate_travel_id").on('click', function(event) { event.preventDefault(); $.ajax({ type: 'POST', url: 'save_health_details.php', data: { formdata: $("#health_form").serialize() }, success: function(data) { data = JSON.parse(data); document.getElementById("emp_travel_id").value = data; Swal.fire( 'Good job!', 'Saved Health Details ! Now Fill Travel Details', 'success' ) }, error: function(data) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Something went wrong!', }) } }); }); $("#submit_checklist").on('click', function(event) { event.preventDefault(); let generated_id = document.getElementById("emp_travel_id").value; if (generated_id === '' || generated_id === null || generated_id === undefined) { Swal.fire({ icon: 'error', title: 'Oops...', text: `First Fill Travel Health Details`, }) return false; } let checkboxes = document.querySelectorAll('input[type="checkbox"]'); let selectedValues = []; for (let i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { selectedValues.push(checkboxes[i].value); } } let selectedValuesString = selectedValues.join(','); console.log("selected checklist " + selectedValuesString); current_id = document.getElementById("emp_travel_id").value; $.ajax({ type: 'POST', url: 'emp_travel_checklist.php', data: { formdata: selectedValuesString, emp_travel_id: current_id }, success: function(data) { data = JSON.parse(data); Swal.fire( 'Done!', 'You have filled all the details successfully! you can see your filled data in past travel tab', 'success' ).then(() => { window.location.reload(); }); // lo }, error: function(data) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Something went wrong!', }) } }); }); // VACCINATION FUNCTION function show_vaccination(id) { $("#med-detail-table tbody").html(""); $.ajax({ type: 'post', url: 'get_vac_data.php', data: { patient_id: id }, success: function(data) { data = JSON.parse(data); console.log(data); var rowData = ""; if (data.status == 200) { rowData += `<tr class="text-center"><td colspan="9">No data found</td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td></tr>`; } else { var srno = 1; for (medId in data) { if (data.hasOwnProperty(medId)) { // med_detail var vaccine_detail = data[medId]; var vaccine_name = vaccine_detail['vaccine_name']; var onedose = vaccine_detail['onedose']; var onedose_center = vaccine_detail['onedose_center']; var twodose = vaccine_detail['twodose']; var twodose_center = vaccine_detail['twodose_center']; var threedose = vaccine_detail['threedose']; var threedose_center = vaccine_detail['threedose_center']; var remarks = vaccine_detail['remarks']; rowData += `<tr><td rowspan="9">No data found</td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td><td class="d-none"></td></tr>`; } srno++; } } $("#med-detail-table").append(rowData); $('#med-modal').modal('show'); }, error: function(data) { console.log("something went wrong"); } }); } function setPassportCountry() { console.log("got here"); var country_id = document.getElementById("passport_country").value; $.ajax({ url: 'save_emp_passport.php', data: { countryId: country_id, }, type: 'get', dataType: 'json', async: true, success: function(data) { // alert("Passport Country Updated"); console.log("Passport Saved"); }, error: function(data) { console.log("Error Saving Passport"); } }); } function mySelectChange() { var count_Value = document.getElementById('count_items').value; originArray = []; destinationArray = []; for (let i = 0; i < count_Value; i++) { if (i == 0) { originArray[i] = $("#origin_country" + i).val(); destinationArray[i] = $("#destination_country" + i).val(); } else { originArray[i] = $("#destination_country" + (i - 1)).val(); destinationArray[i] = $("#destination_country" + i).val(); } } // console.log(selectedValue + " " + selectId); $.ajax({ url: 'get_advisory_detail.php', data: { originCountryArray: originArray, destinationCountryArray: destinationArray }, type: 'POST', dataType: 'json', success: function(data) { console.log(data); const table = document.getElementById('advisory_table'); let tbody = table.querySelector('tbody'); // Clear existing rows if (tbody) { tbody.innerHTML = ''; } else { // Create a new tbody element if it doesn't exist tbody = document.createElement('tbody'); table.appendChild(tbody); } // Loop through the data array data.forEach((item) => { if (item.to_country != '' && item.to_country != undefined && item.to_country != null) { // Create a new row for each item const row = tbody.insertRow(); // Create table cells and populate them with the data const fromCountryCell = createTableCell(item.to_country); const vaccinationsCell = createTableCell(item.vaccinations); const showCell = document.createElement('td'); const showButton = document.createElement('button'); showButton.setAttribute('type', 'button'); showButton.setAttribute('class', 'btn btn-primary btn-sm'); showButton.setAttribute('data-bs-toggle', 'modal'); showButton.setAttribute('data-bs-target', '#exampleModal'); showButton.innerHTML = 'WHO Recommended Vaccination Details <i class="fa fa-info-circle" style="color:white;"></i>'; showCell.appendChild(showButton); // Append the cells to the row row.appendChild(fromCountryCell); row.appendChild(vaccinationsCell); row.appendChild(showCell); table.style.display = ''; } }); // Remove the 'display' property to make the table visible }, error: function(data) { Swal.fire({ icon: 'error', title: 'Error..', text: `Vaccination Details Not Deleted!`, }) } }); } // // Function to create a table cell and set its value function createTableCell(value) { const cell = document.createElement('td'); cell.textContent = value; return cell; } $("#save_employee_travel").on('click', function(event) { event.preventDefault(); let generated_id = document.getElementById("emp_travel_id").value; if (generated_id === '' || generated_id === null || generated_id === undefined) { Swal.fire({ icon: 'error', title: 'Oops...', text: `First Fill Travel Health Details`, }) return false; } $.ajax({ type: 'POST', url: 'save_travel_details.php', data: { formdata: $("#travel_form").serialize(), emp_travel_id: generated_id }, success: function(data) { data = JSON.parse(data); Swal.fire( 'Good job!', 'Saved Health Details ! Now Fill Medicine Checklist', 'success' ) }, error: function(data) { Swal.fire({ icon: 'error', title: 'Oops...', text: `Something went wrong here`, }) } }); }); function addFields() { event.preventDefault(); var count_Value = document.getElementById('count_items').value; // var previous_destination = document.getElementById('destination_country' + (count_Value - 1)).value; // alert("PREVIOUS DESTINATION -> " + previous_destination); // var originCountry = document.createElement('select'); // originCountry.className = 'mySelect form-control col-sm-4'; // originCountry.name = 'origin_country' + count_Value; // originCountry.id = 'origin_country' + count_Value; // originCountry.style.width = '100%'; // originCountry.addEventListener('change', mySelectChange); var destinationCountry = document.createElement('select'); destinationCountry.className = 'mySelect form-control col-sm-4'; destinationCountry.name = 'destination_country' + count_Value; destinationCountry.id = 'destination_country' + count_Value; destinationCountry.style.width = '100%'; destinationCountry.addEventListener('change', mySelectChange); // var accomodationInput = document.createElement('input'); // accomodationInput.type = 'text'; // accomodationInput.placeholder = 'Destination Accomodation'; // accomodationInput.className = 'form-control'; // accomodationInput.name = 'accomodation' + count_Value; // accomodationInput.id = 'accomodation' + count_Value; // accomodationInput.style.width = '100%'; $.ajax({ url: 'generate_country_options.php', method: 'GET', success: function(data) { data = JSON.parse(data); // var originDisabledOption = `<option disabled selected>Select Origin Country</option>`; var destinationDisabledOption = `<option disabled selected>Select Destination Country</option>`; var optionElements = ""; if (data === 'error') { } else { Object.entries(data).forEach(function([key, value]) { optionElements += '<option value="' + key + '">' + value + '</option>'; }); } // originCountry.innerHTML = originDisabledOption; // originCountry.innerHTML += optionElements; //country as option destinationCountry.innerHTML = destinationDisabledOption; destinationCountry.innerHTML += optionElements; //country as option // var cloneOriginElement = document.getElementById('clone_origin'); // cloneOriginElement.appendChild(originCountry); // into the div to display var cloneDestinationElement = document.getElementById('clone_destination'); cloneDestinationElement.appendChild(destinationCountry); // into the div to display // var cloneAccomodationElement = document.getElementById('clone_accomodation'); // cloneAccomodationElement.appendChild(accomodationInput); // into the div to display // var optionToSelect = originCountry.querySelector('option[value="' + previous_destination + '"]'); // if (optionToSelect) { // optionToSelect.selected = true; // Set the selected property to true for the matching option // mySelectChange.call(originCountry); // } }, error: function() { Swal.fire({ icon: 'error', title: 'Error..', text: `Error adding new fields.`, }) } }); count_Value++; $('#count_items').val(count_Value); } function removeFields() { event.preventDefault(); var count_Value = ($('#count_items').val()) - 1; if (count_Value <= 0) { return false; } // remove all count_Value - 1 id elements $('#origin_country' + count_Value).remove(); $('#destination_country' + count_Value).remove(); $('#accomodation' + count_Value).remove(); $('#count_items').val(count_Value); // alert(count_Value); } /////////////// // TO VIEW AND EDIT PATIENT TRAVEL // function open_travel_details(employeeId, action) { // // var id = ""; // if (action == "V") { // $(".save_button").hide(); // } else { // $(".save_button").show(); // } // $.ajax({ // url: 'select_travel_id.php', // type: 'POST', // data: { // id: employeeId, // }, // success: function(data) { // // data = $.parseJSON(data); // console.log(data); // $("#travel_id0").val(data.id); // $("#travel_location0").val(data.travel_location); // $("#travel_location0").select2(); // $("#travel_type0").val(data.travel_type); // $("#travel_type0").select2(); // $("#vac_stat0").val(data.vac_status); // $("#vac_stat0").select2(); // $("#travel_stat0").val(data.status); // $("#travel_stat0").select2(); // // if (data.travel_location != null) { // // var travel_location = data.travel_location // // dataarray = travel_location.split(","); // // // // $("#travel_location0").val(dataarray); // // } // // $("#travel_location0").trigger("chosen:updated"); // // resizeChosen(); // // jQuery(window).on('resize', resizeChosen); // // $('#modal-add-patient_master').modal("show"); // }, // error: function(data) { // alert('Error Populating Patient Travel Data'); // return; // } // }); // } //////////// // DELETE PATIENT TRAVEL function delete_travel_details(id) { // alert(id); $.ajax({ url: 'delete_travel_detail.php', type: "POST", data: { id: id }, success: function(data) { Swal.fire({ icon: 'success', title: 'Success...', text: `Deleted Successfully`, }).then(function() { window.location.reload(); }); // location.reload(); }, error: function(data) { // alert('Error Deleting Details'); Swal.fire({ icon: 'error', title: 'Error..', text: `Error Deleting Details.`, }) return; } }); } // }); // } </script> <script> var emp_id = "<?php echo $emp_id ?>" //alert(emp_id); var health_index_array = []; var health_index_labels = []; var hyg_param_values = []; var hyg_param_labels = []; var myData = []; var mylabels = []; var myDbp = []; var heartRate = []; $.ajax({ type: 'get', url: 'select_employee_sbp.php', data: { 'emp_id': emp_id }, dataType: 'json', async: false, success: function(data) { for (var i = 0; i < data.length; i++) { myData.push(data[i].checkup_form_value); mylabels.push(data[i].checkup_date); //myDbp.push(data[i].dbp); //heartRate.push(data[i].heart_rate); } }, error: function(data) { } }); $.ajax({ type: 'get', url: 'select_employee_dbp.php', data: { 'emp_id': emp_id }, dataType: 'json', async: false, success: function(data) { for (var i = 0; i < data.length; i++) { myDbp.push(data[i].checkup_form_value); //myDbp.push(data[i].dbp); //heartRate.push(data[i].heart_rate); } }, error: function(data) { } }); $.ajax({ type: 'get', url: 'select_employee_pulse.php', data: { 'emp_id': emp_id }, dataType: 'json', async: false, success: function(data) { for (var i = 0; i < data.length; i++) { //myDbp.push(data[i].dbp); heartRate.push(data[i].checkup_form_value); } }, error: function(data) { } }); var color = Chart.helpers.color; //var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; $.ajax({ type: 'get', url: 'select_employee_hygiene_parameter.php', data: { 'emp_id': emp_id }, dataType: 'json', async: false, success: function(data) { for (var i = 0; i < data.length; i++) { //myDbp.push(data[i].dbp); hyg_param_values.push(data[i].hyg_parameter_val); hyg_param_labels.push(data[i].checkup_date); } }, error: function(data) { } }); var data = { labels: hyg_param_labels, datasets: [ { label: "Indium", data: hyg_param_values, backgroundColor: "blue", borderColor: "lightblue", fill: false, lineTension: 0, radius: 5 }, ] }; var emp_weight_array = []; var emp_weight_labels = []; $.ajax({ type: 'POST', url: 'select_employee_weight.php', data: { 'emp_id': emp_id }, dataType: 'json', async: false, success: function(data) { for (var i = 0; i < data.length; i++) { emp_weight_array[i] = data[i].checkup_form_value; emp_weight_labels[i] = data[i].checkup_date; } }, error: function(data) { } }); var data = { labels: emp_weight_labels, datasets: [ { label: "Weight", data: emp_weight_array, backgroundColor: "blue", borderColor: "lightblue", fill: false, lineTension: 0, radius: 5 }, ] }; var rightVision = []; var empRightVisionLabels = []; $.ajax({ type: 'POST', url: 'select_employee_vision.php', data: { 'emp_id': emp_id }, dataType: 'json', async: false, success: function(data) { for (var i = 0; i < data.length; i++) { rightVision[i] = data[i].checkup_form_value; empRightVisionLabels[i] = data[i].checkup_date; } }, error: function(data) { } }); var dataVision = { labels: empRightVisionLabels, datasets: [ { label: "Right Vision", data: rightVision, backgroundColor: "blue", borderColor: "lightblue", fill: false, lineTension: 0, radius: 5 }, ] }; Chart.defaults.global.pointHitDetectionRadius = 1; var customTooltips = function(tooltip) { // Tooltip Element var tooltipEl = document.getElementById('chartjs-tooltip'); if (!tooltipEl) { tooltipEl = document.createElement('div'); tooltipEl.id = 'chartjs-tooltip'; tooltipEl.innerHTML = '<table></table>'; this._chart.canvas.parentNode.appendChild(tooltipEl); } // Hide if no tooltip if (tooltip.opacity === 0) { tooltipEl.style.opacity = 0; return; } // Set caret Position tooltipEl.classList.remove('above', 'below', 'no-transform'); if (tooltip.yAlign) { tooltipEl.classList.add(tooltip.yAlign); } else { tooltipEl.classList.add('no-transform'); } function getBody(bodyItem) { return bodyItem.lines; } // Set Text if (tooltip.body) { var titleLines = tooltip.title || []; var bodyLines = tooltip.body.map(getBody); var innerHtml = '<thead>'; titleLines.forEach(function(title) { innerHtml += '<tr><th>' + title + '</th></tr>'; }); innerHtml += '</thead><tbody>'; bodyLines.forEach(function(body, i) { var colors = tooltip.labelColors[i]; var style = 'background:' + colors.backgroundColor; style += '; border-color:' + colors.borderColor; style += '; border-width: 2px'; var span = '<span class="chartjs-tooltip-key" style="' + style + '"></span>'; innerHtml += '<tr><td>' + span + body + '</td></tr>'; }); innerHtml += '</tbody>'; var tableRoot = tooltipEl.querySelector('table'); tableRoot.innerHTML = innerHtml; } var positionY = this._chart.canvas.offsetTop; var positionX = this._chart.canvas.offsetLeft; // Display, position, and set styles for font tooltipEl.style.opacity = 1; tooltipEl.style.left = positionX + tooltip.caretX + 'px'; tooltipEl.style.top = positionY + tooltip.caretY + 'px'; tooltipEl.style.fontFamily = tooltip._bodyFontFamily; tooltipEl.style.fontSize = tooltip.bodyFontSize + 'px'; tooltipEl.style.fontStyle = tooltip._bodyFontStyle; tooltipEl.style.padding = tooltip.yPadding + 'px ' + tooltip.xPadding + 'px'; }; var lineChartData = { labels: mylabels, datasets: [{ label: 'Blood Pressure(SBP)', data: myData, borderColor: window.chartColors.blue, pointBackgroundColor: window.chartColors.blue, fill: false, }, { label: 'Blood Pressure(DBP)', data: myDbp, borderColor: window.chartColors.green, pointBackgroundColor: window.chartColors.green, fill: false, }, { label: 'Heart Rate', data: heartRate, borderColor: window.chartColors.red, pointBackgroundColor: window.chartColors.red, fill: false, } ] }; function formatDateBMI(input) { // alert(input); var datePart = input.match(/\d+/g), year = datePart[2], month = datePart[1], day = datePart[0]; return month; } function toMonthName(monthNumber) { const date = new Date(); date.setMonth(monthNumber - 1); return date.toLocaleString('en-US', { month: 'long', }); } function formatDate(input) { var datePart = input.match(/\d+/g), year = datePart[0], // get only two digits month = datePart[1], day = datePart[2]; return day + '-' + month + '-' + year; } function getShowingData() { var start = $("#startDate").val(); var end = $("#endDate").val(); var id = <?php echo $id ?>; var date = []; var BMI = []; var weight = []; var height = []; var sbp = []; var dbp = []; var ppbs = []; var fbs = []; var rbs = []; function formatDateBMI(input) { var datePart = input.match(/\d+/g), year = datePart[2], month = datePart[1], day = datePart[0]; return month; } function toMonthName(monthNumber) { const date = new Date(); date.setMonth(monthNumber - 1); return date.toLocaleString('en-US', { month: 'long', }); } var start_Month = formatDateBMI(start); var end_Month = formatDateBMI(end); var months = []; var sickness = []; var opd = []; var injury = []; // var monthOSI = []; $.ajax({ url: 'filter_report_deshboard.php', data: { startDate: start, endDate: end, id: id, start_Month: start_Month, end_Month: end_Month }, type: 'POST', dataType: 'json', success: function(data) { // alert(data); date = data['date'][0]; BMI = data['bmi'][0]; weight = data['weight'][0]; height = data['height'][0]; sbp = data['bp_sbp'][0]; dbp = data['bp_dbp'][0]; ppbs = data['blood_sugar_ppbs'][0]; fbs = data['blood_sugar_fbs'][0]; rbs = data['blood_sugar_rbs'][0]; months = data['months'][0]; sickness = data['sickness']; opd = data['opd'][0]; injury = data['injury']; // monthOSI = data['monthOSI'][0]; //console.log(data['injury']); // BMI table var content = ""; content += "<thead><tr>" + "<td>DATE</strong></td><td>HEIGHT</strong></td><td>WEIGHT</strong></td><td>BMI</strong></td>" content += "</thead>"; for (var l = 0; l < date.length; l++) { content += "<tr><td>" + date[l].split("-").reverse().join("-") + "</td><td>" + height[l] + "</td><td>" + weight[l] + "</td><td>" + BMI[l] + "</td>"; content += "</tr>"; } $("#bmi_table").html(content); // OSI table var content1 = ""; content1 += "<thead><tr>" + "<td>Month</strong></td><td>OPD Visits</strong></td><td>Injure Visit</strong></td><td>Sickness Visits</strong></td>" content1 += "</thead>"; for (var l = 0; l < months.length; l++) { // alert(toMonthName(months[l])); content1 += "<tr><td>" + toMonthName(months[l]) + "</td><td>" + opd[l] + "</td><td>" + injury[l] + "</td><td>" + sickness[l] + "</td>"; content1 += "</tr>"; } $("#osi_table").html(content1); // BP table var content2 = ""; content2 += "<thead><tr>" + "<td>DATE</strong></td><td>SBP</strong></td><td>DBP</strong></td>" // consol.log(date); content2 += "</thead>"; for (var l = 0; l < date.length; l++) { content2 += "<tr><td>" + date[l].split("-").reverse().join("-") + "</td><td>" + sbp[l] + "</td><td>" + dbp[l] + "</td>"; content2 += "</tr>"; } $("#bp_table").html(content2); var content = ""; content += "<thead><tr>" + "<td>DATE</strong></td><td>FBS</strong></td><td>RBS</strong></td><td>PPBS</strong></td>" // consol.log(date); content += "</thead>"; for (var l = 0; l < date.length; l++) { content += "<tr><td>" + date[l].split("-").reverse().join("-") + "</td><td>" + fbs[l] + "</td><td>" + rbs[l] + "</td><td>" + ppbs[l] + "</td>"; content += "</tr>"; } $("#suger_table").html(content); var ctx_bmi = document.getElementById('patient_bmi').getContext('2d'); var ctx_osi = document.getElementById('patient_osi').getContext('2d'); var ctx_bp = document.getElementById('patient_bp').getContext('2d'); var ctx_bs = document.getElementById('patient_bs').getContext('2d'); // BMI Graph function formatDateBMI(input) { var datePart = input.match(/\d+/g), year = datePart[0], month = datePart[1], day = datePart[2]; return day + '-' + month + '-' + year; } var xaxis = []; for (let i = 0; i < date.length; i++) { xaxis[i] = formatDateBMI(date[i]); } var myChart_bmi = new Chart(ctx_bmi, { type: 'line', options: { title: { display: true, text: "BMI Graph" }, legend: { position: "bottom" }, scales: { yAxes: [{ ticks: { precision: 0 } }] } }, data: { labels: xaxis, datasets: [{ data: BMI, label: "BMI", borderColor: "#d45087", backgroundColor: "#d45087", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 85 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: weight, label: "weight", borderColor: "#ff7c43", backgroundColor: "#ffa500", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: height, label: "height", borderColor: "#3e95cd", backgroundColor: "#7bb6dd", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }] }, }); // OSI Graph var axis = []; for (var i = 0; i < months.length; i++) { axis[i] = 'Month:' + months[i]; } var myChart_osi = new Chart(ctx_osi, { type: 'line', options: { title: { display: true, text: "OSI Graph" }, legend: { position: "bottom" }, scales: { yAxes: [{ ticks: { precision: 0 } }] } }, data: { labels: axis, datasets: [{ data: opd, label: "OPD", borderColor: "#d45087", backgroundColor: "#d45087", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 85 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: injury, label: "Injury", borderColor: "#ff7c43", backgroundColor: "#ffa500", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: sickness, label: "Sickness", borderColor: "#3e95cd", backgroundColor: "#7bb6dd", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }] }, }); //---------- bp chart--------------// var myChart_bp = new Chart(ctx_bp, { type: 'line', options: { title: { display: true, text: "BP Graph" }, legend: { position: "bottom" }, scales: { yAxes: [{ ticks: { precision: 0 } }] } }, data: { labels: xaxis, datasets: [{ data: dbp, label: "DBP", borderColor: "#d45087", backgroundColor: "#d45087", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 85 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: sbp, label: "SBP", borderColor: "#ff7c43", backgroundColor: "#ffa500", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }] }, }); //--------------- bs chart-------------// var myChart_bs = new Chart(ctx_bs, { type: 'line', options: { title: { display: true, text: "BS Graph" }, legend: { position: "bottom" }, scales: { yAxes: [{ ticks: { precision: 0 } }] } }, data: { labels: xaxis, datasets: [{ data: ppbs, label: "PPBS", borderColor: "#3e95cd", backgroundColor: "#7bb6dd", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 140 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: fbs, label: "FBS", borderColor: "#d45087", backgroundColor: "#d45087", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }, { data: rbs, label: "RBS", borderColor: "#ff7c43", backgroundColor: "#ffa500", fill: false, pointBackgroundColor: function(context) { var index = context.dataIndex; var value = context.dataset.data[index]; return value < 124 ? 'red' : // draw negative values in red index % 2 ? 'blue' : // else, alternate values in blue and green 'green'; } }] }, }); }, error: function(data) { alert('Error Populating Reports Details'); return; } }); } function save_problem() { $.ajax({ url: 'save_problem.php ', type: "POST", data: $("#problem_form").serialize(), success: function(data) { Swal.fire({ position: 'c', icon: 'success', title: 'Problem remission Date Save Successfully', showConfirmButton: false, timer: 3000 }) setTimeout(function() { window.location.reload(); }, 3000); }, error: function(data) { alert('Error Saving update city'); return; } }); $('.close').click(); } function save_appointment() { var app_type = $('#appointment_booking_type').val(); var date = $('#appointment_book_date').val(); var doc = $('#doctor_name').val(); var slot = $('#doctor_slot').val(); var available_slot = $('#available_slot').val(); if (app_type == '' || app_type == null) { Swal.fire({ position: 'c', icon: 'error', title: 'Please Select Appointment Type...!', showConfirmButton: false, timer: 3000 }); } else if (date == '' || date == null) { Swal.fire({ position: 'c', icon: 'error', title: 'Please Select Appointment Date...!', showConfirmButton: false, timer: 3000 }); } else if ((doc == '' || doc == null) && (app_type != 'MED')) { Swal.fire({ position: 'c', icon: 'error', title: 'Please Select Doctor...!', showConfirmButton: false, timer: 3000 }); } else if (slot == '' || slot == null) { Swal.fire({ position: 'c', icon: 'error', title: 'Please Select Slot...!', showConfirmButton: false, timer: 3000 }); } else if (available_slot == 0) { Swal.fire({ position: 'c', icon: 'error', title: 'There Is No Slot Availabe.Please Select Appointment For Anoter Slot..!', showConfirmButton: false, timer: 3000 }); } else { $('#save_app').prop('disabled', true); var previous_appointment= alreadyHaveAppointment(); if(app_type=='MED'){ app_type='Periodic Health Checkup' } if(previous_appointment==true){ Swal.fire({ position: 'c', icon: 'error', title: 'You have already an appintment for '+app_type+'.Please check your previous appointments ..!', showConfirmButton: false, timer: 5000 }); return false; }else{ $.ajax({ url: 'save_appointment.php', type: "POST", async:false, data: $("#appointment_form").serialize(), dataType: 'json', success: function(data) { open_mail(data.app_id, 'save'); }, error: function(data) { alert('Error Updating Details'); return; } }); } } } function open_mail(appointmentId, type) { $.ajax({ url: 'select_app_data.php', type: "POST", data: { 'cityId': appointmentId, }, dataType: 'json', success: function(data) { var app_id = data.id; var link = data.app_root; var emailContent = "<p>Dear Sir/Madam, </p>"; var status = ''; var sub_status = ''; if (data.status == 'BOOKED' && type != 'del') { sub_status = 'Confirmed'; status = "<font color=green>Confirmed</font> "; } else if (data.status == 'DRP') { sub_status = 'Pending'; status = "<font color=red>Pending</font>"; } else if (data.status == 'DRA') { sub_status = 'Completed'; status = "<font color=green>Completed</font> "; } else if (data.status == 'CANCELLED' || type == 'del') { sub_status = 'Cancelled'; status = " <font color=red>Cancelled</font>"; } if (data.app_type == 'FIT') { data.app_type = 'Sickness/Fitness'; } else if (data.app_type == 'MED') { data.app_type = 'Periodic Health Checkup'; } var email_list_to = data.emp_mail; var email_list_cc = data.doc_mail; ref_type = data.app_type + " Appointment"; var subject = 'Your appointment got ' + sub_status + ' in ' + data.ohc_type + ' OHC on ' + data .date + '.'; if (type != 'del') { emailContent += "<p>Your appointment got " + status + " in " + data.ohc_type + " OHC on " + data.date + " between " + data.slot + " - " + data.slot_end + ".</p>"; emailContent += "<p>Kindly make sure 12 hours fasting is required (You can consume water) before this health checkup. </p><p> Regards,</p><p> Team OHC</p>"; } else { emailContent += "<p>You have Cancelled your health checkup in " + data.ohc_type + " OHC got <font color=red>Cancelled</font> . Kindly click on below link to book a new appointment.</p>" emailContent += "<br><a href=`" + link + "`> Book a appointment</a> "; emailContent += "<p> Regards,</p><p> Team OHC</p>"; } // emailContent += "<br><a href=`" + link + // "`> Details</a> "; message = emailContent; var id = appointmentId; message = emailContent; send_mail_to_ohc( appointmentId,data.ohc_type,data.ohc_mail,data.date,data.patient_name,data.app_type,link,type); send_email(ref_type, appointmentId, email_list_to, email_list_cc, subject, message, type); }, error: function(data) { BootstrapDialog.alert('Error In Pulling Id'); return id; } }); } function send_email(ref_type, ref_identifier, email_list_to, email_list_cc, subject, message, type) { $.ajax({ url: 'send_email.php', type: 'POST', data: { ref_type: ref_type, ref_identifier: ref_identifier, email_list_to: email_list_to, email_list_cc: email_list_cc, subject: subject, message: message, }, success: function(data) { if (type == 'del') { $.ajax({ url: 'delete_booked_appointment.php', type: 'POST', dataType: 'json', data: { app_id: ref_identifier, status: "DELETED", }, success(data) { Swal.fire({ position: 'c', icon: 'error', title: 'Appointment cancelled successfully', showConfirmButton: false, timer: 3000 }) setTimeout(function() { window.location.reload(); }, 3000); }, error: function(data) { alert('Error in Getting slot'); return; } }); } else { Swal.fire({ position: 'c', icon: 'success', title: 'Appointment Booked Successfully', showConfirmButton: false, timer: 3000 }) setTimeout(function() { window.location.reload(); }, 3000); } }, error: function(data) { BootstrapDialog.alert('Error in sending mail'); return; } }); $('.close').click(); } function getParameterData() { let parameters = ($("#health_parameter").val()); var startDate = $("#startDate").val(); var endDate = $("#endDate").val(); // alert(allDates); // document.querySelector("#collapse_").innerHTML = '<canvas id="chart_monthly_training"></canvas>'; $.ajax({ type: 'post', url: 'chart_parametres_data_for dashboard.php', data: { emp_id: '<?= $emp_id ?>', parameters: parameters, startDate: startDate, endDate: endDate, }, dataType: 'json', success: function(data) { let content = ''; for (var i = 0; i < parameters.length; i++) { var key_param_name = data['key_param_name'][parameters[i]]; content += ` <div class="col-sm-6"> <h5 class="shadow rounded-4" style="background-color:#0d6efd; color: white;"> <center>` + key_param_name + ` <i class="ace-icon fa fa-star" style="color: white;"></i> </center> </h5> <div class="col-sm-6 card shadow" style="padding-left: 20px;width:500px"> <canvas id="parameter_data` + i + `" style='width:500px'></canvas> </div> </div> `; // end content } $("#parameter_charts").html(content); for (var i = 0; i < parameters.length; i++) { let key_param_name = parameters[i]; console.log(data['checkup_parameter'][+key_param_name][0]); var id = 'parameter_data' + i; var ctx = document.getElementById(id).getContext('2d'); var chartData = data['checkup_parameter'][+key_param_name][1]; var xaxis = data['checkup_parameter'][+key_param_name][0]; var colors = []; for (var c = 0; c < chartData.length; c++) { colors.push("#" + Math.floor(Math.random() * 16777215).toString(16)); } var dataset = []; dataset.push({ label: "count", data: chartData, borderColor: colors, backgroundColor: colors, fill: false, }); var Cdata = { labels: xaxis, datasets: dataset } var myChart = new Chart(ctx, { type: $("#choose_chart").val(), data: Cdata, options: { legend: { display: false }, scales: { xAxes: [{ ticks: { beginAtZero: true, precision: 0, } }] } } }); } }, error: function(date) { } }) } function getDocs(appointment_book_date, doc) { // alert(appointment_book_date); if ($('#appointment_booking_type').val() == 'MED') { getMedicalSlot(''); } else { $.ajax({ url: 'select_appointment_doc.php', type: 'POST', dataType: 'json', data: { appointment_book_date: appointment_book_date }, success(data) { var docs_opt = ''; docs_opt += "<option disabled selected value='' >Select Doctor</option>"; for (var i = 0; i < data.count; i++) { docs_opt += "<option value='" + data[i]['emp_id'] + "'"; if (data[i]['emp_id'] == doc) { docs_opt += ' selected ' } docs_opt += " >" + data[i]['patient_name'] + "</option>"; } $('#doctor_name').html(docs_opt); }, error: function(data) { alert('Error in Getting slot'); return; } }); } } function getSlots(doc, slot) { var appointment_book_date = $('#appointment_book_date').val(); $.ajax({ url: 'select_appointment_slots.php', type: 'POST', dataType: 'json', data: { appointment_book_date: appointment_book_date, doc: doc, }, success(data) { var docs_opt = ''; docs_opt += "<option disabled selected value='' >Select Slot</option>"; for (var i = 0; i < data.count; i++) { docs_opt += "<option value='" + data[i]['slot_id'] + "' "; if (data[i]['slot_available'] <= 0) { docs_opt += " disabled "; } if (data[i]['slot_id'] == slot) { docs_opt += " selected "; } docs_opt += " >" + data[i]['slot'] + "</option>"; } $('#doctor_slot').html(docs_opt); }, error: function(data) { alert('Error in Getting Appointment slot'); return; } }); } function open_employee_appointment(app_id) { $.ajax({ url: 'select_appointment.php', type: 'POST', dataType: 'json', data: { app_id: app_id, }, success(data) { $('#appointment_book_id').val(data.id); $('#patient_name_cc').val(data.emp_id); $('#appointment_booking_type').val(data.app_type); $('#appointment_book_date').val(data.date); if (data.app_type == 'MED') { getMedicalSlot(data.time); } else { getDocs(data.date, data.doctor_id); getSlots(data.doctor_id, data.time); } }, error: function(data) { alert('Error in Getting slot'); return; } }); } function delete_employee_appointment(app_id) { if (confirm("Are you sure to cancel appointment ?") == true) { open_mail(app_id, 'del'); } } window.onload = getShowingData(); document.getElementById("appointment_book_date").min = "<?php $Timestamp = strtotime(date('Y-m-d')); $TotalTimeStamp = strtotime('+ 2 days', $Timestamp); echo date('Y-m-d', $TotalTimeStamp) ?>"; function open_medical_pdf(page, medical_exam_id) { $("#medical_exam_id").val(medical_exam_id); $("#flex_medical_form_pdf").attr('method', 'POST'); $("#flex_medical_form_pdf").attr('action', page); $("#flex_medical_form_pdf").submit(); } function open_pdf_fitness(page, fitness_id) { $("#flex_sickness_id").val(fitness_id); $("#flex_fitness_form_pdf").attr('method', 'POST'); $("#flex_fitness_form_pdf").attr('action', page); $("#flex_fitness_form_pdf").submit(); } function open_form_pdf(page, medical_exam_id) { $("#medical_examform_id").val(medical_exam_id); $("#flex_form_pdf").attr('method', 'POST'); $("#flex_form_pdf").attr('action', page); $("#flex_form_pdf").submit(); } function open_appointment_pdf(page, appointtment_id) { $("#appointment_idpdf").val(appointtment_id); $("#flex_opd_injury_pdf").attr('method', 'POST'); $("#flex_opd_injury_pdf").attr('action', page); $("#flex_opd_injury_pdf").submit(); } function is_medical(type) { $('#appointment_book_date').val(''); var content = "<option value=''>Select Slot</option>"; var content1 = "<option value=''>Select Doctor</option>"; $('#doctor_slot').html(content); $('#doctor_name').html(content1); if (type == 'MED') { $('#doc_div').hide(); } else { $('#doc_div').show(); } } function getMedicalSlot(slot) { var appointment_book_date = $('#appointment_book_date').val(); $.ajax({ url: 'select_medical_appointment_slots.php', type: 'POST', dataType: 'json', data: { appointment_book_date: appointment_book_date, }, success(data) { var docs_opt = ''; docs_opt += "<option disabled selected value='' >Select Slot</option>"; for (var i = 0; i < data.count; i++) { docs_opt += "<option value='" + data[i]['slot_id'] + "' "; if (data[i]['status'] == 'BOOKED') { docs_opt += " disabled "; } if (data[i]['slot_id'] == slot) { docs_opt += " selected "; } docs_opt += " >" + data[i]['slot'] + " to " + data[i]['slot_end'] + "</option>"; } $('#doctor_slot').html(docs_opt); }, error: function(data) { alert('Error in Getting Appointment slot'); return; } }); } function getSlotCount() { var appointment_book_date = $('#appointment_book_date').val(); var slot = $('#doctor_slot').val(); var contant = "<h6 style='color:red'>No Available Slots</h6>";; if (appointment_book_date == '' || appointment_book_date == null) { contant = "<h6 style='color:red'>Please Select Date</h6>"; } else if (slot == '' || slot == null) { contant = "<h6 style='color:red'>Please Select Slot</h6>"; } else if (slot != '' && slot != null && appointment_book_date != '' && appointment_book_date != null) { $.ajax({ url: 'get_availabe_slots.php', type: 'POST', dataType: 'json', data: { appointment_book_date: appointment_book_date, slot: slot, }, success(data) { if (data.slot_available > 0) { contant = "<h6 style='color:green'>" + data.slot_available + " slots are available </h6>"; } else { contant = "<h6 style='color:red'>No Available Slots</h6>"; } $('#available_slot').val(data.slot_available); $('#slot_count').html(contant); return; }, error: function(data) { alert('Error in Getting Appointment slot'); return; } }); } $('#available_slot').val(0); $('#slot_count').html(contant); } function alreadyHaveAppointment(){ var id=$('#patient_name_cc').val(); var app_type = $('#appointment_booking_type').val(); var have_app=false; $.ajax({ url: 'select_previous_appointment.php', type: 'POST', async:false, dataType: 'json', data: { id: id, app_type:app_type, }, success(data) { if(data.count>0){ have_app=true; } }, error: function(data) { alert('Error in Getting Appointment slot'); return; } }); return have_app; } function send_mail_to_ohc( appointmentId,ohc,mail,date,name,app_type,link,type){ var emailContent = "<p>Dear Sir/Madam, </p>"; var email_list_to = mail; var email_list_cc=''; ref_type = app_type + " Appointment"; if (type != 'del') { var subject = 'Appointment for ' + app_type + ' in ' + ohc + ' OHC on ' + date + '.'; emailContent += "<p>"+name +" Booked a "+ app_type +" in "+ ohc + " OHC on " +date +".</p>"; emailContent +="<p>Kindly "; emailContent += "<a href=`" + link + "`> Click here </a> "; emailContent += " for confirm their appointment.</p>"; emailContent += "<p> Regards,</p><p> Team OHC</p>"; } else { var subject = 'Cancelled their ' + app_type + ' in ' + ohc + ' OHC on ' + date + '.'; emailContent += "<p>"+name +" Cancelled thier "+ app_type +" in "+ ohc + " OHC on " +date +".</p>"; emailContent += "<p> Regards,</p><p> Team OHC</p>"; } // emailContent += "<br><a href=`" + link + // "`> Details</a> "; message = emailContent; var id = appointmentId; message = emailContent; send_email(ref_type, appointmentId, email_list_to, email_list_cc, subject, message, type); } </script> <?php include 'recommended_medical_pdf.php'; ?>