<?php

$optical_info = mysql_fetch_assoc(mysql_query("SELECT * FROM optical_examination WHERE process_claim_no ='$process_claim_no'", $courier));

$query_rsodest_claim_no = "select * from process_claim_no where process_claim_no='$process_claim_no'";

$rsodest_claim_no = mysql_query($query_rsodest_claim_no, $courier) or die(mysql_error());

$row_rsodest_claim_no = mysql_fetch_assoc($rsodest_claim_no);

$totalRows_rsodest_claim_no = mysql_num_rows($rsodest_claim_no);

$mode_of_payment = $row_rsodest_claim_no['mode_of_payment'];

$patient_no = $row_rsodest_claim_no['patient_no'];

 /////////////////////////////Get Patient No ////////////////////////////////////////////////////
 //echo"SELECT * FROM patient_information WHERE card_number ='$patient_no'";
$patient_info = mysql_fetch_assoc(mysql_query("SELECT * FROM patient_information WHERE card_number ='$patient_no'", $courier));
$patientID = $patient_info['id'];
$patientDOB = $patient_info['dateofbirth'];
$occupation = $patient_info['occupation'];
$pdob = strtotime($patientDOB);
// if (!$pdob || $pdob < 0 ) {
//     echo "empty";
// }else{
//     echo $pdob;
// }
?>
<input type="hidden" name="hiddenDOB" id="hiddenDOB" value="<?php echo $pdob ?>">
<input type="hidden" name="hiddenID" id="hiddenID" value="<?php echo $patientID ?>">
<input type="hidden" name="occupation" id="occupation" value="<?php echo $occupation ?>">

<input type="hidden" name="patient_no" id="patient_no" value="<?php echo $patient_no ?>">
<input type="hidden" name="process_claim_no" id="process_claim_no" value="<?php echo $process_claim_no ?>">
<div id="success_error_info_display_dob"></div>
<div class="portlet light bordered" style="display: none;">

 <div class="portlet-title">

  <div style="cursor:pointer;" class="caption" onclick="$('#click_show_symptoms').trigger('click');">

   <i class="fa fa-bolt font-blue-hoki"></i>

   <span class="caption-subject bold font-blue-hoki"> Optical Examination </span>

 </div>

 <div class="tools">

   <a id="click_show_symptoms" href="" class="collapse" data-original-title="" title=""> </a>

 </div>

</div>

<div class="portlet-body">

  <div class="row">

   <div class="col-md-12 ">

    <div class="portlet light bordered">

<!--            <div class="portlet-title">

                <div class="caption">

                    <i class="fa fa-bolt font-blue-hoki"></i>

                    <span class="caption-subject bold font-blue-hoki"> Client Presenting Complaints (PC) </span>

                </div>

                <div class="portlet-body">

                    <input type="hidden" name="process_claim_no" id="process_claim_no" value="<?php echo $process_claim_no; ?>">

                    <textarea style="min-height:125px" name="patients_complaint" id="patients_complaint" class="form-control"><?php echo $optical_info['patient_complaints']; ?></textarea>

                </div>

              </div>-->



              <div class="portlet-title">

                <div style="cursor:pointer;" class="caption" onclick="$('#click_show_drawing').trigger('click');$('#paint_toggler').trigger('click');$('#paint_toggler').trigger('click');">

                 <span class="caption-subject bold font-blue-hoki"> Medical History </span>

               </div>

               <div class="tools">

                 <a id="click_show_drawing" href="" class="collapse" data-original-title="" title=""> </a>

               </div>

             </div>

             <div class="portlet-body" style="display: block;">
              <div class="row">
               <div class="col-md-4" style="">

                <input type="checkbox" name="Hypertension" value="Hypertension" id="Hypertension" onclick="getstep('Hypertension', '<?php echo $process_claim_no.'@@@'.'Hypertension' ?>', this.value)">
                <label>Hypertension</label><br>


                <input type="checkbox" name="Diabetes_Mellitus" value="Diabetes Mellitus" id="Diabetes_Mellitus" onclick="getstep('Diabetes_Mellitus', '<?php echo $process_claim_no.'@@@'.'Diabetes_Mellitus' ?>', this.value)"> 
                <label>Diabetes Mellitus</label>
              </div>

              <div class="col-md-4" style="">
                <input type="checkbox" name="Sicle_Cell_Disease" value="Sicle Cell Disease" id="Sicle_Cell_Disease" onclick="getstep('Sicle_Cell_Disease', '<?php echo $process_claim_no.'@@@'.'Sicle_Cell_Disease' ?>', this.value)">
                <label>Sicle Cell Disease</label><br>


                <input type="checkbox" name="Asthma" value="Asthma" id="Asthma" onclick="getstep('Asthma', '<?php echo $process_claim_no.'@@@'.'Asthma' ?>', this.value)">
                <label>Asthma</label>
              </div>

              <div class="col-md-4" style="">

                <input type="checkbox" name="Hyperlipidemia" value="Hyperlipidemia" id="Hyperlipidemia" onclick="getstep('Hyperlipidemia', '<?php echo $process_claim_no.'@@@'.'Hyperlipidemia' ?>', this.value)">
                <label>Hyperlipidemia</label><br>

                <input type="checkbox" name="OtherHistory" value="Other" id="OtherHistory34" onclick="showOthers('OtherHistory34','medical_consulation_type');">
                <label>Other </label> 


              </div>
              <br>
              <br>

              <textarea name="OtherHistory12" id="OtherHistory" class="form-control" row="3" style="height:150px; display: none;" placeholder="Medical/Consultation Note"><?php echo $Other ?></textarea>

            </div>    

          </div>



        </div>

      </div> 
 </div>

</div>

</div>


<div class="modal fade bs-modal-sm" id="DonateModal" tabindex="-1" role="dialog" aria-hidden="true">
  <div id="group_data"></div>
</div>



<script type="text/javascript">

  function getoccupation(){
   var occupation = $('#occupation').val();
   var hiddenID = $('#hiddenID').val();
   if (occupation == '') {
    $.ajax({
     url:'consultation/getModal.php',
     method:'post',
     data:{
      hiddenID:hiddenID,
      act:'occupation'
    },
    success:function(data){
      $('#group_data').html(data);
      $('#DonateModal').modal('show');
    }
  });
  }
}

function getdateofbirth(){
 var patientDOB = $('#hiddenDOB').val();
 var hiddenID = $('#hiddenID').val();
 if (patientDOB == '') {
  $.ajax({
   url:'consultation/getModal.php',
   method:'post',
   data:{
    hiddenID:hiddenID,
    act:'dob'
  },
  success:function(data){
    $('#group_data').html(data);
    $('#DonateModal').modal('show');
  }
});
}
}

function getdateofbirthandoccupation(){
 var occupation = $('#occupation').val();
 var patientDOB = $('#hiddenDOB').val();
 var hiddenID = $('#hiddenID').val();
 if (patientDOB == '' && occupation == '') {
  $.ajax({
   url:'consultation/getModal.php',
   method:'post',
   data:{
    hiddenID:hiddenID,
    act:'dobandoccupation'
  },
  success:function(data){
    $('#group_data').html(data);
    $('#DonateModal').modal('show');
  }
});
}
}


$(document).ready(function(){
 var patientDOB = $('#hiddenDOB').val();
 var occupation = $('#occupation').val();

 if (occupation == '' && patientDOB == ''){
  getdateofbirthandoccupation();
}else if(occupation == '' && patientDOB != ''){
  getoccupation();
}else if (patientDOB == '' && occupation != ''){
  getdateofbirth();
}






$('#lightgallery').lightGallery({

  cssEasing: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)'

});



$('#lightgallery2').lightGallery({

  cssEasing: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)'

});

});



var images = [

'uploads/wPaint.png',

];



function saveImg(image) {

 var _this = this;

 var tag = $('#drawing_name').val();

 $.ajax({

  type: 'POST',

  url: 'getstep.php',

  data: {image: image,act: 'save_drawing',tag: tag,type: 'consultation',patient_details: '<?php echo $medical_note_id . '@@@' . $process_claim_no; ?>'},

  success: function (msg) {

   _this._displayStatus('<span style="color:#000000;font-size:15px">Medical Note Successfully Saved <span>');

   $('#consultation_drawing_wrapper').html(msg);

 }

});

}



function saveImg2(image) {

 var _this = this;

 var tag = $('#drawing_name').val();

 $.ajax({

  type: 'POST',

  url: 'getstep.php',

  data: {image: image,act: 'save_drawing2',tag: tag,type: 'additional_comment',patient_details: '<?php echo $medical_note_id . '@@@' . $process_claim_no; ?>'},

  success: function (msg) {

   _this._displayStatus('<span style="color:#000000;font-size:15px"> Successfully Saved <span>');

   $('#consultation_drawing_wrapper2').html(msg);

 }

});

}



        // init wPaint

        $('#wPaint').wPaint({

         menuOffsetLeft: 130,

         menuOffsetTop: 0,

         bg: '#FFFFFF',

         lineWidth:   '1',

         strokeStyle: '#000000',

         saveImg: saveImg

       });

        

        $('#wPaint2').wPaint({

         menuOffsetLeft: 130,

         menuOffsetTop: 0,

         bg: '#FFFFFF',

         lineWidth:   '1',

         strokeStyle: '#000000',

         saveImg: saveImg2

       });

     </script>

