    <?php
        $rightto = DB::table('patient')
        //->leftjoin('dd_righttotreatment','dd_righttotreatment.id','patient.righttotreatment')
        ->where('patient.hn',$casedata->case_hn)->first();
        $ward = "-";
        $refer= "-";
        if(isset($this_json->ward)){
            if($this_json->ward != ''){
                $ward = $this_json->ward;
            }
        }
        if(isset($this_json->refer)){
            if($this_json->refer != ''){
                $refer = $this_json->refer;
            }
        }
    ?>

    <?php
        $user_list = DB::table('users')->where('id',"999999999")->get();
        if(isset($json->user_in_case)){
            $lists = json_decode($json->user_in_case);
            $user_list = DB::table('users')->whereIn('id',$lists)->get();
        }
        $no_doctor  = true;
        $no_nurse   = true;
        $no_anes    = true;
    ?>

    <table align="center" width="100%">
        <tr style="line-height: 14px">
            <td align="center" width="90px" style="padding-left: 1em;">
                <img src="<?php echo e(fileconfig($hospital->hospital_pic)); ?>" height="60px" >
            </td>
            <td width="10"></td>
            <td>
                <table border="0">
                    <tr>
                        <td class="pdfhead"><?php echo e($hospital->hospital_name); ?></td>
                    </tr>
                    <tr style="line-height: 8px !important">
                        <td class="pdfhead"><?php echo e($hospital->hospital_address); ?></td>
                    </tr>
                    <tr style="line-height: 8px !important">
                        <td class="pdfhead">Tel : <?php echo e($hospital->hospital_tel); ?></td>
                    </tr>
                </table>
            </td>
            <td width="10"></td>
            <td align="right" width="220px" style="line-height:25px;padding-right:1em;">
                <font size="14">
                    <b style="font-size:20px;">Procedure Report</b>
                    <b style="font-size:20px;color:<?php echo e(@$casedata->procedure_color); ?>"><br><?php echo e(@$casedata->procedure_name); ?></br>
                </font>
            </td>
        </tr>
    </table>
    
    <table width="100%" border="0" style="border-bottom: 1px solid gray;border-top: 1px solid gray;">
        <tr  style="line-height: 7px !important">
            <td style="vertical-align: middle;height:12px;padding-left:2em;" width="400px" class="pdfhead"><b>PATIENT NAME :</b><font color="#48494b"><?php echo e($casedata->prefix.$casedata->firstname." ".$casedata->lastname); ?></font></td>
            
            <td style="vertical-align: middle;height:12px;padding-left:2em;" class="pdfhead">
                <b>HN :</b> <?php echo e(@$casedata->hn); ?> &nbsp;&nbsp;&nbsp;&nbsp;
                <?php if(isset($json->an)): ?>
                <b>AN :</b> <?php echo e($json->an); ?> &nbsp;&nbsp;&nbsp;&nbsp;
                <?php endif; ?>
                <b>Ward :</b><font color="#48494b"><?php echo e(@$json->ward != null ? @$json->ward:'-'); ?></font>
            </td>
        </tr>
        <tr style="line-height: 7px !important">
            <td  style="vertical-align: middle;height:12px;padding-left:2em;"   class="pdfhead" width="400px" class="pdfhead"><b>GENDER :</b> <font color="#48494b"><?php echo e(@$casedata->gender_name); ?>&nbsp;&nbsp;&nbsp;<b>Age :</b> <font color="#48494b"><?php echo e(age($casedata->birthdate)); ?></font></td>
            <td  style="vertical-align: middle;height:12px;padding-left:2em;"   class="pdfhead"><b>RIGHT TO TREATMENT :</b><font color="#48494b"><?php echo e(@$json->righttotreatment); ?></font></td>
        </tr>
        <tr style="line-height: 7px !important">
            <td style="vertical-align: middle;height:12px;padding-left:2em;"    class="pdfhead" width="400px"><b>DATE OF PROCEDURE :</b> <font color="#48494b"><?php echo e(swapDATE($casedata->case_dateappointment)); ?></font></td>
            <td style="vertical-align: middle;height:12px;padding-left:2em;" class="pdfhead">
                <b>
                    OPERATION TIME :
                </b>
                <font color="#48494b">
                    <?php if(isset($json->start_time) && isset($json->end_time)): ?>
                    <?php
                        $start_date = new DateTime($json->start_time);
                        $since_start = $start_date->diff(new DateTime($json->end_time));
                    ?>
                        <font color="#48494b"><?php echo e(substr($json->start_time,0,-3)); ?> - <?php echo e(substr($json->end_time,0,-3)); ?> (<?php echo e($since_start->i); ?>)</font>
                    <?php else: ?>
                        &nbsp;-
                    <?php endif; ?>


                    

                </font>
            </td>
        </tr>
        <tr style="line-height: 7px !important">
            <td style="vertical-align: middle;height:12px;padding-left:2em;"  class="pdfhead">
                <b>
                    ENDOSCOPIST :
                </b>

                <font color="#48494b">
                    <?php echo e($doctor[1]); ?>

                </font>
            </td>
            <td  style="vertical-align: top;padding-left:2em;" class="pdfhead">
                <b>ENDOSCOPE :</b>
                <font color="#48494b" class="pdfhead">
                    <?php $__currentLoopData = $scopeall; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $scope): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php echo e($scope); ?>

                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </font>
            </td>
        </tr>
        <tr style="line-height: 7px !important" valign="top">
            <td style="vertical-align: middle;height:12px;padding-left:2em;"  class="pdfhead"><b>CONSULTANT :</b>
                <font color="#48494b" class="pdfhead">
                    <?php $__currentLoopData = $user_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if($user->user_type=="doctor"): ?>
                            <?php echo e($user->user_prefix); ?><?php echo e($user->user_firstname); ?> <?php echo e($user->user_lastname); ?><br>
                            <?php
                                $no_doctor = false;
                            ?>
                        <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    <?php if($no_doctor): ?>
                        N/A
                    <?php endif; ?>
                </font>
            </td>
            <td style="vertical-align: top;height:12px;padding-left:2em;" class="pdfhead">
                <b>POSITION :</b>
                <?php if(isset($json->position)): ?>
                    <font color="#48494b" class="pdfhead">
                        <?php echo e($json->position); ?>

                    </font>
                <?php endif; ?>
            </td>
        </tr>
        <tr style="line-height: 7px !important;">
            <td style="vertical-align: middle;height:12px;padding-left:2em;" class="pdfhead"><b>NURSE, ASSIST :</b>
                <font color="#48494b" class="pdfhead">
                    <?php $__currentLoopData = $user_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if($user->user_type=="nurse"): ?>
                            <?php echo e($user->user_prefix); ?><?php echo e($user->user_firstname); ?> <?php echo e($user->user_lastname); ?><br>
                            <?php
                                $no_nurse = false;
                            ?>
                        <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    <?php if(isset($json->assistant)): ?>
                        <br><?php echo e($json->assistant); ?>

                    <?php endif; ?>

                    <?php if($no_nurse): ?>
                        N/A
                    <?php endif; ?>
                </font>
            </td>
            <td style="vertical-align: top;height:12px;padding-left:2em;" class="pdfhead"><b>ANESTHESIST : </b>
                <font color="#48494b" class="pdfhead">
                    <?php $__currentLoopData = $user_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if($user->user_type=="anes"): ?>
                            <?php echo e($user->user_prefix); ?><?php echo e($user->user_firstname); ?> <?php echo e($user->user_lastname); ?><br>
                            <?php
                                $no_anes = false;
                            ?>
                        <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                    <?php $__currentLoopData = $user_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php if($user->user_type=="nurse_anes"): ?>
                            <?php echo e($user->user_prefix); ?><?php echo e($user->user_firstname); ?> <?php echo e($user->user_lastname); ?><br>
                            <?php
                                $no_anes = false;
                            ?>
                        <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>



                    <?php if($no_anes): ?>
                        N/A
                    <?php endif; ?>
                </font>
            </td>
        </tr>
    </table>
<?php /**PATH D:\laragon\htdocs\config\views/pdfhead/screening//pdf_head01.blade.php ENDPATH**/ ?>