2024-12-25 03:04:59 +00:00
< ? php
use common\models\ApproveStatus ;
use common\models\AutopsyDiagnosis ;
use common\models\CenterApprove ;
use yii\bootstrap5\ActiveForm ;
use yii\data\ActiveDataProvider ;
use yii\grid\GridView ;
use yii\helpers\Html ;
$this -> title = 'Autopsy Case: ' . $case_autopsy -> id_case ;
$this -> params [ 'breadcrumbs' ][] = $this -> title ;
?>
< div class = " card md-4 " >
< div class = " card-body " >
< div class = " common-action md-4 " >
< ? = Html :: a ( '<i class="ri-contrast-drop-line"></i> สั่งย้อมพิเศษ' , [ '/pathologist/order/staining' , 'id_case' => $case_autopsy -> id_case ], [ 'class' => 'btn btn-primary' , 'target' => '_blank' ]) ?>
2025-01-21 02:56:57 +00:00
< ? php // Html::a('<i class="ri-chat-1-line"></i> สอบถามเพิ่มเติม', ['/pathologist/order/chat', 'id_case' => $case_autopsy->id_case], ['class' => 'btn btn-warning', 'target' => '_blank']) ?>
2024-12-25 03:04:59 +00:00
< ? php // Html::a('<i class="ri-question-answer-line"></i> Remark Report', ['/pathologist/order/remark-report', 'id_case' => $case_autopsy->id_case], ['class' => 'btn btn-block btn-info', 'target' => '_blank'])
?>
< ? php // Html::a('<i class="fa fa-commenting-o"></i> Consult', ['/pathologist/order/autopsy-consult', 'id_case' => $case_autopsy->id_case], ['class' => 'btn btn-info', 'target' => '_blank'])
?>
< ? php /*
$approve_final = CenterApprove :: find ()
-> andFilterWhere ([
'report_type' => 'preliminary' ,
'id_case' => $case_autopsy -> id_case ,
'approve_status' => 4
]) -> orWhere ([
'report_type' => 'final' ,
'id_case' => $case_autopsy -> id_case ,
'approve_status' => 4
])
-> one (); ?>
< ? php if ( $approve_final ) { ?>
< ? = Html :: a ( '<i class="fa fa-comment" aria-hidden="true"></i> Consult' , [ '/pathologist/order/autopsy-consult' , 'id_case' => $case_autopsy -> id_case ], [ 'class' => 'btn btn-info' ]) ?>
< ? php } */ ?>
</ div >
< br />
< div class = " report-action " >
< ? = Html :: a ( '<i class="ri-file-text-line"></i> Preliminary Report' , [ '/pathologist/do/autopsy-preliminary' , 'id_case' => $case_autopsy -> id_case , 'type' => 'preliminary' ], [ 'class' => 'btn btn-info' ]) ?>
< ? = Html :: a ( '<i class="ri-file-text-line"></i> Final Report' , [ '/pathologist/do/autopsy-final' , 'id_case' => $case_autopsy -> id_case , 'type' => 'final' ], [ 'class' => 'btn btn-success' ]) ?>
< ? php if ( null != ( AutopsyDiagnosis :: find () -> where ([ 'id_case' => $case_autopsy -> id_case ]) -> andWhere ([ 'in' , 'report_type' , [ 'final' , 'consult' , 'preliminary' ]]) -> one ())) { ?>
< ? = Html :: a ( '<i class="ri-add-fill"></i> Addendum Report' , [ '/pathologist/do/autopsy-addendum' , 'id_case' => $case_autopsy -> id_case , 'type' => 'addendum' ], [ 'class' => 'btn btn-primary' ]) ?>
< div class = " btn-group " role = " group " >
< button id = " btnGroupCorrect1 " type = " button " class = " btn btn-warning dropdown-toggle "
data - bs - toggle = " dropdown " aria - haspopup = " true " aria - expanded = " false " >
< i class = " ri-check-fill " ></ i > Corrected Report
</ button >
< ul class = " dropdown-menu " aria - labelledby = " btnGroupCorrect1 " >
< ? php foreach (
AutopsyDiagnosis :: find () -> where ([
'id_case' => $case_autopsy -> id_case
]) -> andWhere ([ '>' , 'status_id' , 3 ]) -> orderBy ([ 'id' => SORT_ASC ]) -> all () as $case_correct
) {
$approve = CenterApprove :: find () -> where ([
'id_case' => $case_autopsy -> id_case ,
'approve_status' => 4 ,
'ref_id' => $case_correct -> id ,
]) -> one ();
?>
< ? php if ( $approve ) { ?>
< li >
< ? = Html :: a ( $case_correct -> id_case . '[' . ucfirst ( $case_correct -> report_type ) . ']-' . $case_correct -> pathologist_at , [ '/pathologist/do/autopsy-corrected' , 'id_case' => $case_autopsy -> id_case , 'from_id' => $case_correct -> id ], [ 'class' => 'dropdown-item' ]) ?>
</ li >
< ? php } ?>
< ? php } ?>
</ ul >
</ div >
< ? php //= Html::a('<i class="fa fa-check-square-o"></i> Revised Report', ['/pathologist/do/surgical-revise', 'id_case' => $case_dish->id_case, 'type' => 'revised'], ['class' => 'btn btn-md btn-danger'])
?>
< div class = " btn-group " role = " group " >
< button id = " btnGroupCorrect1 " type = " button " class = " btn btn-danger dropdown-toggle "
data - bs - toggle = " dropdown " aria - haspopup = " true " aria - expanded = " false " >
< i class = " ri-check-fill " ></ i > Revised Report
</ button >
< ul class = " dropdown-menu " aria - labelledby = " btnGroupCorrect1 " >
< ? php foreach (
AutopsyDiagnosis :: find () -> where ([
'id_case' => $case_autopsy -> id_case
]) -> andWhere ([ '>' , 'status_id' , 3 ]) -> orderBy ([ 'id' => SORT_ASC ]) -> all () as $case_revise
) {
$approve = CenterApprove :: find () -> where ([
'id_case' => $case_autopsy -> id_case ,
'approve_status' => 4 ,
'ref_id' => $case_revise -> id ,
]) -> one ();
?>
< ? php if ( $approve ) { ?>
< li >
< ? = Html :: a ( $case_revise -> id_case . '[' . ucfirst ( $case_revise -> report_type ) . ']-' . $case_revise -> pathologist_at , [ '/pathologist/do/autopsy-revised' , 'id_case' => $case_autopsy -> id_case , 'from_id' => $case_revise -> id , 'type' => 'revised' ], [ 'class' => 'dropdown-item' ]) ?>
</ li >
< ? php } ?>
< ? php } ?>
</ ul >
</ div >
< ? php } ?>
< ? php
$diagnosis_outlab = AutopsyDiagnosis :: find () -> andFilterWhere ([
'report_type' => 'outlab' ,
'id_case' => $case_autopsy -> id_case ,
//'status_id' => 1
]) -> one ();
?>
< ? php if ( $diagnosis_outlab ) { ?>
< ? = Html :: a ( '<i class="ri-file-text-line"></i> Outlab Report' , [ '/pathologist/do/autopsy-outlab' , 'id_case' => $case_autopsy -> id_case , 'type' => 'outlab' ], [ 'class' => 'btn btn-block btn-warning' ]) ?>
< ? php } ?>
< ? php /*
$consult = AutopsyConsult :: findOne ([ 'id_case' => $case_autopsy -> id_case , 'status' => 2 ]);
if ( isset ( $consult ) && $consult -> diagnosis_by == 1 ) { ?>
< ? = Html :: a ( '<i class="fa fa-comment" aria-hidden="true"></i> Consult Report' , [ '/pathologist/do/autopsy-consult' , 'id_case' => $case_autopsy -> id_case , 'type' => 'consult' ], [ 'class' => 'btn btn-info' ]) ?>
< ? php } */ ?>
</ div >
</ div >
</ div >
< div class = " card shadow mt-3 " >
< div class = " card-header " >
< h5 class = " card-title " >< i class = " ri-file-history-line " ></ i > ประวัติการส่งตรวจของคนไข้ :
< ? = Html :: encode ( $case_autopsy -> getFullname ()) ?>
</ h5 >
</ div >
< div class = " card-body " >
< div class = " row " >
< div class = " col-md-12 " >
< ? = $this -> render ( 'history' , [ 'case' => $case_autopsy ,]) ?>
</ div >
</ div >
</ div >
</ div >
< ? php $form = ActiveForm :: begin () ?>
< div class = " accordion " id = " accordion " role = " tablist " aria - multiselectable = " true " >
< div class = " card shadow mt-3 " >
< div class = " card-header " role = " tab " id = " headingOne " >
< h5 class = " card-title mb-0 " >
< a role = " button " data - toggle = " collapse " data - parent = " #accordion " href = " #collapseOne "
aria - expanded = " false " aria - controls = " collapseOne " >
< i class = " ri-file-user-line " ></ i > Patient Information
: < ? = Html :: encode ( $case_autopsy -> getFullname ()) ?> / <?= $case_autopsy->id_case ?>
</ a >
</ h5 >
</ div >
< div id = " collapseOne " class = " panel-collapse collapse show in " role = " tabpanel " aria - labelledby = " headingOne " >
< div class = " card-body " >
< ? = $this -> render ( '../../../register/views/case/_patient_autopsy' , [ 'model' => $case_autopsy ]) ?>
</ div >
<!-- card body -->
</ div >
<!-- collapse -->
</ div >
<!-- card -->
</ div >
< div class = " card shadow mt-3 " >
< div class = " card-header " role = " tab " id = " headingOne " >
< h5 class = " card-title mb-0 " >
< a role = " button " data - toggle = " collapse " data - parent = " #accordion " href = " #collapseOne " aria - expanded = " false "
aria - controls = " collapseOne " >< i class = " ri-checkbox-multiple-fill " ></ i >
Special Staining
: < ? = Html :: encode ( $case_autopsy -> getFullname ()) ?> / <?= $case_autopsy->id_case ?>
</ a >
</ h5 >
</ div >
< div id = " collapseOne " class = " panel-collapse collapse show in " role = " tabpanel " aria - labelledby = " headingOne " >
< div class = " card-body " >
< ? = GridView :: widget ([
'summary' => false ,
'dataProvider' => $finance_histo ,
'tableOptions' => [ 'class' => 'table table-striped truncate m-0' ],
'layout' => " { summary}<div class='table-outer'><div class='table-responsive'> \n { items} \n </div></div><div class='d-flex justify-content-between align-items-center mt-4'> { pager}</div> " ,
'columns' => [
[ 'class' => 'yii\grid\SerialColumn' ],
[
//'attribute' => 'charge_id',
'label' => 'Code' ,
'value' => function ( $model ) {
return $model -> charge -> code ;
},
],
[
//'attribute' => 'charge_id',
'label' => 'รายการย้อม' ,
'value' => function ( $model ) {
return $model -> charge -> name ;
},
],
[
//'attribute' => 'charge_id',
'format' => 'raw' ,
'label' => 'สถานะ' ,
'value' => function ( $model ) {
$arr = [ 1 => '<span class="badge badge-danger"> New</span>' , 2 => '<span class="badge badge-warning"> Stanning</span>' , 3 => '<span class="badge badge-primary"> Sent</span>' ];
return isset ( $model -> histoStatus ) ? ( $arr [ $model -> histoStatus -> status_1 ]) : '' ;
},
],
]
]) ?>
</ div >
<!-- card body -->
</ div >
<!-- collapse -->
</ div >
< div class = " card shadow mt-3 " >
< div class = " card-header " role = " tab " id = " headingOne " >
< h5 class = " card-title mb-0 " >
< a role = " button " data - toggle = " collapse " data - parent = " #accordion " href = " #collapseOne " aria - expanded = " false "
aria - controls = " collapseOne " >
< i class = " ri-checkbox-multiple-fill " ></ i > Immuno Staining
: < ? = Html :: encode ( $case_autopsy -> getFullname ()) ?> / <?= $case_autopsy->id_case ?>
</ a >
</ h5 >
</ div >
< div id = " collapseOne " class = " panel-collapse collapse show in " role = " tabpanel " aria - labelledby = " headingOne " >
< div class = " card-body " >
< ? = GridView :: widget ([
'summary' => false ,
'dataProvider' => $finance_immuno ,
'tableOptions' => [ 'class' => 'table table-striped truncate m-0' ],
'layout' => " { summary}<div class='table-outer'><div class='table-responsive'> \n { items} \n </div></div><div class='d-flex justify-content-between align-items-center mt-4'> { pager}</div> " ,
'columns' => [
[ 'class' => 'yii\grid\SerialColumn' ],
[
//'attribute' => 'charge_id',
'label' => 'Code' ,
'value' => function ( $model ) {
return $model -> charge -> code ;
},
],
[
//'attribute' => 'charge_id',
'label' => 'รายการย้อม' ,
'value' => function ( $model ) {
return $model -> charge -> name ;
},
],
[
//'attribute' => 'charge_id',
'format' => 'raw' ,
'label' => 'สถานะ' ,
'value' => function ( $model ) {
$arr = [ 1 => '<span class="badge badge-danger"> New</span>' , 2 => '<span class="badge badge-warning"> Stanning</span>' , 3 => '<span class="badge badge-primary"> Sent</span>' ];
return isset ( $model -> immunoStatus ) ? ( $arr [ $model -> immunoStatus -> status_1 ]) : '' ;
},
],
]
]) ?>
</ div >
<!-- card body -->
</ div >
<!-- collapse -->
</ div >
< div class = " card shadow mt-3 " >
< div class = " card-header " role = " tab " id = " headingTwo " >
< h5 class = " card-title mb-0 " >
< a class = " collapsed " role = " button " data - toggle = " collapse " data - parent = " #accordion " href = " #collapseTwo "
aria - expanded = " true " aria - controls = " collapseTwo " >
< i class = " ri-file-text-line " ></ i > Pathology Report
: < ? = Html :: encode ( $case_autopsy -> getFullname ()) ?> / <?= $case_autopsy->id_case ?>
</ a >
</ h5 >
</ div >
< div id = " collapseTwo " class = " panel-collapse collapse show in " role = " tabpanel " aria - labelledby = " headingTwo " >
< div class = " card-body " >
< ? php if ( AutopsyDiagnosis :: find () -> where ([
'id_case' => $case_autopsy -> id_case
]) -> count () > 0 ) { ?>
< ? = GridView :: widget ([
'dataProvider' => new ActiveDataProvider ([
'query' => AutopsyDiagnosis :: find () -> andFilterWhere ([
'id_case' => $case_autopsy -> id_case
]),
'sort' => [
'defaultOrder' => [
'pathologist_at' => SORT_DESC
]
]
]),
'columns' => [
[ 'class' => 'yii\grid\SerialColumn' ],
'id_case' ,
'pathologist_at' ,
[
'attribute' => 'status_id' ,
'value' => function ( $model ) {
// return isset($model->status) ? Html::encode($model->status->name) : '';
return isset ( $model -> status ) ? ( $model -> status -> name ) : '' ;
}
],
/* [
'class' => 'yii\grid\ActionColumn' ,
'template' => '{view}' ,
'buttons' => [
'view' => function ( $url , $model , $key ) {
if ( $model -> status_id >= 4 ) {
$case_type = Yii :: $app -> pathology -> getCaseType ( $model -> id_case );
$case = Yii :: $app -> pathology -> getCase ( $model -> id_case );
if ( $model -> report_type == 'outlab' ) {
foreach ( $case -> getReport () as $file => $val ) {
return Html :: a ( '<span class="fa fa-file-pdf-o"></span> View Report' , Yii :: getAlias ( '@web' ) . '/' . $case -> uploadReportFolder . '/' . $val , [ 'class' => 'btn btn-sm btn-success btn-block' , 'target' => '_blank' ]);
}
} else {
return Html :: a ( '<span class="fa fa-file-pdf-o"></span> View Report' , [ '/report/case/' . $case_type . '-pdf' , 'id_case' => $model -> id_case , 'report_type' => $model -> report_type , 'id' => $model -> id , 'mode' => 'final' , 'file' => false ], [ 'class' => 'btn btn-sm btn-success btn-block' , 'target' => '_blank' ]);
}
}
},
]
] */
[
'class' => 'yii\grid\ActionColumn' ,
'template' => '{view}' ,
'buttons' => [
'view' => function ( $url , $model , $key ) {
if ( $model -> status_id >= 4 ) {
$ap = '' ;
$approve = ApproveStatus :: findOne ([ 'id_case' => $model -> id_case , 'report_type' => $model -> report_type , 'ref_id' => $model -> id ]);
if ( $approve && $approve -> approve_status < 4 ) {
return '<span class="badge badge-danger">รอตรวจสอบ</span>' ;
}
$case_type = Yii :: $app -> pathology -> getCaseType ( $model -> id_case );
$case = Yii :: $app -> pathology -> getCase ( $model -> id_case );
if ( $model -> report_type == 'outlab' ) {
foreach ( $case -> getReport () as $file => $val ) {
return Html :: a ( '<span class="fa fa-file-pdf-o"></span> View Report' , Yii :: getAlias ( '@web' ) . '/' . $case -> uploadReportFolder . '/' . $val , [ 'class' => 'btn btn-sm btn-success btn-block' , 'target' => '_blank' ]);
}
} else {
return Html :: a ( '<span class="fa fa-file-pdf-o"></span> View Report' , [ '/report/case/' . $case_type . '-pdf' , 'id_case' => $model -> id_case , 'report_type' => $model -> report_type , 'id' => $model -> id , 'mode' => 'final' , 'file' => false , 'watermark' => false ], [ 'class' => 'btn btn-sm btn-success btn-block' , 'target' => '_blank' ]) . $ap ;
}
}
},
],
]
]
]) ?>
< ? php } ?>
</ div >
</ div >
</ div >
<!-- card body -->
< ? php ActiveForm :: end () ?>