2024-10-16 19:18:52 +05:30
< script src = " https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js " ></ script >
< style >
/* #checkup_section_header {
display : none ;
} */
. button span {
font - size : 10 px ! important ;
}
. upbutton {
text - decoration : none ! important ;
font - size : 10 px ;
font - weight : 500 ;
padding : 15 px ;
align - items : right ! important ;
width : 50 px ;
background : #ebeef1;
cursor : pointer ;
border : none ;
color : black ;
border - radius : 50 px ;
box - shadow : 10 px 10 px 10 px - 1 px rgba ( 10 , 99 , 169 , 0.16 ),
- 10 px - 10 px 10 px - 1 px rgba ( 255 , 255 , 255 , 0.70 );
}
. button {
text - decoration : none ! important ;
font - size : 10 px ;
font - weight : 500 ;
padding : 15 px ;
margin : 10 px ! important ;
width : 50 px ;
background : #ebeef1;
cursor : pointer ;
border : none ;
color : black ;
border - radius : 50 px ;
box - shadow : 10 px 10 px 10 px - 1 px rgba ( 10 , 99 , 169 , 0.16 ),
- 10 px - 10 px 10 px - 1 px rgba ( 255 , 255 , 255 , 0.70 );
}
#profile_link {
cursor : pointer ;
}
. tags . tag {
white - space : normal ! important ;
font - size : 10 px ;
}
#settings {
display : block ;
text - align : center
}
#paint {
border : 1 px solid black ;
background : #fff;
margin - left : auto ;
margin - right : auto ;
display : block ;
}
#panel-title1>a,
#panel-title1>a:active {
display : block ;
font - size : 12 px ;
font - family : " Source Sans Pro " , " Helvetica Neue " , Helvetica , Arial ,
sans - serif ;
color : #337ab7;
height : 20 px ;
text - decoration : none ;
}
/* #panel-heading1 a:before {
font - family : 'Glyphicons Halflings' ;
content : " \ e114 " ;
float : right ;
transition : all 0.5 s ;
} */
#panel-heading1.active a:before {
- webkit - transform : rotate ( 180 deg );
- moz - transform : rotate ( 180 deg );
transform : rotate ( 180 deg );
}
input {
width : 100 px ;
}
table {
box - shadow : 1 px 1 px lightblue ;
transition : box - shadow 1 s ;
}
table : hover {
box - shadow : 10 px 10 px lightblue ;
}
th {
font - size : 11 px ;
font - weight : 600 ;
/* background - color : #fff;
color : #fff; */
}
/* @ media ( min - width : 768 px ){
width103 % ;
} */
input ,
input ::- webkit - input - placeholder {
font - size : 10 px ;
}
select {
padding : unset ;
}
</ style >
< script type = " text/javascript " >
try {
ace . settings . loadState ( 'main-container' )
} catch ( e ) {}
</ script >
< script >
function load_checkup_header ( checkup_type_id ) {
document . checkup_form_employee . submit ();
}
function showHeaderSection ( section_desc , section_id ) {
if ( $ ( " # " + section_desc ) . prop ( 'checked' )) {
$ ( " #pannel_ " + section_desc ) . show ();
addDataToEmptyParams ( section_id );
} else {
$ ( " #pannel_ " + section_desc ) . hide ();
removeDataInEmptyParams ( section_id );
}
// console.log(section_desc);
//alert(section_id);
}
function addDataToEmptyParams ( sectionId ) {
var sectionWiseDataInput = document . getElementById ( " section_wise_parameter_data " );
var emptyParameterDataInput = document . getElementById ( " empty_parameter_data " );
var sectionWiseData = JSON . parse ( sectionWiseDataInput . value );
var emptyParameterData = JSON . parse ( emptyParameterDataInput . value );
if ( sectionId in sectionWiseData ) {
var sectionValues = sectionWiseData [ sectionId ];
sectionValues . forEach ( function ( param ) {
var key = param [ 0 ];
var value = param [ 1 ];
if ( ! ( key in emptyParameterData )) {
emptyParameterData [ key ] = value ;
}
});
emptyParameterDataInput . value = JSON . stringify ( emptyParameterData );
}
}
function removeDataInEmptyParams ( sectionId ) {
var sectionWiseDataInput = document . getElementById ( " section_wise_parameter_data " );
var emptyParameterDataInput = document . getElementById ( " empty_parameter_data " );
var sectionWiseData = JSON . parse ( sectionWiseDataInput . value );
var emptyParameterData = JSON . parse ( emptyParameterDataInput . value );
if ( sectionId in sectionWiseData ) {
var sectionValues = sectionWiseData [ sectionId ];
sectionValues . forEach ( function ( param ) {
var key = param [ 0 ];
if ( key in emptyParameterData ) {
delete emptyParameterData [ key ];
}
});
emptyParameterDataInput . value = JSON . stringify ( emptyParameterData );
}
}
function removeParameter ( parameter ) {
try {
var emptyParameterData = JSON . parse ( document . getElementById ( " empty_parameter_data " ) . value );
var sectionWiseParameterData = JSON . parse ( document . getElementById ( " section_wise_parameter_data " ) . value );
delete emptyParameterData [ parameter ];
for ( var section in sectionWiseParameterData ) {
sectionWiseParameterData [ section ] = sectionWiseParameterData [ section ] . filter ( function ( item ) {
return item [ 0 ] !== parameter ;
});
}
document . getElementById ( " empty_parameter_data " ) . value = JSON . stringify ( emptyParameterData );
document . getElementById ( " section_wise_parameter_data " ) . value = JSON . stringify ( sectionWiseParameterData );
} catch ( e ){
console . log ( e );
}
}
function add_multi_value ( ids ) {
val_arr = new Array ();
let idv = ids . id ;
let idh = " multi " + idv ;
let va = document . getElementById ( idh );
val_arr = va . value . split ( " , " );
$ ( " # " + ids . id ) . val ( val_arr );
$ ( " # " + ids . id ) . trigger ( " chosen:updated " );
}
</ script >
< script src = " assets/js/select2.min.js " ></ script >
< form name = " checkup_form_employee " id = " checkup_form_employee " method = " POST " action = " checkup_from_before.php " >
< ? php
$emptyParameterData = [];
$sectionWiseParameterData = [];
?>
< input type = " hidden " id = " checkup_section_ids " name = " checkup_section_ids[] " >
< input type = " hidden " name = " height_weight_bmi " id = " height_weight_bmi " >
< div class = " mainPanel " >
< div class = " panel-group " id = " accordion " >
< div class = " panel panel-default " >
< div class = " panel-heading " id = " panel-heading1 " >
< h5 class = " widget-title " style = " display: block; font-size: 15px; color: #337ab7; height: 10px; text-decoration: none; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; " >
Patient - < ? = $patient_name ?> <i style="margin-left:10px; " class="fa fa-user" target="_blank" id="profile_link" onclick="open_dashboard(<?= $row['id'] ?>)"></i>
< a target = " _blank " href = " edit_employee_details.php?active=docsTab&emp_id=<?= $row['id'] ?> " >< i style = " font-size: 17px; " class = " glyphicon glyphicon-file " ></ i ></ a >
& nbsp ; < a target = " _blank " href = " edit_employee_details.php?active=medicalExaminationHistroyTab&emp_id=<?= $row['id'] ?> " >< i style = " font-size: 17px; " class = " ace-icon fa fa-stethoscope " ></ i ></ a >
</ h5 >
< div style = 'float:right; margin-top:-25px;' >
< ? php if ( isset ( $_REQUEST [ 'is_new_entry' ]) && ! empty ( $_REQUEST [ 'is_new_entry' ])) { ?>
< a class = " button " style = " visibility:visible; " id = " forwardButton " tabindex = " 0 " aria - controls = " dynamic-table " title = " Save " style = " width: 80px; " >
< span >< i class = " ace-icon fa fa-save " ></ i >& nbsp ; SAVE
</ span >
</ a >
< ? php } else { ?>
< a class = " button " style = " visibility:hidden; " id = " forwardButton " tabindex = " 0 " aria - controls = " dynamic-table " title = " Save " style = " width: 80px; " >
< span >< i class = " ace-icon fa fa-save " ></ i >& nbsp ; SAVE
</ span >
</ a >
< ? php } ?>
< ? php if ( isset ( $_REQUEST [ 'returnPage' ])) { ?>
< a href = " <?= $_REQUEST['returnPage'] ?> " class = " button " >< i class = " fa fa-arrow-left " ></ i >& nbsp ; Back </ a >
< ? php } ?>
< ? php
$checkupTypeId = getFieldFromTable ( 'checkup_type_id' , 'checkup_form' , 'checkup_id' , $_REQUEST [ 'flex_checkup_id' ]);
$isLabCheckup = getFieldFromTable ( 'type_state' , 'checkup_type' , 'checkup_type_id' , $checkupTypeId );
?>
< ? php if ( $_SESSION [ 'RoleCode' ] != $__ROLE_DOCTOR && $_SESSION [ 'RoleCode' ] != $__ROLE_LAB ) { ?>
< a class = " button " id = " generateButton " tabindex = " 0 " aria - controls = " dynamic-table " onclick = " rule_gen(<?= $checkupTypeId ?>); " title = " Generate Abnormality " >
< span >< i class = " ace-icon fa fa-print " ></ i >& nbsp ;
Add Abnormality
</ span >
</ a >
< ? php } else if ( $_SESSION [ 'RoleCode' ] == $__ROLE_LAB ) {
?>
< a class = " button " id = " generateButton " tabindex = " 0 " aria - controls = " dynamic-table " onclick = " rule_gen(<?= $checkupTypeId ?>); " title = " Generate Abnormality " >
< span >< i class = " ace-icon fa fa-print " ></ i >& nbsp ;
Add Calculation
</ span >
</ a >
< ? php
} else if ( $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR || $_SESSION [ 'RoleCode' ] == $__ROLE_LAB ) { ?>
< script >
document . getElementById ( " forwardButton " ) . style . visibility = " visible " ;
</ script >
< ? php } ?>
< input type = " hidden " name = " attendedStatus " id = " attendedStatus " />
< input type = " hidden " name = " approve_date " id = " approve_date " value = '' />
< input type = " hidden " name = " rule_param_id_onc " id = " rule_param_id_onc " />
</ div >
</ div >
< div class = " panel-body " >
< div class = " row " >
< ? php
$emp_id = $_REQUEST [ 'flex_opd_id' ] != '' ? $_REQUEST [ 'flex_opd_id' ] : $_REQUEST [ 'emp_id_history' ];
$sql_employee = " select * from patient_master where id=' $emp_id ' " ;
$result = mysqli_query ( $conn , $sql_employee );
$checkup_id = $_REQUEST [ 'flex_checkup_id' ];
$sql_checkup = " select * from checkup_form where checkup_id=' $checkup_id ' " ;
$checkup_result = mysqli_query ( $conn , $sql_checkup );
$row_checkup = mysqli_fetch_assoc ( $checkup_result );
$tbl_count = 0 ;
$tbl_names = array ();
$checkup_type_id = $row_checkup [ 'checkup_type_id' ];
$sql21 = " select * from checkup_type where checkup_type_id=' $checkup_type_id ' " ;
error_log ( " sql type " . $sql21 );
$checktype21 = mysqli_query ( $conn , $sql21 );
$row21 = mysqli_fetch_assoc ( $checktype21 );
$checkup_section_ids = $row21 [ 'checkup_form_section_ids' ];
error_log ( " checkup_section_ids " . $checkup_section_ids );
while ( $row_employee = mysqli_fetch_assoc ( $result )) {
error_log ( " checkup_type_id " . $checkup_type_id );
?>
< input type = " hidden " id = " checkup_emp_id " name = " checkup_emp_id " value = " <?php echo ( $_REQUEST['flex_opd_id'] != '' && $_REQUEST['flex_opd_id'] != null) ? $_POST['flex_opd_id'] : $_REQUEST['emp_id_history'] ; ?> " >
< input type = " hidden " name = " checkup_type_id " id = " checkup_type_id " value = " <?php echo $checkup_type_id = $row_checkup['checkup_type_id'] ; ?> " >
< input type = " hidden " name = " checkup_form_type_code " id = " checkup_form_type_code " value = " <?= trim( $row21['checkup_type_code'] ); ?> " >
< input type = " hidden " style = " height: 30px; " class = " col-xs-4 " id = " hiddenHighlighter " name = " hiddenHighlighter " >
< input type = " hidden " id = " health_index " name = " health_index " value = " <?php echo $row_checkup['health_index'] ?> " >
< div class = " table-responsive " >
< table class = " table table-bordered " >
< thead >
< tr >
< th > Ticket No </ th >
< th > Patient ID </ th >
< th > Employee Code </ th >
< th > Employee Name </ th >
< th > Date Of Birth </ th >
< th > Employee Designation </ th >
< th > Employee Department </ th >
</ tr >
</ thead >
< tbody >
< tr >
< td >
< ? php
$ticket_no = $row_checkup [ 'ticket_no' ];
echo $ticket_no ;
?>
< input id = " ticket_no " type = " hidden " style = " height: 30px " class = " form-control " name = " ticket_no " value = " <?php echo $row_checkup['ticket_no'] ; ?> " />
< input type = " hidden " name = " pat_age " id = " pat_age " value = " <?= $row_employee['dob'] ?> " />
< input type = " hidden " name = " pat_gender " id = " pat_gender " value = " <?= $row_employee['gender'] ?> " />
</ td >
< td > < ? php echo ( $row_employee [ 'id' ]) ?> </td>
< td > < ? = $row_employee [ 'emp_code' ] ?> </td>
< td > < ? php echo ( $row_employee [ 'patient_name' ]) ?> </td>
< td > < ? php if ( $row_employee [ 'dob' ] != '' && $row_employee [ 'dob' ] != null && $row_employee [ 'dob' ] != 0000 - 00 - 00 && $row_employee [ 'dob' ] != '1970-01-01' ) {
echo date_format ( date_create ( getDateInDbFormat ( $row_employee [ 'dob' ])), " d-m-Y " );
} else {
echo " Not Present " ;
} ?> </td>
< td >< ? php echo $employee_designation = getTableFieldValue ( 'designation' , 'designation_name' , 'designation_id' , $row_employee [ 'designation_id' ]); ?>
</ td >
< td >< ? php echo getTableFieldValue ( 'department' , 'dept_name' , 'dept_id' , $row_employee [ 'dept_id' ]); ?>
</ td >
</ tr >
</ tbody >
</ table >
< form id = " emp_id_form " name = " emp_id_form " target = " _blank " action = " # " method = " POST " >
< input type = " hidden " name = " emp_id " id = " emp_id " value = " <?= $row_employee['id'] ?> " />
</ form >
</ div >
</ div >
< div class = " row " >
< div class = " col-sm-3 " >
< div class = " form-group " >
< label > Checkup Date </ label >
< input type = " hidden " name = " checkup_id " id = " checkup_id " value = " <?php echo $checkup_id ; ?> " >
< input type = " hidden " name = " isHiperTensed " id = " isHiperTensed " >
< input type = " hidden " name = " is_test_completed " id = " is_test_completed " value = " Y " >
< div class = " input-group " >
< input id = " checkdown_date " name = " checkdown_date " type = " text " class = " form-control date-timepicker " style = " height: 30px " /> < span class = " input-group-addon " > < i style = " height: 5px " class = " glyphicon glyphicon-calendar " ></ i >
</ span >
</ div >
</ div >
</ div >
< div class = " col-sm-3 " >
< div class = " form-group " >
< label > Valid Upto </ label >
< div class = " input-group " >
< ? php
$valid_duration = getFieldFromTable ( 'valid_upto' , 'checkup_type' , 'checkup_type_id' , $row_checkup [ 'checkup_type_id' ]);
$duration = " + " . $valid_duration . " month " ;
error_log ( " duration " . $duration );
if ( $row_checkup [ 'checkup_date' ] != null || $row_checkup [ 'checkup_date' ] != '0000-00-00 00:00:00' ) {
$date = new DateTime ( $row_checkup [ 'checkup_date' ]);
} else {
$date = new DateTime ( 'now' );
}
$date -> modify ( $duration );
$date_new = $date -> format ( 'Y-m-d' );
error_log ( " due date " . $date_new );
error_log ( " row checkup date " . $row_checkup [ 'valid_upto' ]);
if ( $row_checkup [ 'valid_upto' ] != null && $row_checkup [ 'valid_upto' ] != '0000-00-00' && $row_checkup [ 'valid_upto' ] != '' ) {
$valid_duration_date = $row_checkup [ 'valid_upto' ];
} else {
$valid_duration_date = $date_new ;
}
error_log ( " after date " . $valid_duration_date );
?>
< input id = " valid_upto_date " name = " valid_upto_date " class = " form-control date-picker " style = " height: 30px " value = " <?php echo date_format(date_create( $valid_duration_date ), " d / m / Y " ) ?> " type = " text " data - date - format = " dd/mm/yyyy " /> < span class = " input-group-addon " > < i style = " height: 5px " class = " glyphicon glyphicon-calendar " ></ i >
</ span >
</ div >
</ div >
</ div >
< ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR ) {
?>
< div class = " col-sm-6 " >
< div class = " form-group " >
< label > Fitness Status </ label >
< select name = " fit_state " id = " fit_state " class = " form-control " >
< option value = " fit " < ? php if ( strcmp ( 'fit' , $row_checkup [ 'fit_unfit_status' ]) == 0 ) {
echo " selected " ;
} ?> >Fit</option>
< option value = " pfit " < ? php if ( strcmp ( 'pfit' , $row_checkup [ 'fit_unfit_status' ]) == 0 ) {
echo " selected " ;
} ?> >Provisionally Fit</option>
< option value = " tfit " < ? php if ( strcmp ( 'tfit' , $row_checkup [ 'fit_unfit_status' ]) == 0 ) {
echo " selected " ;
} ?> >Temporarily Unfit</option>
< option value = " ufit " < ? php if ( strcmp ( 'ufit' , $row_checkup [ 'fit_unfit_status' ]) == 0 ) {
echo " selected " ;
} ?> >Unfit</option>
</ select >
</ div >
</ div >
< ? php
}
?>
</ div >
< div class = " row " >
< ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_RECEPTIONIST ) { ?>
< div class = " col-sm-4 " >
< div style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< tr >
< th > Remarks </ th >
</ tr >
< tr >
< td >< textarea class = " form-control " rows = " 2 " name = " remarks " id = " remarks " >< ? php echo $row_employee [ 'remarks' ]; ?> </textarea></td>
</ tr >
</ table >
</ div >
</ div >
</ div >
< ? php } ?>
< ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_LAB ) { ?>
< div class = " col-sm-12 " >
< div style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< tr >
< th > Remarks </ th >
< th > Checkup Date </ th >
< th > Referred By </ th >
</ tr >
< tr >
< td >< textarea class = " form-control " rows = " 2 " name = " remarks " id = " remarks " >< ? php echo $row_checkup [ 'remarks' ]; ?> </textarea></td>
< input type = " hidden " name = " checkup_id " id = " checkup_id " value = " <?php echo $checkup_id ; ?> " >
< input type = " hidden " name = " isHiperTensed " id = " isHiperTensed " >
< input type = " hidden " name = " is_test_completed " id = " is_test_completed " value = " Y " >
< td >
< div class = " input-group " >
< input id = " checkdown_date " name = " checkdown_date " type = " text " class = " form-control date-timepicker " style = " height: 30px " /> < span class = " input-group-addon " > < i style = " height: 5px " class = " glyphicon glyphicon-calendar " ></ i >
</ span >
</ div >
</ td >
< ? php $ref_field_visible = getFieldFromTable ( 'type_state' , 'checkup_type' , 'checkup_type_id' , $checkup_type_id );
if ( ! strcmp ( $ref_field_visible , " Yes " )) {
?>
< td >< select name = " ref_by_doc " id = " ref_by_doc " class = " form-control chosen-select " >
< option value = " " > Select Doc Name </ option >
< ? = generate_options ( " SELECT doctor_id,trim(concat(ifnull(doctor_name,''),' ',ifnull(doctor_desc,''))) doc_name FROM doctors_master " , $row_checkup [ 'referred_by' ], 'doctor_id' , 'doc_name' , '' , '' ); ?>
</ select ></ td >
< ? php } ?>
</ tr >
</ table >
</ div >
</ div >
</ div >
< ? php } ?>
< ? php
if ( $_SESSION [ 'RoleCode' ] == $__ROLE_MEDICALROOM || $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR ) {
$risk = '' ;
$advice = '' ;
// $emp_id = $_REQUEST['flex_opd_id'] != '' ? $_REQUEST['flex_opd_id'] : $_REQUEST['emp_id_history'];
// $sql_employee = "select * from patient_master where id='$emp_id'";
// $result = mysqli_query($conn,$sql_employee);
$checkup_id = $_REQUEST [ 'flex_checkup_id' ];
$sql_checkup = " select * from checkup_form where checkup_id=' $checkup_id ' " ;
error_log ( " sql_checkup " . $sql_checkup );
$checkup_result = mysqli_query ( $conn , $sql_checkup );
$row_checkup = mysqli_fetch_assoc ( $checkup_result );
$tbl_count = 0 ;
?>
</ div >
< div class = " row " >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th > Health Risk </ th >
</ tr >
< tr >
< td style = " font-size: 10px; " >
< div id = " SpinnerContainerRisk " >
< img src = " images/load.gif " id = " SpinnerImage " title = " loading... " class = " loader " />
</ div >
< div class = " input-group " >
< input type = " text " class = " form-control " id = " health_risk_name " name = " health_risk_name " placeholder = " Health Risks " />
</ div >
</ td >
</ tr >
</ table >
</ div >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th > Health Advice </ th >
</ tr >
< tr >
< td style = " font-size:10px; " >
< div id = " SpinnerContainerAdvice " >
< img src = " images/load.gif " id = " SpinnerImage " title = " loading... " class = " loader " />
</ div >
< div class = " input-group " >
< input type = " text " class = " form-control " id = " health_advice_name " name = " health_advice_name " placeholder = " Health Advices " />
</ div >
</ td >
</ tr >
</ table >
</ div >
</ div >
< div class = " row " >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th >
Past Present Illness
</ th >
</ tr >
< tr >
< td style = " font-size: 10px; " >
< div id = " SpinnerContainerIll " >
< img src = " images/load.gif " id = " SpinnerImage " title = " loading... " class = " loader " />
</ div >
< div class = " input-group " >
< input type = " text " class = " form-control " id = " past_present_illness_data " name = " past_present_illness_data " placeholder = " Select Past present Illness " />
</ div >
</ td >
</ tr >
</ table >
</ div >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th >
Chronic Illnesses
</ th >
</ tr >
< tr >
< td style = " font-size: 10px; " >
< div id = " SpinnerContainerAbnormality " >
< img src = " images/load.gif " id = " SpinnerImage " title = " loading... " class = " loader " />
</ div >
< div class = " input-group " >
< input type = " text " class = " form-control " id = " abnormalities_data " name = " abnormalities_data " placeholder = " Select Chronic Illnesses " />
</ div >
</ td >
</ tr >
</ table >
</ div >
</ div >
< div class = " row " >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th >
Habits
</ th >
</ tr >
< tr >
< td style = " font-size: 10px; " >
< div id = " SpinnerContainerHabit " >
< img src = " images/load.gif " id = " SpinnerImage " title = " loading... " class = " loader " />
</ div >
< div class = " input-group " >
< input type = " text " class = " form-control " id = " habits_data " name = " habits_data " placeholder = " Select Habits " />
</ div >
</ td >
</ tr >
</ table >
</ div >
</ div >
< div class = " row " >
< div class = " col-sm-6 " >
< div class = " form-group " >
< label >
Nominate Patient For Wellness Program </ label >
< select class = " chosen-select form-control " id = " program_id " name = " program_id " data - placeholder = " Select Program Name " >
< option value = " " ></ option >
< ? php $query = " select * from training_schedule " ;
$result = @ mysqli_query ( $conn , $query );
while ( $rows_schedule = mysqli_fetch_assoc ( $result )) {
$training_name = getTableFieldValue ( 'training_master' , 'training_name' , 'training_master_id' , $rows_schedule [ 'training_id' ]);
if ( $row_checkup [ 'program_id' ] == $rows_schedule [ 'schedule_id' ]) {
?>
< option selected value = " <?php echo $rows_schedule['schedule_id'] ?> " >
< ? php echo $training_name . '(' . $rows_schedule [ 'trainer_name' ] . ',' . date_format ( date_create ( $rows_schedule [ 'from_date' ]), " d-M-Y " ) . ' ' . date_format ( date_create ( $rows_schedule [ 'to_date' ]), " d-M-Y " ) . ')' ?>
</ option >
< ? php
} else {
?> <option value="<?php echo $rows_schedule['schedule_id'] ?>">
< ? php echo $training_name . '(' . $rows_schedule [ 'trainer_name' ] . ',' . date_format ( date_create ( $rows_schedule [ 'from_date' ]), " d-M-Y " ) . ' ' . date_format ( date_create ( $rows_schedule [ 'to_date' ]), " d-M-Y " ) . ')' ?>
</ option >
< ? php
}
}
?>
</ select >
</ div >
</ div >
< div class = " col-sm-6 " >
< div class = " form-group " style = " display: flex; justify-content: space-between; align-content: space-around; " >
< label for = " program_status " > Program Status </ label >
< input type = " radio " name = " program_status " id = " program_status_complete " value = " Y " < ? php echo ( $row_checkup [ 'program_status' ] == 'Y' ) ? " checked " : " " ; ?> >
< label for = " program_status_complete " > Complete </ label >
< input type = " radio " name = " program_status " id = " program_status_incomplete " value = " N " < ? php echo ( $row_checkup [ 'program_status' ] == 'N' ) ? " checked " : " " ; ?> >
< label for = " program_status_incomplete " > Incomplete </ label >
</ div >
</ div >
</ div >
< div class = " row " >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th > Critical Findings </ th >
</ tr >
< tr >
< td >
< textarea < ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR )
echo 'readonly' ; ?> class="form-control" rows="2" name="findings" id="findings" style="width: 100%;" value=''><?php echo $row_checkup['findings']; ?></textarea>
</ td >
</ tr >
</ table >
</ div >
< div class = " col-sm-6 " >
< table class = " table table-bordered " >
< tr >
< th > Lab Technician Comments </ th >
</ tr >
< tr >
< td >
< textarea < ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR )
echo 'readonly' ; ?> class="form-control" rows="2" name="comments" id="comments" style="width:100%;" value=""><?php echo $row_checkup['comments']; ?></textarea>
</ td >
</ tr >
</ table >
</ div >
</ div >
</ div >
< ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR ) {
?>
< div class = " row " >
< div class = " col-sm-6 " >
< div style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< tr >
< th > Doctor Critical Findings </ th >
</ tr >
< tr >
< td >
< textarea class = " form-control " rows = " 2 " name = " doc_findings " id = " doc_findings " style = " width: 100%; " value = '' >< ? php echo $row_checkup [ 'doc_findings' ]; ?> </textarea>
</ td >
</ tr >
</ table >
</ div >
</ div >
< div class = " col-sm-6 " >
< div style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< tr >
< th > Doctor Comments </ th >
</ tr >
< tr >
< td >
< textarea class = " form-control " rows = " 2 " name = " doc_comments " id = " doc_comments " style = " width:100%; " value = " " >< ? php echo $row_checkup [ 'doc_comments' ]; ?> </textarea>
</ td >
</ tr >
</ table >
</ div >
</ div >
</ div >
< ? php } ?>
< ? php } ?>
< ? php } ?>
</ div >
< div class = " row " id = " checkup_section_header " >
< div class = " col-sm-12 " >
< div style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< tr >
< th colspan = " 4 " > Checkup Section Header </ th >
</ tr >
< tr >
< ? php
//yogi changes
$sql_section = " select * from checkup_form_section where Status='Active' and section_id in ( $checkup_section_ids ) order by display_order asc " ;
error_log ( " sql_section " . $sql_section );
// echo $sql_section;
$count = 1 ;
$i = 0 ;
$checkup_section_header = [];
$checkup_section_headers = $row_checkup [ 'checkup_section_ids' ];
$check_section_ids = array ();
$check_section_headers = array ();
$result_section = mysqli_query ( $conn , $sql_section );
while ( $row_section = mysqli_fetch_assoc ( $result_section )) {
array_push ( $check_section_ids , $row_section [ 'section_id' ]);
array_push ( $check_section_headers , $row_section [ 'section_desc' ]);
if ( $count == 4 ) {
?>
< tr >< ? php
}
array_push ( $checkup_section_header , intval ( $checkup_section_headers [ $i ]));
?>
< td >
< div id = " section_header_div " >
< input type = " checkbox " id = " <?php echo $row_section['section_desc'] ; ?> " name = " <?php echo $row_section['section_id'] ; ?> " value = " <?php echo $row_section['section_id'] ; ?> " onclick = " showHeaderSection('<?php echo $row_section['section_desc'] ; ?>','<?php echo $row_section['section_id'] ?>') " >
< ? php
echo $row_section [ 'section_name' ];
?>
</ td >
</ div >
< ? php
if ( $count % 3 == 0 ) {
?> </tr><?php
}
$count ++ ;
$i = $i + 2 ;
}
?>
</ table >
</ div >
</ div >
</ div >
<!-- < div class = " panel-footer " >
< button type = " submit " onclick = " validation_checkup_form(); " class = " button " >
< i class = " ace-icon fa fa-save " ></ i > Save
</ button >
</ div > -->
</ div >
< ? php
// $sql_checkup_parameter_range = "select * from checkup_parameter where enabled ='Y' and checkup_form_section_id in ($checkup_section_ids) ";
// $result_checkup_parameter_range = mysqli_query($conn, $sql_checkup_parameter_range);
// $i = 0;
// $parameter_names = array();
// $starting_ranges = array();
// $ending_ranges = array();
// $less_risks = array();
// $more_risks = array();
// $less_advices = array();
// $more_advices = array();
// $column_names = array();
// while ($row_checkup_parameter_range = mysqli_fetch_assoc($result_checkup_parameter_range)) {
// $parameter_names[$i] = $row_checkup_parameter_range['parameter_name'];
// $column_names[$i] = $row_checkup_parameter_range['column_name'];
// $starting_ranges[$i] = $row_checkup_parameter_range['starting_range'];
// $ending_ranges[$i] = $row_checkup_parameter_range['ending_range'];
// $less_advices[$i] = $row_checkup_parameter_range['less_advices'];
// $more_advices[$i] = $row_checkup_parameter_range['more_advices'];
// $less_risks[$i] = $row_checkup_parameter_range['less_risks'];
// $more_risks[$i] = $row_checkup_parameter_range['more_risks'];
// $i = $i + 1;
// }
?>
< ? php
//$checkup_type_id = $_REQUEST['checkup_type_id_db'] != '' ? $_REQUEST['checkup_type_id_db'] : $_REQUEST['checkup_type_id'];
// $sql_checkup_parameter_section = "select * from checkup_form_section order by section_id asc";
//yogi changes
$sql_checkup_parameter_section = " select * from checkup_form_section where Status='Active' and section_id in ( $checkup_section_ids ) order by display_order asc " ;
// echo $sql_checkup_parameter_section;
?>
< ? php
// echo $sql_checkup_parameter_section;
$i1 = 0 ;
$result_checkup_parameter_section = mysqli_query ( $conn , $sql_checkup_parameter_section );
while ( $row_checkup_parameter_section = mysqli_fetch_assoc ( $result_checkup_parameter_section )) {
// if ($_SESSION['RoleId'] != 6) {
?>
< div class = " panel panel-default " id = " pannel_<?php echo $row_checkup_parameter_section['section_desc'] ?> " style = " display: none; " >
< div class = " panel-heading " id = " panel-heading1 " >
< h5 class = " panel-title " id = " panel-title1 " >
< a role = " button " data - toggle = " collapse " href = " #collapseOne<?php echo $i1 ; ?> " aria - expanded = " true " aria - controls = " collapseOne " style = " font-size: 15px; " >
< ? php echo $row_checkup_parameter_section [ 'section_name' ] ?>
</ a >
</ h5 >
< div style = " float: right; margin-top:-20px; " >
< a class = " upbutton " id = " uploadButton " tabindex = " 0 " onclick = " upload_section_doc('<?php echo $row_checkup_parameter_section['section_id'] ?>','<?php echo $row_checkup_parameter_section['section_name'] ?>') " aria - controls = " dynamic-table " data - original - title = " Upload Doc " title = " Upload " align = 'right' style = " width: 80px; " >< span style = " font-size:10px; " >< i class = " ace-icon fa fa-upload " ></ i >& nbsp ; </ span ></ a >
</ div >
</ div >
< div id = " collapseOne<?php echo $i1 ; ?> " class = " panel-collapse collapse in " >
< div class = " panel-heading " id = " panel-heading1 " >
< h5 class = " panel-title center " id = " panel-title1 " >
< a role = " button " data - toggle = " collapse " href = " #supportDoc<?php echo $row_checkup_parameter_section['section_id'] ; ?> " aria - expanded = " true " title = " click here to see uploaded documents " aria - controls = " supportDoc " >
Supporting Documents </ a >
</ h5 >
</ div >
< div id = " supportDoc<?php echo $row_checkup_parameter_section['section_id'] ; ?> " class = " panel-collapse collapse in center " >
< table class = " table table-bordered center " id = " medical_doc_id " style = " width: 100% " >
< thead >
< tr >
< th class = " center " style = " width: 50%; " > Document Name </ th >
< th class = " center " style = " width: 50%; " > Download </ th >
<!-- < ? php
$hasExecuteAccess = isAccessible ( $_SESSION [ 'RoleId' ], $menu_key , 'E' ); ?>
< ? php if ( $hasExecuteAccess ) { ?>
< th > Delete </ th >
< ? php } ?> -->
< th > Delete </ th >
</ tr >
</ thead >
< tbody >
< ? php
// echo $checkup_section_id;
$emp_id = $_REQUEST [ 'patient_id' ] != '' ? $_REQUEST [ 'patient_id' ] : $_REQUEST [ 'emp_id_history' ];
$sql_medical_doc = " select * from checkup_section_medical_document where emp_id=' " . $emp_id . " ' and section_id=' " . $row_checkup_parameter_section [ 'section_id' ] . " ' and checkup_id=' " . $_REQUEST [ " flex_checkup_id " ] . " ' " ;
$checkup_id = $_REQUEST [ 'flex_checkup_id' ];
error_log ( " idddd " . $sql_medical_doc );
//echo $sql_medical_doc;
$result_medical_doc = @ mysqli_query ( $conn , $sql_medical_doc );
while ( $row_medical_doc = @ mysqli_fetch_array ( $result_medical_doc )) { ?>
< tr id = " medical_doc_<?php echo $row_medical_doc['id'] ?> " >
< td >< ? php if ( isset ( $row_medical_doc [ 'medical_doc_desc' ]) && $row_medical_doc [ 'medical_doc_desc' ] != '' ) {
echo $row_medical_doc [ 'medical_doc_desc' ];
} else {
echo $row_medical_doc [ 'medical_doc_name' ];
} ?> </td>
< td >
< a href = " data:<?= $row_medical_doc['medical_doc_type'] ?>;base64,<?= base64_encode( $row_medical_doc['medical_doc'] ) ?> " download = '<?= $row_medical_doc[' medical_doc_name '] ?>' >< img src = '<?php if ($row_medical_doc[' medical_doc_type '] == ' application / pdf ') { ?>images/pdf.png<?php } else { ?>images/image_icon.png<?php } ?>' width = '35' height = '35' ></ a >
</ td >
<!-- < ? php $hasReadAccess = isAccessible ( $_SESSION [ 'RoleId' ], $menu_key , 'R' );
$hasWriteAccess = isAccessible ( $_SESSION [ 'RoleId' ], $menu_key , 'W' );
$hasExecuteAccess = isAccessible ( $_SESSION [ 'RoleId' ], $menu_key , 'E' ); ?>
< ? php if ( $hasExecuteAccess ) { ?>
< td align = " center " style = " width: 20% " >
< a href = " # " class = " btn-lg " data - toggle = " tooltip " id = " deletebtn " onclick = " delete_checkup_section_document('<?php echo $row_medical_doc['id'] ?>') " title = " Delete " >< span class = " glyphicon glyphicon-trash " ></ span ></ a >
</ td >
< ? php } ?> -->
< td align = " center " style = " width: 20% " >
< a href = " # " class = " btn-lg " data - toggle = " tooltip " id = " deletebtn " onclick = " delete_checkup_section_document('<?php echo $row_medical_doc['id'] ?>') " title = " Delete " >< span class = " glyphicon glyphicon-trash " ></ span ></ a >
</ td >
</ tr >
< ? php $count ++ ;
}
?>
</ tbody >
</ table >
<!-- </ div > -->
</ div >
< div class = " panel-body " >
< ? php
//Manoj Enabling health surveylance - for edit.. enabling everythying for now.
//$sql_group_by = "SELECT count(*) as total FROM checkup_parameter WHERE checkup_form_section_id = '" . $row_checkup_parameter_section['section_id'] . "' and enabled='Y' group by group_id order by column_order asc";
$sql_group_by = " SELECT count(*) as total FROM checkup_parameter WHERE checkup_form_section_id = ' " . $row_checkup_parameter_section [ 'section_id' ] . " ' group by group_id order by column_order asc " ;
error_log ( " query " . $sql_group_by );
$result_group_by = mysqli_query ( $conn , $sql_group_by );
// $data_group_by=mysqli_fetch_assoc($result_group_by);
// $no_of_tables= $data_group_by['total'];
// echo "shu".$no_of_tables[0]['total'];
$rows_no_groups = array ();
$h = 0 ;
while ( $data_group_by = mysqli_fetch_array ( $result_group_by )) {
$rows_no_groups [ $h ] = $data_group_by [ 'total' ];
$h ++ ;
}
if ( $row_checkup != null && $row_checkup != '' ) {
$sql_checkup_parameter_col = " SELECT * FROM checkup_parameter a LEFT JOIN checkup_form_key_value b ON b.checkup_form_key = a.column_name AND b.checkup_form_id = ' " . $row_checkup [ 'checkup_id' ] . " '
WHERE a . checkup_form_section_id = '" . $row_checkup_parameter_section[' section_id '] . "' AND a . enabled = 'Y' ORDER BY a . column_order ASC " ;
} else {
$sql_checkup_parameter_col = " select * from checkup_parameter where checkup_form_section_id=' " . $row_checkup_parameter_section [ 'section_id' ] . " ' and enabled='Y' order by column_order asc " ;
}
error_log ( " query " . $sql_checkup_parameter_col );
$result_checkup_parameter_col = mysqli_query ( $conn , $sql_checkup_parameter_col );
$no_of_rows = mysqli_num_rows ( $result_checkup_parameter_col );
if ( $no_of_rows == 0 ) {
$sql_checkup_parameter_col = " select * from checkup_parameter where checkup_form_section_id=' " . $row_checkup_parameter_section [ 'section_id' ] . " ' and enabled='Y' order by column_order asc " ;
// echo $sql_checkup_parameter_col;
$result_checkup_parameter_col = mysqli_query ( $conn , $sql_checkup_parameter_col );
$no_of_rows = mysqli_num_rows ( $result_checkup_parameter_col );
// echo $no_of_rows;
}
// $no_of_rows=ceil($no_of_rows/9);
// $no_of_rows=ceil($no_of_rows/9);
// echo $no_of_rows;
$data = array ();
$count = 0 ;
$flag_rows = 0 ;
error_log ( " saved checkup sections " . $row_checkup [ 'checkup_section_ids' ]);
$saved_section_list = explode ( " , " , $row_checkup [ 'checkup_section_ids' ]);
$sectionCount = 0 ;
while ( $row_checkup_parameter_col = mysqli_fetch_assoc ( $result_checkup_parameter_col )) {
$data [] = $row_checkup_parameter_col ;
if ( $row_checkup_parameter_col [ 'is_mandatory' ] == 'Y' && in_array ( $row_checkup_parameter_section [ 'section_id' ], $saved_section_list )) {
$emptyParameterData [ $row_checkup_parameter_col [ 'column_name' ]] = trim ( $row_checkup_parameter_col [ 'parameter_name' ]);
}
if ( $row_checkup_parameter_col [ 'is_mandatory' ] == 'Y' ) {
$sectionWiseParameterData [ $row_checkup_parameter_section [ 'section_id' ]][ $sectionCount ][ 0 ] = $row_checkup_parameter_col [ 'column_name' ];
$sectionWiseParameterData [ $row_checkup_parameter_section [ 'section_id' ]][ $sectionCount ][ 1 ] = trim ( $row_checkup_parameter_col [ 'parameter_name' ]);
$sectionCount ++ ;
}
// error_log("mandatory parameter data " . print_r($emptyParameterData, true));
// error_log("section wise mandatory parameter data ".print_r($sectionWiseParameterData,true));
// error_log("data printing to build the checkup form " . print_r($data, true));
if ( $row_checkup_parameter_col [ 'checkup_form_section_id' ] == 1 && $flag_rows == 0 ) {
$no_of_rows = ( $no_of_rows / 10 );
// echo $no_of_rows;
$flag_rows = 1 ;
}
}
if ( $flag_rows == 0 ) {
$no_of_rows = ceil ( count ( $rows_no_groups ) / 3 );
}
$counter = 0 ;
$h = 0 ;
$k = 0 ;
for ( $i = 0 ; $i < $no_of_rows ; $i ++ ) {
?>
< div class = " row " >
< ? php
for ( $k = 0 ; $k < 3 ; $k ++ ) {
$flag = 0 ;
?> <div class="col-sm-4">
< div class = " table-responsive " style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< ? php
$grp = $h + 1 ;
$tital = getTableFieldValue ( 'checkup_parameter_group' , 'group_tital' , 'group_section' , $row_checkup_parameter_section [ 'section_id' ], 'group_no' , $grp );
if ( $tital != '' || $tital != null ) { ?>
< tr >
< td colspan = " <?= $rows_no_groups[$h] ?> " >
< b style = " font-size: 11px; font-weight: 600 " >< ? = $tital ?> </b>
</ td >
</ tr >
< ? php } ?>
< tr >
< ? php
for ( $j = 0 ; $j < $rows_no_groups [ $h ]; $j ++ ) {
?>
< th >< ? php
echo $data [ $count ][ 'parameter_name' ]; ?>
< ? php if ( $data [ $count ][ 'is_mandatory' ] == 'Y' ){ echo " <span id='mandatoryIndicator_ " . $data [ $count ][ 'column_name' ] . " ' style='color: red; cursor: pointer;' title='Mandatory Field'>*</span>   " ; } ?>
< a href = " # " data - toggle = " tooltip " data - placement = " top " title = " <?= $data[$count] ['ref_ranges'] ?> " >< i class = " fa fa-info-circle " ></ i ></ a >
< ? php
$count ++ ;
if ( $count == count ( $data )) {
$flag = 1 ;
break ;
}
?>
</ th >
< ? php
}
?>
</ tr >
< tr >
< ? php
for ( $j = 0 ; $j < $rows_no_groups [ $h ]; $j ++ ) {
$parameter_values = $data [ $counter ][ 'parameter_value' ];
if ( $parameter_values != " " || $parameter_values != null ) {
$parameter_values_array = explode ( " , " , $parameter_values );
$input_type = $data [ $counter ][ 'input_type' ];
$default_value_id = getFieldFromTable ( 'parameter_value_id' , 'checkup_parameter_value' , 'parameter_value_name' , $data [ $counter ][ 'default_value' ]);
$default_value_name = getFieldFromTable ( 'parameter_value_name' , 'checkup_parameter_value' , 'parameter_value_id' , $default_value_id );
if ( $input_type == 'select' ) {
?>
< td >< select id = " <?= $data[$counter] ['column_name'] ?> " name = " <?= $data[$counter] ['column_name'] ?> " style = " width: 51px; " >
< ? php
echo " <option value='' selected >select</option> " ;
$default_needed = true ;
for ( $p = 0 ; $p < count ( $parameter_values_array ); $p ++ ) {
$parameter_name = getTableFieldValue ( 'checkup_parameter_value' , 'parameter_value_name' , 'parameter_value_id' , $parameter_values_array [ $p ]);
if ( $data [ $counter ][ 'checkup_form_value' ] == $parameter_values_array [ $p ]) {
echo " <option value=' " . $parameter_values_array [ $p ] . " ' selected > " . $parameter_name . " </option> " ;
$default_needed = false ;
} else {
if ( $default_needed && $parameter_values_array [ $p ] == $default_value_id ) {
echo " <option value=' " . $parameter_values_array [ $p ] . " ' selected> " . $parameter_name . " </option> " ;
} else {
echo " <option value=' " . $parameter_values_array [ $p ] . " '> " . $parameter_name . " </option> " ;
}
}
}
?>
</ select ></ td >
< ? php
} else if ( $input_type == 'multiselect' ) {
?>
< td >
< input type = " hidden " name = " multi<?= $data[$counter] ['column_name'] ?> " id = " multi<?= $data[$counter] ['column_name'] ?> " value = " <?= $data[$counter] ['checkup_form_value'] ?> " />
< select class = " form-control chosen-select " multiple name = " <?= $data[$counter] ['column_name'] ?>[] " id = " <?= $data[$counter] ['column_name'] ?> " style = " width: 51px; " >
< ? php
for ( $p = 0 ; $p < count ( $parameter_values_array ); $p ++ ) {
$parameter_name = getTableFieldValue ( 'checkup_parameter_value' , 'parameter_value_name' , 'parameter_value_id' , $parameter_values_array [ $p ]);
echo " <option value=' " . $parameter_values_array [ $p ] . " '> " . $parameter_name . " </option> " ;
}
?>
</ select >
</ td >
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
add_multi_value ( < ? = $data [ $counter ][ 'column_name' ] ?> );
});
</ script >
< ? php
}
} else {
$input_type = $data [ $counter ][ 'input_type' ];
$readonly_field = $data [ $counter ][ 'readonly_field' ];
if ( $input_type == 'number' ) {
?>
< input type = " hidden " name = " color_<?= $data[$counter] ['column_name'] ?> " id = " color_<?= $data[$counter] ['column_name'] ?> " value = " <?= $color_val ?> " >
< ? php
if ( $readonly_field == 'N' ) {
?>
< td >
< input type = " hidden " id = " read_<?= $data[$counter] ['column_name'] ?> " name = " read_<?= $data[$counter] ['column_name'] ?> " value = " <?= $data[$counter] ['checkup_parameter_id'] ?> " />
< input id = " <?= $data[$counter] ['column_name'] ?> " class = " form-control " readonly name = " <?= $data[$counter] ['column_name'] ?> " type = " number " min = " <?php echo $data[$counter] ['starting_range']; ?> " max = " <?php echo $data[$counter] ['ending_range']; ?> " data - key - name = " <?= getFieldFromTable('key_param_name', 'key_health_reportable_parameter_master', 'key_param_id', $data[$counter] ['key_health_map_name']) ?> " data - rule - ids = " <?= $data[$counter] ['rule_ids'] ?> " min = " <?php echo $data[$counter] ['starting_range']; ?> " max = " <?php echo $data[$counter] ['ending_range']; ?> " placeholder = " <?= $data[$counter] ['place_holder_name'] ?> " value = " <?= $data[$counter] ['checkup_form_value'] ?> " onchange = " checkRange(this.value,this,<?= $counter ?>); " />
</ td >
< ? php
} else {
?>
< td >
< input id = " <?= $data[$counter] ['column_name'] ?> " class = " form-control numberField " name = " <?= $data[$counter] ['column_name'] ?> " type = " number " data - key - name = " <?= getFieldFromTable('key_param_name', 'key_health_reportable_parameter_master', 'key_param_id', $data[$counter] ['key_health_map_name']) ?> " data - rule - ids = " <?= $data[$counter] ['rule_ids'] ?> " min = " <?php echo $data[$counter] ['starting_range']; ?> " max = " <?php echo $data[$counter] ['ending_range']; ?> " placeholder = " <?= $data[$counter] ['place_holder_name'] ?> " value = " <?php if (empty(trim( $data[$counter] ['checkup_form_value']))) {
echo $data [ $counter ][ 'default_value' ];
} else {
echo $data [ $counter ][ 'checkup_form_value' ];
} ?> " onchange="checkRange(this.value,this,<?= $counter ?>);" />
</ td >
< ? php
}
} else {
if ( $input_type == 'textarea' ) {
?>
< td >< textarea id = " <?= $data[$counter] ['column_name'] ?> " rows = " 4 " class = " form-control " name = " <?= $data[$counter] ['column_name'] ?> " placeholder = " <?= $data[$counter] ['place_holder_name'] ?> " > < ? php if ( empty ( trim ( $data [ $counter ][ 'checkup_form_value' ]))) {
echo $data [ $counter ][ 'default_value' ];
} else {
echo $data [ $counter ][ 'checkup_form_value' ];
} ?> </textarea>
</ td >
< ? php
} else { ?>
< td >
< input type = " hidden " name = " color_<?= $data[$counter] ['column_name'] ?> " id = " color_<?= $data[$counter] ['column_name'] ?> " value = " <?= $color_val ?> " >
< input id = " <?= $data[$counter] ['column_name'] ?> " class = " form-control " name = " <?= $data[$counter] ['column_name'] ?> " value = " <?php if (empty(trim( $data[$counter] ['checkup_form_value']))) {
echo $data [ $counter ][ 'default_value' ];
} else {
echo $data [ $counter ][ 'checkup_form_value' ];
} ?> " type="text" data-key-name="<?= getFieldFromTable('key_param_name', 'key_health_reportable_parameter_master', 'key_param_id', $data[$counter]['key_health_map_name']) ?>" data-rule-ids="<?= $data[$counter]['rule_ids'] ?>" placeholder="<?= $data[$counter]['place_holder_name'] ?>" onchange="checkRange(this.value,this,<?= $counter ?>);">
</ td >
< ? php
}
}
}
$counter ++ ;
if ( $counter == count ( $data )) {
// $flag1=1;
break ;
}
}
$h ++ ;
?>
</ tr >
</ table >
</ div >
</ div > < ? php
if ( $flag == 1 )
break ;
}
?>
</ div >
< ? php } ?>
</ div >
<!-- < div class = " panel-footer " >
< button type = " submit " onclick = " validation_checkup_form(); " class = " button " >
< span class = " glyphicon glyphicon-floppy-save " > Save </ span >
</ button >
</ div > -->
</ div >
</ div >
< ? php
$i1 ++ ;
}
?>
<!-- Additional Parameter section code start -->
< ? php if ( $row_checkup [ 'add_param_ids' ] != '' && $row_checkup [ 'add_param_ids' ] != null ) { ?>
< div class = " panel panel-default " id = " pannel_Additional_tests " >
< div class = " panel-heading " id = " panel-heading1 " >
< h5 class = " panel-title " id = " panel-title1 " >
< a role = " button " data - toggle = " collapse " href = " #collapseOneAddTest " aria - expanded = " true " aria - controls = " collapseOne " style = " font-size: 15px; " > Additional / Other Tests </ a >
</ h5 >
</ div >
< div id = " collapseOneAddTest " class = " panel-collapse collapse in " >
< div class = " panel-body " >
< div class = " row " >
< ? php
$sql_add_param = " select * from checkup_parameter a left join checkup_form_key_value b on a.column_name=b.checkup_form_key and b.checkup_form_id=' " . $checkup_id . " ' where a.checkup_parameter_id in ( " . $row_checkup [ 'add_param_ids' ] . " ) " ;
error_log ( " additional param query " . $sql_add_param );
$result_add_param = mysqli_query ( $conn , $sql_add_param );
while ( $row_add_param = mysqli_fetch_assoc ( $result_add_param )) {
$add_input_type = $row_add_param [ 'input_type' ];
$add_parameter_values = $row_add_param [ 'parameter_value' ];
if ( $row_add_param [ 'is_mandatory' ] == 'Y' ) {
$emptyParameterData [ $row_add_param [ 'column_name' ]] = trim ( $row_add_param [ 'parameter_name' ]);
}
if ( $add_parameter_values != " " || $add_parameter_values != null ) {
$add_parameter_values_array = explode ( " , " , $add_parameter_values );
}
$add_default_value_id = getFieldFromTable ( 'parameter_value_id' , 'checkup_parameter_value' , 'parameter_value_name' , $row_add_param [ 'default_value' ]);
?>
< div class = " col-sm-4 " >
< div class = " table-responsive " style = " margin-left: 10px; " >
< table class = " table table-bordered " >
< tbody >
< tr >
< th >
< ? php echo $row_add_param [ 'parameter_name' ] ?>
< ? php if ( $row_add_param [ 'is_mandatory' ] == 'Y' ){ echo " <span id='mandatoryIndicator_ " . $row_add_param [ 'column_name' ] . " ' style='color: red; cursor: pointer;' title='Mandatory Field'>*</span>   " ; } ?>
< a href = " # " data - toggle = " tooltip " data - placement = " top " title = " <?= $row_add_param['ref_ranges'] ?> " >< i class = " fa fa-info-circle " ></ i ></ a >
</ th >
</ tr >
< tr >
< ? php if ( $add_input_type == 'number' ) { ?>
< td >
< input type = " hidden " name = " color_<?= $row_add_param['column_name'] ?> " id = " color_<?= $row_add_param['column_name'] ?> " value = " <?= $color_val ?> " >
< input id = " <?= $row_add_param['column_name'] ?> " class = " form-control numberField " name = " <?= $row_add_param['column_name'] ?> " onchange = " checkRange(this.value,this) " type = " number " data - key - name = " <?= getFieldFromTable('key_param_name', 'key_health_reportable_parameter_master', 'key_param_id', $row_add_param['key_health_map_name'] ) ?> " data - rule - ids = " <?= $row_add_param['rule_ids'] ?> " placeholder = " <?= $row_add_param['place_holder_name'] ?> " value = " <?php if (empty(trim( $row_add_param['checkup_form_value'] ))) {
echo $row_add_param [ 'default_value' ];
} else {
echo $row_add_param [ 'checkup_form_value' ];
} ?> " onchange="checkRange(this.value,this,<?= $counter ?>);" />
</ td >
< ? php } else if ( $add_input_type == 'select' ) { ?>
< td >
< select class = " form-control " id = " <?= $row_add_param['column_name'] ?> " name = " <?= $row_add_param['column_name'] ?> " style = " width: 100%; " >
< ? php echo " <option value='' >select</option> " ;
$default_needed = true ;
for ( $p = 0 ; $p < count ( $add_parameter_values_array ); $p ++ ) {
// error_log("selected val " .$row_add_param['checkup_form_value']);
$add_parameter_name = getTableFieldValue ( 'checkup_parameter_value' , 'parameter_value_name' , 'parameter_value_id' , $add_parameter_values_array [ $p ]);
if ( $row_add_param [ 'checkup_form_value' ] == $add_parameter_values_array [ $p ]) {
echo " <option value=' " . $add_parameter_values_array [ $p ] . " ' selected > " . $add_parameter_name . " </option> " ;
$default_needed = false ;
} else {
if ( $default_needed && $add_parameter_values_array [ $p ] == $add_default_value_id ) {
echo " <option value=' " . $add_parameter_values_array [ $p ] . " ' selected> " . $add_parameter_name . " </option> " ;
} else {
echo " <option value=' " . $add_parameter_values_array [ $p ] . " '> " . $add_parameter_name . " </option> " ;
}
}
}
?>
</ td >
< ? php } else if ( $add_input_type == 'multiselect' ) { ?>
< td >< input type = " hidden " name = " multi<?= $row_add_param['column_name'] ?> " id = " multi<?= $row_add_param['column_name'] ?> " value = " <?= $row_add_param['checkup_form_value'] ?> " />
< select class = " form-control chosen-select " id = " <?= $row_add_param['column_name'] ?> " name = " <?= $row_add_param['column_name'] ?>[] " style = " width: 51px; " multiple >
< ? php echo " <option value='' selected >select</option> " ;
for ( $p = 0 ; $p < count ( $add_parameter_values_array ); $p ++ ) {
$add_parameter_name = getTableFieldValue ( 'checkup_parameter_value' , 'parameter_value_name' , 'parameter_value_id' , $add_parameter_values_array [ $p ]);
if ( $row_add_param [ 'checkup_form_value' ] == $add_parameter_values_array [ $p ]) {
echo " <option value=' " . $add_parameter_values_array [ $p ] . " ' selected > " . $add_parameter_name . " </option> " ;
} else {
echo " <option value=' " . $add_parameter_values_array [ $p ] . " '> " . $add_parameter_name . " </option> " ;
}
}
?>
</ td >
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
add_multi_value ( < ? = $row_add_param [ 'column_name' ] ?> );
});
</ script >
< ? php } else if ( $add_input_type == 'textarea' ) { ?>
< td >
< textarea id = " <?= $row_add_param['column_name'] ?> " rows = " 4 " class = " form-control " name = " <?= $row_add_param['column_name'] ?> " placeholder = " <?= $row_add_param['place_holder_name'] ?> " > < ? php if ( empty ( trim ( $row_add_param [ 'checkup_form_value' ]))) {
echo $row_add_param [ 'default_value' ];
} else {
echo $row_add_param [ 'checkup_form_value' ];
} ?> </textarea>
</ td >
< ? php
} else {
?>
< td >
< input type = " hidden " name = " color_<?= $row_add_param['column_name'] ?> " id = " color_<?= $row_add_param['column_name'] ?> " value = " <?= $color_val ?> " >
< input id = " <?= $row_add_param['column_name'] ?> " class = " form-control " name = " <?= $row_add_param['column_name'] ?> " onchange = " checkRange(this.value,this) " value = " <?php if (empty(trim( $row_add_param['checkup_form_value'] ))) {
echo $row_add_param [ 'default_value' ];
} else {
echo $row_add_param [ 'checkup_form_value' ];
} ?> " type="text" data-key-name="<?= getFieldFromTable('key_param_name', 'key_health_reportable_parameter_master', 'key_param_id', $row_add_param['key_health_map_name']) ?>" data-rule-ids="<?= $row_add_param['rule_ids'] ?>" placeholder="<?= $row_add_param['place_holder_name'] ?>" onchange="checkRange(this.value,this,<?= $counter ?>);">
</ td >
< ? php } ?>
</ tr >
</ tbody >
</ table >
</ div >
</ div >
< ? php } ?>
</ div >
</ div >
</ div >
</ div >
< ? php } ?>
<!-- Additional Parameter section code end -->
< input type = " hidden " name = " empty_parameter_data " id = " empty_parameter_data " value = " <?= htmlspecialchars(json_encode( $emptyParameterData )) ?> " >
< input type = " hidden " name = " section_wise_parameter_data " id = " section_wise_parameter_data " value = " <?= htmlspecialchars(json_encode( $sectionWiseParameterData )) ?> " >
</ div >
</ div >
</ form >
< style >
. row {
margin - right : 0 px ;
}
. ace - icon {
margin - right : unset ;
}
. widget - toolbar >. widget - menu > a [ data - action ] >. ace - icon ,
. widget - toolbar > a [ data - action ] >. ace - icon {
margin - right : 12 px ;
}
</ style >
< script >
var risk = '<?= $risk ?>' ;
var advice = '<?= $advice ?>' ;
$ ( document ) . ready ( function () {
$ ( '[data-toggle="tooltip"]' ) . tooltip ();
});
// setChosenUpdatedMultiple("health_advice_name", advice);
// setChosenUpdatedMultiple("health_risk_name", risk);
jQuery ( function ( $ ) {
console . log ( " rolecode:<?= $_SESSION['RoleCode'] ?> " );
< ? php
if ( $_SESSION [ 'RoleCode' ] == $__ROLE_MEDICALROOM ) { ?>
$ ( " #forwardButton " ) . on ( " click " , function () {
BootstrapDialog . show ({
// type: BootstrapDialog.TYPE_DEFAULT,
title : 'Save & Forward' ,
message : '<select class="form-control" id="forward_status" style="margin:4%;width:90%" >' +
'<option value="<?= $__STATUS_MEDICAL_ATTENDED ?>">Save Draft</option>' +
'<option value="<?= $__STATUS_DOCTOR_PENDING ?>">Save & Forward To Doctor</option>' +
'</select>' ,
buttons : [{
label : 'Save & Submit' ,
icon : 'fa fa-save' ,
cssClass : 'btn-info' ,
action : function () {
$ ( " #attendedStatus " ) . val ( $ ( " #forward_status " ) . val ());
// validate($("#forward_status").val());
validation_checkup_form ();
// loadPage();
// $(".close").click();
}
}]
});
});
< ? php } else { ?>
// validate($("#forward_status").val())
< ? php } ?>
< ? php
if ( $_SESSION [ 'RoleCode' ] == $__ROLE_DOCTOR ) { ?>
$ ( " #forwardButton " ) . on ( " click " , function () {
BootstrapDialog . show ({
// type: BootstrapDialog.TYPE_DEFAULT,
title : 'Save & Forward' ,
message : '<select class="form-control" id="forward_status" style="margin:4%;width:90%" >' +
'<option value="<?= $__STATUS_DOCTOR_APPROVED ?>">Approve</option>' +
'<option value="<?= $__STATUS_DOCTOR_ATTENDED ?>">Save Draft</option>' +
'<option value="<?= $__STATUS_MEDICAL_PENDING ?>">Forward to Medical Room/Lab</option>' +
'</select>' ,
buttons : [{
label : 'Save & Submit' ,
icon : 'fa fa-save' ,
cssClass : 'btn-info' ,
action : function () {
$ ( " #attendedStatus " ) . val ( $ ( " #forward_status " ) . val ());
$ ( '#approve_date' ) . datetimepicker ({
format : 'DD/MM/YYYY h:mm A' ,
defaultDate : new Date ()
});
// validate($("#forward_status").val());
validation_checkup_form ();
// loadPage();
// $(".close").click();
}
}]
});
});
< ? php } else { ?>
// validate($("#forward_status").val())
< ? php } ?>
< ? php
if ( $_SESSION [ 'RoleCode' ] == $__ROLE_RECEPTIONIST ) { ?>
$ ( " #forwardButton " ) . on ( " click " , function () {
BootstrapDialog . show ({
// type: BootstrapDialog.TYPE_DEFAULT,
title : 'Save & Forward' ,
message : '<select class="form-control" id="forward_status" style="width:90%" >' +
'<option value="<?= $__STATUS_RECEPTIONIST_ATTENDED ?>">Save Draft</option>' +
'<option value="<?= $__STATUS_MEDICAL_PENDING ?>">Save & Forward To Medical Room</option>' +
'<option value="<?= $__STATUS_DOCTOR_PENDING ?>">Save & Forward To Doctor </option>' +
'</select>' ,
buttons : [{
label : 'Save & Submit' ,
icon : 'fa fa-save' ,
cssClass : 'btn-info' ,
action : function () {
$ ( " #attendedStatus " ) . val ( $ ( " #forward_status " ) . val ());
$ ( '#approve_date' ) . datetimepicker ({
format : 'DD/MM/YYYY h:mm A' ,
defaultDate : new Date ()
});
// validate($("#forward_status").val());
validation_checkup_form ();
loadPage ();
// $(".close").click();
}
}]
});
});
< ? php } else if ( $_SESSION [ 'RoleCode' ] == $__ROLE_LAB ) { ?>
$ ( " #forwardButton " ) . on ( " click " , function () {
BootstrapDialog . show ({
// type: BootstrapDialog.TYPE_DEFAULT,
title : 'Save & Forward' ,
message : '<select class="form-control" id="forward_status" style="width:90%" >' +
'<option value="<?= $__STATUS_LAB_ATTENDED ?>">Save</option>' +
'<option value="<?= $__STATUS_DOCTOR_PENDING ?>">Save & Forward To Doctor </option>' +
'</select>' ,
buttons : [{
label : 'Save & Submit' ,
icon : 'fa fa-save' ,
cssClass : 'btn-info' ,
action : function () {
$ ( " #attendedStatus " ) . val ( $ ( " #forward_status " ) . val ());
$ ( '#approve_date' ) . datetimepicker ({
format : 'DD/MM/YYYY h:mm A' ,
defaultDate : new Date ()
});
// validate($("#forward_status").val());
validation_checkup_form ();
// loadPage();
// $(".close").click();
}
}]
});
});
< ? php } else { ?>
// validate($("#forward_status").val())
< ? php } ?>
});
var checkup_section_name = [];
function get_section_id () {
< ? php
$sql_section = " select * from checkup_form_section where status='Active' and section_id in ( $checkup_section_ids ) order by display_order asc " ;
error_log ( " yogi check section " . $sql_section );
$result_section = mysqli_query ( $conn , $sql_section );
$i = 0 ;
while ( $row_section = mysqli_fetch_assoc ( $result_section )) {
?>
if ( document . getElementById ( '<?php echo $row_section[' section_desc '] ?>' ) . checked ) {
checkup_section_name . push ( document . getElementById ( '<?php echo $row_section[' section_desc '] ?>' ) . name );
//alert(checkup_section_name);
}
< ? php $i ++ ;
} ?>
$ ( " #checkup_section_ids " ) . val ( checkup_section_name );
//alert(checkup_section_name);
/* checkup_section_name . push ( section_name );
$ ( " #checkup_section_ids " ) . val ( checkup_section_name );
alert ( checkup_section_name ); */
}
function load_checkup_header ( checkup_type_id ) {
document . checkup_form_employee . submit ();
}
// function calculateBMI() {
// var height = $("#height").val();
// var weight = $("#weight").val();
// if (height != null && height != '' && weight != null && weight != '') {
// height = parseFloat(height);
// weight = parseFloat(weight);
// if (height != 0.0)
// var bmi = (weight / (height * height)) * 100 * 100;
// $("#bmi").val(bmi.toFixed(1));
// // let read_id = $("#read_bmi").val();
// // alert(read_id);
// // rule_gen(read_id);
// }
// }
function goto_employee_questionnaire ( empId ) {
// window.location = 'edit_employee_details.php?emp_id='+empId+'&page="checkup"';
window . open ( 'edit_employee_details.php?emp_id=' + empId + '&page="checkup"' , '_blank' );
}
// create new array to store values
ids_value = new Set ();
hiddenHighlighter = document . getElementById ( 'hiddenHighlighter' );
/*handling health risk dynamically */
var existinghealth_risk_nameArr = [];
var existinghealth_risk_name =
" <?php echo getCommaSeperatedValuesForInClause( " select health_risk_name from health_risk " , 'health_risk_id', $row_checkup['health_risk_id'] ) ?> "
if ( existinghealth_risk_name != undefined && existinghealth_risk_name != null && existinghealth_risk_name != '' ) {
existinghealth_risk_nameArr = existinghealth_risk_name . split ( " , " );
}
/*
for handling the advices dynamically
*/
var existinghealth_advice_nameArr = [];
var existinghealth_advice_name =
" <?php echo getCommaSeperatedValuesForInClause( " select health_advice_name from health_advice " , 'health_advice_id', $row_checkup['health_advice_id'] ) ?> "
if ( existinghealth_advice_name != undefined && existinghealth_advice_name != null && existinghealth_advice_name != '' ) {
existinghealth_advice_nameArr = existinghealth_advice_name . split ( " , " );
}
$ ( document ) . ready ( function () {
var health_risk_name = new Array ();
if ( $ ( '#health_risk_name' )) {
function gethealth_risk_name () {
return new Promise (( resolve , reject ) => {
$ . ajax ({
url : 'select_health_risk_name.php' ,
type : " GET " ,
success : function ( data ) {
health_risk_name = $ . parseJSON ( data );
resolve ( health_risk_name );
},
error : function ( data ) {
reject ( data );
}
});
})
}
gethealth_risk_name () . then (( health_risk_name ) => {
setTimeout ( function () {
var tag_input_health_risk_name = $ ( '#health_risk_name' );
try {
tag_input_health_risk_name . tag ({
placeholder : tag_input_health_risk_name . attr ( 'placeholder' ),
source : health_risk_name
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#health_risk_name' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
// var existinghealth_risk_name = "<?php echo getCommaSeperatedValuesForInClause("select health_risk_name from health_risk", 'health_risk_id', $row_checkup['health_risk_id']) ?>"
// if (existinghealth_risk_name != undefined && existinghealth_risk_name != null && existinghealth_risk_name != '') {
// var existinghealth_risk_nameArr = existinghealth_risk_name.split(",");
jQuery . each ( existinghealth_risk_nameArr , function ( i , val ) {
$tag_obj . add ( val . toUpperCase ());
});
// }
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_health_risk_name . after ( '<textarea id="' +
tag_input_health_risk_name . attr ( 'id' ) +
'" name="' + tag_input_health_risk_name . attr ( 'name' ) +
'" rows="3">' +
tag_input_health_risk_name . val () + '</textarea>' ) . remove ();
//autosize($('#form-field-tags'));
}
$ ( " #SpinnerContainerRisk " ) . hide ();
}, 100 );
}) . catch (( Error ) => {
BootstrapDialog . alert ( " Something went wrong while fetching risks " + Error . nama );
})
}
var health_advice_name = new Array ();
if ( $ ( '#health_advice_name' )) {
function gethealth_advice_name () {
return new Promise (( resolve , reject ) => {
$ . ajax ({
url : 'select_health_advice_name.php' ,
type : " GET " ,
success : function ( data ) {
health_advice_name = $ . parseJSON ( data );
resolve ( health_advice_name );
},
error : function ( data ) {
reject ( data );
}
});
})
}
gethealth_advice_name () . then (( health_advice_name ) => {
setTimeout ( function () {
var tag_input_health_advice_name = $ ( '#health_advice_name' );
try {
tag_input_health_advice_name . tag ({
placeholder : tag_input_health_advice_name . attr ( 'placeholder' ),
source : health_advice_name
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#health_advice_name' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
// var existinghealth_advice_name = "<?php echo getCommaSeperatedValuesForInClause("select health_advice_name from health_advice", 'health_advice_id', $row_checkup['health_advice_id']) ?>"
// if (existinghealth_advice_name != undefined && existinghealth_advice_name != null && existinghealth_advice_name != '') {
// var existinghealth_advice_nameArr = existinghealth_advice_name.split(",");
jQuery . each ( existinghealth_advice_nameArr , function ( i , val ) {
$tag_obj . add ( val . toUpperCase ());
});
// }
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_health_advice_name . after ( '<textarea id="' +
tag_input_health_advice_name . attr ( 'id' ) +
'" name="' + tag_input_health_advice_name . attr ( 'name' ) +
'" rows="3">' +
tag_input_health_advice_name . val () + '</textarea>' ) . remove ();
//autosize($('#form-field-tags'));
}
$ ( " #SpinnerContainerAdvice " ) . hide ();
}, 100 );
}) . catch (( Error ) => {
BootstrapDialog . alert ( " Something went wrong while fetching advices " + Error . name );
})
}
});
$ ( document ) . ready ( function () {
//option A
$ ( " #checkup_form_employee " ) . submit ( function ( e ) {
e . preventDefault ();
});
});
function checkRange ( parameter_val , element , counter ) {
if ( element != null ) {
let rule_id = element . getAttribute ( " data-rule-ids " );
let key_param_name = element . getAttribute ( " data-key-name " );
let emp_id = $ ( " #checkup_emp_id " ) . val ();
let user_input_val = " " ;
if ( typeof parameter_val === 'string' ) {
user_input_val = parameter_val ;
} else {
user_input_val = Number . parseFloat ( parameter_val );
}
console . log ( " got here : rule ids " + rule_id + " key " + key_param_name + " val " + user_input_val );
let myRule = new Promise ( function ( resolve , reject ) {
$ . ajax ({
type : 'POST' ,
url : 'get_rule_equation_resolved.php' ,
data : {
val : user_input_val ,
rules : rule_id ,
key_param_name : key_param_name ,
emp_id : emp_id
},
success : function ( jsonData ) {
try {
const data = JSON . parse ( jsonData );
console . log ( " got here in range " );
resolve ( data );
} catch ( error ) {
console . log ( " got here in range error " );
reject ( error );
}
},
error : function ( data ) {
reject ( data );
}
})
});
myRule . then (( data ) => {
let id = element . id ;
console . log ( " till here all good inside range then " + id );
if ( data . color == '' || data . color == undefined || data . color == null ) {
$ ( " # " + id ) . css ( " border " , " " );
document . getElementById ( `${id}` ) . style . color = " " ;
// console.log(ids_value);
$ ( " #color_ " + element . id ) . val ( " " );
if ( ids_value . has ( id )) {
ids_value . delete ( id );
}
hiddenHighlighter . value = Array . from ( ids_value ) . join ();
} else {
$ ( " # " + id ) . css ( " border " , " 1px solid " + data . color );
document . getElementById ( `${id}` ) . style . color = data . color ;
$ ( " #color_ " + element . id ) . val ( data . color );
ids_value . add ( id );
// console.log(ids_value);
hiddenHighlighter . value = Array . from ( ids_value ) . join ();
}
return data ;
})
. then (( data ) => {
if ( data != null ) {
data_risk = [];
data_advice = [];
data_chronic = [];
try {
data_risk = data . risks . split ( " , " );
data_advice = data . advices . split ( " , " );
data_chronic = data . abnormality . split ( " , " );
} catch ( Error ) {
console . log ( Error . name );
}
if ( data_risk != '' ) {
data_risk . forEach ( risk => {
existinghealth_risk_nameArr . push ( risk );
});
if ( $ ( '#health_risk_name' )) {
setTimeout ( function () {
var tag_input_health_risk_name = $ ( '#health_risk_name' );
try {
tag_input_health_risk_name . tag ({
placeholder : tag_input_health_risk_name . attr ( 'placeholder' ),
source : health_risk_name
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#health_risk_name' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
// var existinghealth_risk_name = "<?php echo getCommaSeperatedValuesForInClause("select health_risk_name from health_risk", 'health_risk_id', $row_checkup['health_risk_id']) ?>"
// if (existinghealth_risk_name != undefined && existinghealth_risk_name != null && existinghealth_risk_name != '') {
// var existinghealth_risk_nameArr = existinghealth_risk_name.split(",");
jQuery . each ( existinghealth_risk_nameArr , function ( i , val ) {
if ( val != '' ) {
$tag_obj . add ( val . toUpperCase ());
}
});
// }
} catch ( e ) {
tag_input_health_risk_name . after ( '<textarea id="' +
tag_input_health_risk_name . attr ( 'id' ) + '" name="' +
tag_input_health_risk_name . attr ( 'name' ) + '" rows="3">' +
tag_input_health_risk_name . val () + '</textarea>' ) . remove ();
}
}, 100 );
}
}
if ( data_advice != '' ) {
data_advice . forEach ( advice => {
existinghealth_advice_nameArr . push ( advice );
});
if ( $ ( '#health_advice_name' )) {
setTimeout ( function () {
var tag_input_health_advice_name = $ ( '#health_advice_name' );
try {
tag_input_health_advice_name . tag ({
placeholder : tag_input_health_advice_name . attr ( 'placeholder' ),
source : health_advice_name
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#health_advice_name' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
2024-11-19 09:59:09 +05:30
// var existinghealth_advice_name = "
2024-10-16 19:18:52 +05:30
// if (existinghealth_advice_name != undefined && existinghealth_advice_name != null && existinghealth_advice_name != '') {
// var existinghealth_advice_nameArr = existinghealth_advice_name.split(",");
jQuery . each ( existinghealth_advice_nameArr , function ( i , val ) {
if ( val != '' ) {
$tag_obj . add ( val . toUpperCase ());
}
});
// }
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_health_advice_name . after ( '<textarea id="' +
tag_input_health_advice_name . attr ( 'id' ) + '" name="' +
tag_input_health_advice_name . attr ( 'name' ) + '" rows="3">' +
tag_input_health_advice_name . val () + '</textarea>' ) . remove ();
//autosize($('#form-field-tags'));
}
// var y = $('#health_advice_name').parents("td").width();
// $('#health_advice_name').siblings().css('width', y - 20);
// var f = $('#health_advice_name').parents("td").css("fontSize");
// $('#health_advice_name').siblings().css('fontSize', f);
}, 100 );
}
}
if ( data_chronic != '' ) {
data_chronic . forEach ( chronic => {
existingabnormalities_data_Arr . push ( chronic );
});
if ( $ ( '#abnormalities_data' )) {
setTimeout ( function () {
var tag_input_to = $ ( '#abnormalities_data' );
try {
tag_input_to . tag ({
placeholder : tag_input_to . attr ( 'placeholder' ),
source : abnormalities_data
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#abnormalities_data' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
// var existingabnormalities_data = "<?php echo getCommaSeperatedValuesForInClause('select param_name from history_parameter', 'param_id', $row_checkup['past_present_illness']) ?>"
// if (existingabnormalities_data != undefined && existingabnormalities_data != null && existingabnormalities_data != '') {
// var existingabnormalities_dataArr = existingabnormalities_data.split(",");
console . log ( " duplicate chronic illness values " , existingabnormalities_data_Arr );
existingabnormalities_data_Arr = [ ... new Set ( existingabnormalities_data_Arr . map ( item => item . toUpperCase () . trim ()))];
console . log ( " unique chronic illness values " , existingabnormalities_data_Arr );
jQuery . each ( existingabnormalities_data_Arr , function ( i , val ) {
if ( val != '' ) {
$tag_obj . add ( val );
}
});
// }
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_to . after ( '<textarea id="' + tag_input_to . attr ( 'id' ) + '" name="' +
tag_input_to . attr ( 'name' ) + '" rows="3">' + tag_input_to . val () +
'</textarea>' ) . remove ();
//autosize($('#form-field-tags'));
}
// var y = $('#abnormalities_data').parents("td").width();
// $('#abnormalities_data').siblings().css('width', y - 3);
document . getElementById ( " forwardButton " ) . style . visibility = " visible " ;
document . getElementById ( " generateButton " ) . style . visibility = 'visible' ;
$ ( " #SpinnerContainerAbnormality " ) . hide ();
}, 100 );
}
}
}
})
. catch (( Error ) => {
console . log ( " got here in range catch " );
console . log ( Error . name );
})
} else {
return " Parameter is not present either rule is wrong or it is not assigned correctly " ;
}
}
/*ends here risk handling*/
// abnormality tag data start
var existingabnormalities_data_Arr = [];
var existingabnormalities_data =
" <?php echo getCommaSeperatedValuesForInClause( " select abnormality_name from abnormality " , 'abnormality_id', $row_checkup['abnormality_ids'] ) ?> " ;
if ( existingabnormalities_data != undefined && existingabnormalities_data != null && existingabnormalities_data != '' ) {
existingabnormalities_data_Arr = existingabnormalities_data . split ( " , " );
}
$ ( document ) . ready ( function () {
/*past present illness tag fields start*/
if ( $ ( " #past_present_illness_data " )) {
var past_present_illness_data = new Array ();
function getpast_present_illness_data () {
return new Promise (( resolve , reject ) => {
$ . ajax ({
url : 'select_past_present_illness_data.php' ,
type : " GET " ,
success : function ( data ) {
past_present_illness_data = $ . parseJSON ( data );
resolve ( past_present_illness_data );
},
error : function ( data ) {
reject ( data );
}
});
});
}
getpast_present_illness_data () . then (( past_present_illness_data ) => {
setTimeout ( function () {
var tag_input_to = $ ( '#past_present_illness_data' );
try {
tag_input_to . tag ({
placeholder : tag_input_to . attr ( 'placeholder' ),
source : past_present_illness_data
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#past_present_illness_data' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
var existingpast_present_illness_data =
" <?php echo getCommaSeperatedValuesForInClause('select param_name from history_parameter', 'param_id', $row_checkup['past_present_illness'] ) ?> "
if ( existingpast_present_illness_data != undefined &&
existingpast_present_illness_data != null &&
existingpast_present_illness_data != '' ) {
var existingpast_present_illness_dataArr =
existingpast_present_illness_data . split ( " , " );
jQuery . each ( existingpast_present_illness_dataArr , function ( i , val ) {
$tag_obj . add ( val . toUpperCase ());
});
}
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_to . after ( '<textarea id="' + tag_input_to . attr ( 'id' ) + '" name="' +
tag_input_to . attr (
'name' ) + '" rows="3">' + tag_input_to . val () + '</textarea>' )
. remove ();
//autosize($('#form-field-tags'));
}
$ ( " #SpinnerContainerIll " ) . hide ();
}, 100 );
}) . catch (( Error ) => {
BootstrapDialog . alert ( " Something went wrong while fetching the past present illness " +
Error . name );
})
}
/*past present illness tag fields end*/
/* habit tag field start */
if ( $ ( " #habits_data " )) {
var habit_data = new Array ();
function gethabit_data () {
return new Promise (( resolve , reject ) => {
$ . ajax ({
url : 'select_habit_data.php' ,
type : " GET " ,
success : function ( data ) {
habit_data = $ . parseJSON ( data );
resolve ( habit_data );
},
error : function ( data ) {
reject ( data );
}
});
});
}
}
gethabit_data () . then (( habit_data ) => {
setTimeout ( function () {
var tag_input_to = $ ( '#habits_data' );
try {
tag_input_to . tag ({
placeholder : tag_input_to . attr ( 'placeholder' ),
source : habit_data
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#habits_data' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
var existing_habit_data =
" <?php echo getCommaSeperatedValuesForInClause('select habit from habits', 'habit_id', $row_checkup['habit_ids'] ) ?> " ;
var present_habit_data = " <?php echo getHabitData( $emp_id ) ?> " ;
if (( existing_habit_data != undefined && existing_habit_data != null && existing_habit_data != '' ) || ( present_habit_data != undefined && present_habit_data != null && present_habit_data != '' )) {
console . log ( " habit raw data " , present_habit_data );
existing_habit_data = existing_habit_data . split ( " , " );
if ( present_habit_data != undefined && present_habit_data != null && present_habit_data != '' ) {
var present_habit_data_Arr = present_habit_data . split ( " , " );
jQuery . each ( present_habit_data_Arr , function ( i , val ) {
existing_habit_data . push ( val );
});
}
console . log ( " duplicate habit values " , existing_habit_data );
existing_habit_data = [ ... new Set ( existing_habit_data . map ( item => item . trim ()))];
console . log ( " unique habit values " , existing_habit_data );
// var existing_habit_dataArr =
// existing_habit_data.split(",");
jQuery . each ( existing_habit_data , function ( i , val ) {
if ( val != '' ) {
$tag_obj . add ( val );
}
});
}
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_to . after ( '<textarea id="' + tag_input_to . attr ( 'id' ) + '" name="' +
tag_input_to . attr (
'name' ) + '" rows="3">' + tag_input_to . val () + '</textarea>' )
. remove ();
//autosize($('#form-field-tags'));
}
$ ( " #SpinnerContainerHabit " ) . hide ();
}, 100 );
}) . catch (( Error ) => {
BootstrapDialog . alert ( " Something went wrong while fetching the habits " +
Error . name );
})
/* habit tag field end */
/*abnormality tag fields start*/
if ( $ ( " #abnormalities_data " )) {
var abnormalities_data = new Array ();
function getabnormalities_data () {
return new Promise (( resolve , reject ) => {
$ . ajax ({
url : 'select_abnormalities_data.php' ,
type : " GET " ,
success : function ( data ) {
abnormalities_data = $ . parseJSON ( data );
resolve ( abnormalities_data );
},
error : function ( data ) {
reject ( data );
}
});
})
}
getabnormalities_data () . then (( abnormalities_data ) => {
setTimeout ( function () {
var tag_input_to = $ ( '#abnormalities_data' );
try {
tag_input_to . tag ({
placeholder : tag_input_to . attr ( 'placeholder' ),
source : abnormalities_data
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#abnormalities_data' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
var presentChronicIllness = " <?php echo implode( " , " , getChronicIllness( $emp_id )) ?> "
if ( presentChronicIllness != undefined && presentChronicIllness != null && presentChronicIllness != '' ) {
var presentChronicIllnessArr = presentChronicIllness . split ( " , " );
jQuery . each ( presentChronicIllnessArr , function ( i , val ) {
existingabnormalities_data_Arr . push ( val );
});
}
console . log ( " duplicate chronic illness values " , existingabnormalities_data_Arr );
existingabnormalities_data_Arr = [ ... new Set ( existingabnormalities_data_Arr . map ( item => item . toUpperCase () . trim ()))];
console . log ( " unique chronic illness values " , existingabnormalities_data_Arr );
// var existingabnormalities_dataArr = existingabnormalities_data.split(",");
jQuery . each ( existingabnormalities_data_Arr , function ( i , val ) {
if ( val != '' ) {
$tag_obj . add ( val . toUpperCase ());
}
});
// }
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_to . after ( '<textarea id="' + tag_input_to . attr ( 'id' ) + '" name="' +
tag_input_to . attr (
'name' ) + '" rows="3">' + tag_input_to . val () + '</textarea>' )
. remove ();
//autosize($('#form-field-tags'));
}
$ ( " #SpinnerContainerAbnormality " ) . hide ();
}, 100 );
}) . catch (( Error ) => {
BootstrapDialog . alert ( " Something went wrong while fetching abnormality data " + Error . nama );
})
}
});
function getResult () {
return new Promise (( resolve , reject ) => {
$ . ajax ({
url : 'rule_eval.php' ,
type : " POST " ,
data : $ ( " #checkup_form_employee " ) . serialize (),
dataType : 'json' ,
success : function ( data ) {
try {
var abnormalities_data_array_2 = data [ 'result' ];
abnormalities_data_array = data [ 'data' ];
console . log ( " data array " + abnormalities_data_array );
for ( var key in abnormalities_data_array_2 ) {
if ( abnormalities_data_array_2 [ key ] != '' && abnormalities_data_array_2 [ key ] !=
null ) $ ( " # " + key ) . val ( abnormalities_data_array_2 [ key ]);
// alert(abnormalities_data_array_2[key]);
}
for ( let x of abnormalities_data_array ) {
// alert(x);
if ( x != " " ) {
existingabnormalities_data_Arr . push ( x );
}
}
resolve ({
abnormalities_data : abnormalities_data_array ,
generated_value : abnormalities_data_array_2
});
} catch ( error ) {
// console.error("Error: 'result' is not defined in the 'data' object.", error);
$ ( " #SpinnerContainerAbnormality " ) . hide ();
document . getElementById ( " forwardButton " ) . style . visibility = " visible " ;
document . getElementById ( " generateButton " ) . style . visibility = 'visible' ;
reject ( error );
}
},
error : function ( data ) {
$ ( " #SpinnerContainerAbnormality " ) . hide ();
document . getElementById ( " forwardButton " ) . style . visibility = " visible " ;
document . getElementById ( " generateButton " ) . style . visibility = 'visible' ;
reject ( data );
}
});
});
}
function rule_gen ( checkup_type_id ) {
console . log ( " checkup type id " + checkup_type_id );
$ ( " #SpinnerContainerAbnormality " ) . show ();
document . getElementById ( " generateButton " ) . style . visibility = 'hidden' ;
document . getElementById ( " forwardButton " ) . style . visibility = " hidden " ;
< ? php if ( $_SESSION [ 'RoleCode' ] == $__ROLE_LAB ) {
?>
BootstrapDialog . alert (
" Please Wait We are doing the calculations !! click ok and wait for save button to show up " );
< ? php } else { ?>
BootstrapDialog . alert (
" Please wait we are fetching the related abnormalities !! click ok and wait for save button to show up " );
< ? php } ?>
$ ( " #rule_param_id_onc " ) . val ( checkup_type_id );
getResult () . then (( data ) => {
if ( $ ( '#abnormalities_data' )) {
setTimeout ( function () {
var tag_input_to = $ ( '#abnormalities_data' );
try {
tag_input_to . tag ({
placeholder : tag_input_to . attr ( 'placeholder' ),
source : abnormalities_data
})
//programmatically add/remove a tag
var $tag_obj = $ ( '#abnormalities_data' ) . data ( 'tag' );
//$tag_obj.add('Programmatically Added');
// var existingabnormalities_data = "<?php echo getCommaSeperatedValuesForInClause('select param_name from history_parameter', 'param_id', $row_checkup['past_present_illness']) ?>"
// if (existingabnormalities_data != undefined && existingabnormalities_data != null && existingabnormalities_data != '') {
// var existingabnormalities_dataArr = existingabnormalities_data.split(",");
console . log ( " duplicate chronic illness values " , existingabnormalities_data_Arr );
existingabnormalities_data_Arr = [ ... new Set ( existingabnormalities_data_Arr . map ( item => item . toUpperCase () . trim ()))];
console . log ( " unique chronic illness values " , existingabnormalities_data_Arr );
jQuery . each ( existingabnormalities_data_Arr , function ( i , val ) {
$tag_obj . add ( val . toUpperCase ());
});
// }
//var index = $tag_obj.inValues('some tag');
// $tag_obj.remove(index);
} catch ( e ) {
//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
tag_input_to . after ( '<textarea id="' + tag_input_to . attr ( 'id' ) + '" name="' +
tag_input_to . attr ( 'name' ) + '" rows="3">' + tag_input_to . val () +
'</textarea>' ) . remove ();
//autosize($('#form-field-tags'));
}
// var y = $('#abnormalities_data').parents("td").width();
// $('#abnormalities_data').siblings().css('width', y - 3);
document . getElementById ( " forwardButton " ) . style . visibility = " visible " ;
document . getElementById ( " generateButton " ) . style . visibility = 'visible' ;
$ ( " #SpinnerContainerAbnormality " ) . hide ();
}, 100 );
}
return data . generated_value ;
}) . then (( generated_value ) => {
console . log ( " returned val " + generated_value );
if ( generated_value != null ) {
for ( let key in generated_value ) {
console . log ( " getting here in for " );
if ( generated_value . hasOwnProperty ( key )) {
console . log ( " getting here in for in if " );
console . log ( key + " : " + generated_value [ key ]);
checkRange ( generated_value [ key ], document . getElementById ( key ));
}
}
} else {
console . log ( " generated value is null. " );
}
})
. catch (( data ) => {
console . log ( data );
})
}
/*abnormalities tag fiels end*/
function autoLoadHeightWeightBmi (){
$ . ajax ({
type : 'post' ,
url : 'auto_populate_vital_for_checkup.php' ,
data : $ ( " #checkup_form_employee " ) . serialize (),
success : function ( data ) {
try {
if ( data !== null && data !== '' ) {
data = JSON . parse ( data );
var commaSeparatedValues = " " ;
for ( var key in data ) {
if ( $ ( " # " + key ) . length ){
var alreadyPresentData = $ ( " # " + key ) . val ();
if ( alreadyPresentData == null || alreadyPresentData == '' ) {
$ ( " # " + key ) . val ( data [ key ]);
commaSeparatedValues += key + " , " ;
}
} else {
console . log ( key + " is not present in form " );
}
}
commaSeparatedValues = commaSeparatedValues . replace ( / , \s * $ / , " " );
$ ( " #height_weight_bmi " ) . val ( commaSeparatedValues );
}
} catch ( error ) {
console . error ( " Error parsing JSON: " , error );
}
},
error : function ( data ) {
BootstrapDialog . alert ( " something went wrong while auto loading height weight bmi from patient profile " );
}
});
}
function getHealthIndex ( bp1 , bp2 , bmi , sugar , cholestrol ) {
var bp_score = 0 ;
var bmi_score = 0 ;
var sugar_score = 0 ;
var cholestrol_score = 0 ;
var total_score = 0 ;
// alert(bp1+" "+bp2+" "+bmi+" "+sugar+" "+cholestrol);
if ( bp1 > 140 && bp2 > 90 ) {
bp_score = 4 ;
} else if ( bp1 > 120 && bp1 < 140 && bp2 > 80 && bp2 < 90 ) {
bp_score = 2 ;
} else {
bp_score = 0 ;
}
if ( sugar > 200 ) {
sugar_score = 4 ;
} else if ( sugar > 139 && sugar < 200 ) {
sugar_score = 2 ;
} else {
sugar_score = 0 ;
}
if ( bmi > 30 ) {
bmi_score = 4 ;
} else if ( bmi > 25 && bmi < 30 ) {
bmi_score = 2 ;
} else {
bmi_score = 0 ;
}
if ( cholestrol > 240 ) {
cholestrol_score = 4 ;
} else if ( cholestrol > 200 && cholestrol < 240 ) {
cholestrol_score = 2 ;
} else {
cholestrol_score = 0 ;
}
total_score = bp_score + bmi_score + sugar_score + cholestrol_score ;
return total_score ;
}
function calHealthIndex () {
return new Promise (( res , rej ) => {
$ . ajax ({
type : 'post' ,
url : 'get_health_index.php' ,
data : $ ( " #checkup_form_employee " ) . serialize (),
success : function ( data ) {
// console.log("health index " + data);
res ( data );
},
error : function ( data ) {
rej ( data );
}
});
});
}
function validation_checkup_form ()
{
// if(!$('#attendedStatus').val()) {
// console.log('<?php echo $_SESSION["RoleCode"] ?>');
// if('<?php echo $_SESSION["RoleCode"] ?>'=='LAB') {
// $('#attendedStatus').attr('value','MDA');
// }elseif('<?php echo $_SESSION["RoleCode"] ?>'=='DOC') {
// $('#attendedStatus').attr('value','DRA');
// }elseif('<?php echo $_SESSION["RoleCode"] ?>'=='RCP') {
// $('#attendedStatus').attr('value','RCA');
// }
// }
// $('#attendedStatus').attr('value','MDP');
// console.log($('#attendedStatus').val());
var isLabCheckup = '<?= $isLabCheckup ?>' ;
if ( $ ( " #forward_status " ) . val () == 'DRP' ) {
if ( isLabCheckup !== 'Yes' ) {
var emptyParameterDataJSON = document . getElementById ( 'empty_parameter_data' ) . value ;
var emptyParameterData = JSON . parse ( emptyParameterDataJSON );
for ( var key in emptyParameterData ) {
if ( emptyParameterData . hasOwnProperty ( key )) {
var paramValue = document . getElementById ( key ) . value ;
if ( paramValue == null || paramValue === " " ) {
console . log ( " got inside emptyParameterData check " );
BootstrapDialog . alert ( `Please fill in all mandatory parameters with non-null and non-empty values before proceeding! ${emptyParameterData[key]} is empty` );
return false ;
}
}
}
}
}
if ( '<?php echo $_SESSION["RoleCode"] ?>' == 'LAB' ) {
if ( ! $ ( '#attendedStatus' ) . val ()) {
$ ( '#attendedStatus' ) . attr ( 'value' , 'MDA' );
}
}
if ( '<?php echo $_SESSION["RoleCode"] ?>' == 'ELAB' ) {
if ( ! $ ( '#attendedStatus' ) . val ()) {
$ ( '#attendedStatus' ) . attr ( 'value' , 'MRA' );
}
}
if ( '<?php echo $_SESSION["RoleCode"] ?>' == 'DOC' ) {
if ( ! $ ( '#attendedStatus' ) . val ()) {
$ ( '#attendedStatus' ) . attr ( 'value' , 'DRA' );
}
if ( $ ( '#fit_state' ) . val () == '' || $ ( '#fit_state' ) . val () == null ) {
BootstrapDialog . alert ( 'Please Select Fit Status' );
return ;
}
}
if ( '<?php echo $_SESSION["RoleCode"] ?>' == 'RCP' ) {
if ( ! $ ( '#attendedStatus' ) . val ()) {
$ ( '#attendedStatus' ) . attr ( 'value' , 'RCA' );
}
}
calHealthIndex () . then (( data ) => {
$ ( " #health_index " ) . val ( data );
save ();
}) . catch (( error ) => {
console . error ( " Error fetching health index: " , error );
save ();
});
}
jQuery ( function ( $ ) {
var checkup_id = " <?php echo $checkup_id ?> "
if ( checkup_id != '' )
if ( ! ace . vars [ 'old_ie' ]) $ ( '#checkdown_date' ) . datetimepicker ({
format : 'DD/MM/YYYY h:mm A' , //use this option to display seconds
defaultDate : new Date ( " <?= $row_checkup['checkup_date'] ?> " ),
maxDate : new Date (),
//minDate: new Date()-10,
icons : {
time : 'fa fa-clock-o' ,
date : 'fa fa-calendar' ,
up : 'fa fa-chevron-up' ,
down : 'fa fa-chevron-down' ,
previous : 'fa fa-chevron-left' ,
next : 'fa fa-chevron-right' ,
today : 'fa fa-arrows ' ,
clear : 'fa fa-trash' ,
close : 'fa fa-times'
}
}) . next () . on ( ace . click_event , function () {
$ ( this ) . prev () . focus ();
});
});
$ ( '.date-picker' ) . datepicker ({
autoclose : true ,
format : 'dd/mm/yyyy'
}) . next () . on ( ace . click_event , function () {
$ ( this ) . prev () . focus ();
});
checkup_id = < ? php echo $row_checkup [ 'checkup_id' ] ?> ;
get_checkup_sections_id ();
function get_checkup_sections_id () {
var check_section_ids = < ? php echo json_encode ( $check_section_ids ); ?>
var check_section_headers = < ? php echo json_encode ( $check_section_headers ); ?>
$ . ajax ({
url : 'get_checkup_section_ids.php' ,
type : " POST " ,
data : {
checkup_id : checkup_id
},
dataType : 'json' ,
success : function ( data ) {
var checkup_section_ids = data . checkup_section_ids ;
var checkup_section_ids_array = checkup_section_ids . split ( " , " );
for ( var j = 0 ; j < checkup_section_ids_array . length ; j ++ ) {
for ( var i = 0 ; i < check_section_ids . length ; i ++ ) {
if ( check_section_ids [ i ] == checkup_section_ids_array [ j ]) {
$ ( " # " + check_section_headers [ i ]) . prop ( " checked " , true );
$ ( " #pannel_ " + check_section_headers [ i ]) . show ();
break ;
}
}
}
},
error : function ( data ) {
return ;
}
});
$ ( '.close' ) . click ();
}
// function open_excel_pop_audiometry() {
// $('#modal-add-excel-audimetry').modal("show");
// }
// function open_excel_pop_pft() {
// //$("#modal-add-excel-pft").show();
// $('#modal-add-excel-pft').modal("show");
// }
// function open_document_pop_pft() {
// $('#modal-add-document-pft').modal("show");
// }
// function open_document_pop_audiometry() {
// $('#modal-add-document-audiometry').modal("show");
// }
/* $ ( '#frmExcelImportPft' ) . on ( 'click' , function (){
/* event.preventDefault(); */
// function frmExcelImportPft() {
// $.ajax({
// url: "upload_excel_pft_script.php",
// method: "POST",
// data: new FormData(document.getElementById("pft_form")),
// contentType: false,
// processData: false,
// success: function(data) {
// BootstrapDialog.alert('Upload Excel Saved Successfully ');
// getPftData();
// },
// error: function(data) {
// BootstrapDialog.alert('Error In Saving Upload Excel');
// }
// });
// $('#modal-add-excel-pft').modal("hide");
// }
// function getPftData() {
// $.ajax({
// url: "getPftData.php",
// method: "POST",
// data: {
// checkup_id: $('#checkup_id').val()
// },
// dataType: 'json',
// async: false,
// success: function(data) {
// if (data != null) {
// for (var i = 0; i < data.length; i++) {
// $("#" + data[i].checkup_form_key).val(data[i].checkup_form_value);
// }
// }
// },
// error: function(data) {}
// });
// }
// function getAudiometryDocument() {
// $.ajax({
// url: "getAudiometryDocument.php",
// method: "POST",
// data: {
// checkup_id: $('#checkup_id').val()
// },
// dataType: 'json',
// async: false,
// success: function(data) {
// var content = "";
// content = "<tr><td>" + data.medical_doc_desc + "</td><td>"
// content += "<img width=\"50\" height=\"50\" src = \"data:image/jpeg;base64," + data
// .medical_doc + "\" alt = \"new image\" onclick=\"image(this)\" /></td></tr>"
// $("#audiometry tbody").append(content);
// },
// error: function(data) {}
// });
// }
// function getAudiometryData() {
// $.ajax({
// url: "getAudiometryData.php",
// method: "POST",
// data: {
// checkup_id: $('#checkup_id').val()
// },
// dataType: 'json',
// async: false,
// success: function(data) {
// if (data != null) {
// for (var i = 0; i < data.length; i++) {
// $("#" + data[i].checkup_form_key).val(data[i].checkup_form_value);
// }
// }
// },
// error: function(data) {}
// });
// }
// function getPftDocument() {
// $.ajax({
// url: "getPftDocument.php",
// method: "POST",
// data: {
// checkup_id: $('#checkup_id').val()
// },
// dataType: 'json',
// async: false,
// success: function(data) {
// var content = "";
// content = "<tr><td>" + data.medical_doc_desc + "</td><td>"
// content += "<img width=\"50\" height=\"50\" src = \"data:image/jpeg;base64," + data
// .medical_doc + "\" alt = \"new image\" onclick=\"image(this)\" /></td></tr>"
// $("#pft tbody").append(content);
// },
// error: function(data) {}
// });
// }
/* $ ( '#frmExcelImportAudiometry' ) . on ( 'submit' , function ( event ){
event . preventDefault (); */
// function frmExcelImportAudiometry() {
// $.ajax({
// url: "upload_excel_audiometry_script.php",
// method: "POST",
// data: new FormData(document.getElementById("audiometry_form")),
// contentType: false,
// processData: false,
// success: function(data) {
// BootstrapDialog.alert('Upload Excel Saved Successfully ');
// getAudiometryData();
// },
// error: function(data) {
// BootstrapDialog.alert('Error In Saving Upload Excel');
// }
// });
// $('#modal-add-excel-audimetry').modal("hide");
// }
// function save_pft_doc() {
// $.ajax({
// url: "save_medical_doc.php",
// method: "POST",
// data: new FormData(document.getElementById("document_pft_form")),
// contentType: false,
// processData: false,
// success: function(data) {
// BootstrapDialog.alert('Upload Excel Saved Successfully ');
// getPftData();
// getPftDocument();
// },
// error: function(data) {
// BootstrapDialog.alert('Error In Saving Upload Excel');
// }
// });
// }
// function save_audiometry_doc() {
// $.ajax({
// url: "save_medical_audiometry_doc.php",
// method: "POST",
// data: new FormData(document.getElementById("document_audiometry_form")),
// contentType: false,
// processData: false,
// success: function(data) {
// BootstrapDialog.alert('Upload Excel Saved Successfully ');
// getAudiometryData();
// getAudiometryDocument();
// },
// error: function(data) {
// BootstrapDialog.alert('Error In Saving Upload Excel');
// }
// });
// }
</ script >
<!--
< script src = " sign_script.js " ></ script > -->
< style >
#modal-add-excel-pft {
overflow - y : scroll ;
}
</ style >
<!-- < div class = " modal fade " id = " modal-add-excel-pft " name = " modal-add-excel-pft " role = " dialog " aria - hidden = " true " >
< form role = " form " id = " pft_form " name = " pft_form " action = " # " method = " post " >
< div class = " modal-dialog " >
< div class = " modal-content " >
< div class = " widget-header " >
< h5 class = " widget-title " > Upload Excel For PFT Parameter </ h5 >
< div class = " widget-toolbar " >
< div class = " widget-menu " >
</ div >
</ div >
</ div >
< div class = " modal-body " >
< form action = " " method = " post " name = " frmExcelImport " id = " frmExcelImport "
enctype = " multipart/form-data " >
< div class = " form-group " >
< div class = " col-xs-3 " >
</ div >
< div class = " col-xs-6 " >
< input type = " file " id = " id-input-file-2 " name = " file " accept = " .xls,.xlsx " />
</ div >
< input type = " hidden " name = " checkup_id_pft " id = " checkup_id_pft "
value = " <?php echo $checkup_id ; ?> " >
</ div >
</ div >
< div class = " widget-toolbox padding-8 clearfix " >
< button type = " button " onclick = " frmExcelImportPft() " class = " btn btn-info btn-sm save_button " >< i
class = " ace-icon fa fa-floppy-o bigger-110 " ></ i > Upload </ button >
< button type = " button " class = " btn btn-danger btn-sm " data - dismiss = " modal " >< i
class = " ace-icon fa fa-times bigger-110 " ></ i > Cancel </ button >
</ div >
</ div >
</ div >
</ form >
</ div > -->
< style >
#modal-add-excel-audimetry {
overflow - y : scroll ;
}
</ style >
<!-- < div class = " modal fade " id = " modal-add-excel-audimetry " name = " modal-add-excel-audimetry " role = " dialog "
aria - hidden = " true " >
< form role = " form " id = " audiometry_form " name = " audiometry_form " action = " # " method = " post " >
< div class = " modal-dialog " >
< div class = " modal-content " >
< div class = " widget-header " >
< h5 class = " widget-title " > Upload Excel For Audiometry Parameter </ h5 >
< div class = " widget-toolbar " >
< div class = " widget-menu " >
</ div >
</ div >
</ div >
< div class = " modal-body " >
< form action = " " method = " post " name = " frmExcelImport_audio " id = " frmExcelImport_audio "
enctype = " multipart/form-data " >
< div class = " form-group " >
< div class = " col-xs-3 " >
</ div >
< div class = " col-xs-6 " >
< input type = " file " id = " id-input-file-2 " name = " file " />
</ div >
< input type = " hidden " name = " checkup_id_audiometry " id = " checkup_id_audiometry "
value = " <?php echo $checkup_id ; ?> " >
</ div >
</ div >
< div class = " widget-toolbox padding-8 clearfix " >
< button type = " button " onclick = " frmExcelImportAudiometry() "
class = " btn btn-info btn-sm save_button " >< i class = " ace-icon fa fa-floppy-o bigger-110 " ></ i > Upload
</ button >
< button type = " button " class = " btn btn-danger btn-sm " data - dismiss = " modal " >< i
class = " ace-icon fa fa-times bigger-110 " ></ i > Cancel </ button >
</ div >
</ div >
</ div >
</ form >
</ div > -->
< style >
#modal-add-document-pft {
overflow - y : scroll ;
}
img {
max - width : 100 % ;
height : auto ;
width : auto\9 ;
/* ie8 */
}
</ style >
<!-- < div class = " modal fade " id = " modal-add-document-pft " name = " modal-add-document-pft " role = " dialog " aria - hidden = " true " >
< form role = " form " id = " document_pft_form " name = " document_pft_form " enctype = " multipart/form-data " action = " # "
method = " post " >
< div class = " modal-dialog " >
< div class = " modal-content " >
< div class = " widget-header " >
< h5 class = " widget-title " > Upload Document For PFT Parameter </ h5 >
< div class = " widget-toolbar " >
< div class = " widget-menu " >
</ div >
</ div >
</ div >
< div class = " modal-body " >
< div class = " row " >
< div class = " col-xs-3 " >
</ div >
< div class = " col-xs-6 " >
< input type = " text " style = " width:100% " placeholder = " Enter Document Name "
id = " document_name_pft " name = " document_name_pft " />
</ div >
</ div >
< div class = " row " style = " margin-top: 10px " >
< div class = " form-group " >
< div class = " col-xs-3 " >
</ div >
< div class = " col-xs-6 " >
< input type = " file " id = " id-input-file-2 " name = " file_pft_doc " />
</ div >
< input type = " hidden " name = " checkup_id_pft_doc " id = " checkup_id_pft_doc "
value = " <?php echo $checkup_id ; ?> " >
< input type = " hidden " name = " pft_header_id " id = " pft_header_id "
value = " <?php echo $checkup_id ; ?> " >
</ div >
</ div >
</ div >
< div class = " widget-toolbox padding-8 clearfix " >
< button type = " button " onclick = " save_pft_doc() " class = " btn btn-info btn-sm save_button " >< i
class = " ace-icon fa fa-floppy-o bigger-110 " ></ i > Upload </ button >
< button type = " button " class = " btn btn-danger btn-sm " data - dismiss = " modal " >< i
class = " ace-icon fa fa-times bigger-110 " ></ i > Cancel </ button >
</ div >
</ div >
</ div >
</ form >
</ div > -->
< style >
#modal-add-document-audiometry {
overflow - y : scroll ;
}
img {
max - width : 100 % ;
height : auto ;
width : auto\9 ;
/* ie8 */
}
</ style >
<!-- < div class = " modal fade " id = " modal-add-document-audiometry " name = " modal-add-document-audiometry " role = " dialog "
aria - hidden = " true " >
< form role = " form " id = " document_audiometry_form " name = " document_audiometry_form " enctype = " multipart/form-data "
action = " # " method = " post " >
< div class = " modal-dialog " >
< div class = " modal-content " >
< div class = " widget-header " >
< h5 class = " widget-title " > Upload Document For audiometry Parameter </ h5 >
< div class = " widget-toolbar " >
< div class = " widget-menu " >
</ div >
</ div >
</ div >
< div class = " modal-body " >
< div class = " row " >
< div class = " col-xs-3 " >
</ div >
< div class = " col-xs-6 " >
< input type = " text " style = " width:100% " placeholder = " Enter Document Name "
id = " document_name_audiometry " name = " document_name_audiometry " />
</ div >
</ div >
< div class = " row " style = " margin-top: 10px " >
< div class = " form-group " >
< div class = " col-xs-3 " >
</ div >
< div class = " col-xs-6 " >
< div class = " form-group " >
< input type = " file " id = " id-input-file-2 " name = " file_audiometry_doc " />
</ div >
< input type = " hidden " name = " checkup_id_audiometry_doc " id = " checkup_id_audiometry_doc "
value = " <?php echo $checkup_id ; ?> " >
< input type = " hidden " name = " audiometry_header_id " id = " audiometry_header_id "
value = " <?php echo $checkup_id ; ?> " >
</ div >
</ div >
</ div >
</ div >
< div class = " widget-toolbox padding-8 clearfix " >
< button type = " button " onclick = " save_audiometry_doc() " class = " btn btn-info btn-sm save_button " >< i
class = " ace-icon fa fa-floppy-o bigger-110 " ></ i > Upload </ button >
< button type = " button " class = " btn btn-danger btn-sm " data - dismiss = " modal " >< i
class = " ace-icon fa fa-times bigger-110 " ></ i > Cancel </ button >
</ div >
</ div >
</ div >
</ form >
</ div > -->
<!-- < ? php include 'support_checkup_document.php' ?> -->
<!-- < ? php include 'image_popup_checkup.php' ?> -->
< ? php include 'form/upload_checkup_sec_doc.php' ?>
< script >
//body > table > tbody > tr:nth-child(1) {width: 50px}
//body > table > tbody > tr:nth-child(3) {width: 0px}
//body > table > tbody > tr:nth-child(1) > th:nth-child(1)
// function createPDF(n) {
// var no_tbls = <?php echo json_encode($tbl_count, JSON_HEX_TAG); ?>;
// var tbl_names = <?php echo json_encode($tbl_names, JSON_HEX_TAG); ?>;
// // console.log(tbl_names);
// var style = "<style>h2 {text-align: center}";
// style = style + "table {width: 100%;font: 17px Calibri;height: 100%}";
// style = style + "table, th, td {border: solid 1px #DDD; border-collapse: collapse;";
// style = style + "padding: 2px 3px;text-align: center;}";
// style = style + "th, td{min-width:10%}";
// style = style + "th, td{min-width:10%;text-align:left}";
// style = style + "</style>";
// var win = window.open('', '', 'height=700,width=1200');
// win.document.write('<html><head>');
// win.document.write('<title>Profile</title>');
// win.document.write(style);
// win.document.write('</head>');
// win.document.write('<body>');
// for (var i = 1; i <= no_tbls; i++) {
// // console.log("for : "+i);
// // var sTable = "<table>"+document.getElementById('tab'+i).innerHTML+"</table><br>";
// // CREATE A WINDOW OBJECT.
// // <title> FOR PDF HEADER.
// // ADD STYLE INSIDE THE HEAD TAG.
// // win.document.write(sTable); // THE TABLE CONTENTS INSIDE THE BODY TAG.
// var sTable = "<h2>" + tbl_names[i - 1].replaceAll("_", " ").toUpperCase() + "</h2><br>";
// // console.log(tbl_names[i-1]);
// sTable += "<table>" + document.getElementById('tab' + i).innerHTML + "</table><br>";
// win.document.write(sTable);
// }
// win.document.write('</body></html>');
// win.document.close(); // CLOSE THE CURRENT WINDOW.
// win.print(); // PRINT THE CONTENTS.
// win.document.close();
// }
// function createIndividualPDF(n) {
// var no_tbls = <?php echo json_encode($tbl_count, JSON_HEX_TAG); ?>;
// var tbl_names = <?php echo json_encode($tbl_names, JSON_HEX_TAG); ?>;
// // console.log(tbl_names);
// var style = "<style>h2 {text-align: center}";
// style = style + "table {width: 100%;font: 17px Calibri;height: 100%}";
// style = style + "table, th, td {border: solid 1px #DDD; border-collapse: collapse;";
// style = style + "padding: 2px 3px;text-align: center;}";
// style = style + "th, td{min-width:10%}";
// style = style + "th, td{min-width:10%;text-align:left}";
// style = style + "</style>";
// var win = window.open('', '', 'height=700,width=1200');
// win.document.write('<html><head>');
// win.document.write('<title>Profile</title>');
// win.document.write(style);
// win.document.write('</head>');
// win.document.write('<body>');
// var sTable = "<h2>" + tbl_names[n - 1].replaceAll("_", " ").toUpperCase() + "</h2><br>";
// sTable += "<table>" + document.getElementById('tab' + n).innerHTML + "</table><br>";
// win.document.write(sTable);
// win.document.write('</body></html>');
// win.document.close(); // CLOSE THE CURRENT WINDOW.
// win.print(); // PRINT THE CONTENTS.
// win.document.close();
// }
function upload_section_doc ( secId , secName ) {
// alert(secName);
$ ( '#up_sec_id' ) . val ( secId );
$ ( '#up_sec_name' ) . val ( secName );
$ ( '#modal-add-section-document' ) . modal ( " show " );
}
function downloadFile ( docURLString ) {
var string = doc . output ( docURLString );
var iframe = " <iframe width='100%' height='100%' src=' " + string + " '></iframe> "
var x = window . open ();
x . document . open ();
x . document . write ( iframe );
x . document . close ();
}
</ script >