2024-12-25 03:04:59 +00:00
< ? php
use yii\grid\GridView ;
use yii\helpers\Html ;
use unclead\multipleinput\MultipleInputColumn ;
use unclead\multipleinput\MultipleInput ;
use common\models\ConstServiceCharge ;
use common\models\ImmunoSlideSpecial ;
use yii\bootstrap5\ActiveForm ;
use yii\helpers\Url ;
use yii\web\JsExpression ;
use yii\jui\AutoComplete ;
use kartik\detail\DetailView ;
$this -> title = 'Staining: ' . $immuno_staining -> id_case ;
$this -> params [ 'breadcrumbs' ][] = [ 'url' => '/immuno/staining/index' , 'label' => 'Immunohistochemistry Staining (IHC)' ];
$this -> params [ 'breadcrumbs' ][] = $this -> title ;
?>
< ? php //$this->render('/layouts/_menu')
?>
< ? php $form = ActiveForm :: begin () ?>
< div class = " card mt-3 " >
< div class = " card-header " >
< h5 class = " card-title " >< i class = " ri-file-text-line " ></ i > < ? = $this -> title ?> </h5>
</ div >
< div class = " card-body " >
< div class = " table-responsive " >
< div class = " mb-3 " >
< ? = DetailView :: widget ([
'model' => $immuno_staining ,
'condensed' => true ,
'hover' => true ,
'hideAlerts' => true ,
'mode' => DetailView :: MODE_VIEW ,
'panel' => [
'heading' => $this -> title ,
'type' => DetailView :: TYPE_SUCCESS ,
],
'options' => [
'class' => 'table truncate m-0' ,
],
'enableEditMode' => false ,
'attributes' => [
[
'columns' => [
[
'attribute' => 'operate_id' ,
'label' => 'ผู้รับงาน' ,
'format' => 'raw' ,
'value' => $immuno_staining -> operate_id > 1 ? $immuno_staining [ 'operate' ][ 'realname' ] . '<br />' . $immuno_staining [ 'receive_at' ] : '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'attribute' => 'send_id' ,
'label' => 'ผู้ส่งงาน' ,
'format' => 'raw' ,
2025-04-03 15:58:30 +00:00
'value' => isset ( $immuno_staining -> operate_id ) > 1 ? $immuno_staining [ 'send' ][ 'realname' ] . '<br />' . $immuno_staining [ 'send_at' ] : '' ,
2024-12-25 03:04:59 +00:00
'valueColOptions' => [ 'style' => 'width:30%' ]
]
],
],
[
'columns' => [
[
'attribute' => 'id_case' ,
'label' => 'Case ID' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'format' => 'raw' ,
'label' => 'พยาธิแพทย์' ,
'value' => isset ( $model -> pathologist ) ? $model -> pathologist -> realname : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
]
],
[
'columns' => [
/* [
'label' => 'Slide No.' ,
'value' => ImmunoStaining :: getBlockList ( $immuno_staining -> id_case ),
'valueColOptions' => [ 'style' => 'width:30%' ]
] */
[
'format' => 'raw' ,
'label' => 'ชื่อ' ,
2025-04-03 15:58:30 +00:00
'value' => isset ( $case ) ? $case -> getFullname () : null ,
2024-12-25 03:04:59 +00:00
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
//'attribute' => 'patientCase.pathologist',
'format' => 'raw' ,
'label' => 'โรงพยาบาล' ,
'value' => ( $case -> hospital ? $case -> hospital -> name : null ) . ' ' . Yii :: $app -> pathology -> getPrivate ( $case -> hospital ? $case -> hospital -> is_private : null ),
'valueColOptions' => [ 'style' => 'width:30%' ]
]
]
],
[
'columns' => [
[
'label' => 'อายุ' ,
'value' => $case ? ( $case -> age > 0 ? $case -> age . ' ' . $case -> age_unit : '' ) : null ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
'label' => '' ,
'value' => '' ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
]
],
/* [
'columns' => [
[
//'attribute' => 'patientCase.pathologist',
'format' => 'raw' ,
'label' => 'Block จากภายนอก' ,
'value' => $immuno_staining [ 'caseStaining' ][ 'block_ex' ],
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
//'attribute' => 'patientCase.pathologist',
'format' => 'raw' ,
'label' => 'Slide จากภายนอก' ,
'value' => $immuno_staining [ 'caseStaining' ][ 'slide_ex' ],
'valueColOptions' => [ 'style' => 'width:30%' ]
]
]
],
[
'columns' => [
[
'label' => 'จำนวน Block' ,
'value' => isset ( $immuno_staining [ 'caseStaining' ]) ? $immuno_staining [ 'caseStaining' ][ 'block_amount' ] : $model -> block_amount ,
'valueColOptions' => [ 'style' => 'width:30%' ]
],
[
//'attribute' => 'patientCase.pathologist',
'format' => 'raw' ,
'label' => 'จำนวน Slide' ,
'value' => isset ( $immuno_staining [ 'caseStaining' ]) ? $immuno_staining [ 'caseStaining' ][ 'slide_amount' ] : $model -> slide_amount ,
'valueColOptions' => [ 'style' => 'width:30%' ]
]
]
] */
]
]) ?>
< ? php if ( $prefix = substr ( $immuno_staining -> id_case , 0 , 2 ) == 'CS' ) {
$case_consult = Yii :: $app -> pathology -> getCase ( $immuno_staining -> id_case );
?>
< table class = " table truncate m-0 align-middle dataTable no-footer " >
< tr >
< th > Block ภายนอก </ th >
< td >< ? = $case_consult -> block_ex ?> </td>
< th > Block ภายใน </ th >
< td >< ? = $case_consult -> block_in ?> </td>
< th > Selected Block </ th >
< td >< ? = $case_consult -> selected_block ?> </td>
< th > จำนวน Block </ th >
< td >< ? = $case_consult -> block_amount ?> </td>
< th > จำนวน Slide </ th >
< td >< ? = $case_consult -> slide_amount ?> </td>
< th > Note </ th >
< td >< ? = $case_consult -> note ?> </td>
</ tr >
< ? php if ( $case_consult -> is_breast == 1 ) { ?>
< tr >
< th > Request </ th >
< td >< ? = isset ( $case_consult -> stainingTest ) ? $case_consult -> stainingTest -> test : null ?>
</ td >
</ tr >
< ? php } ?>
</ table >
< ? php } ?>
< ? php if ( $prefix = substr ( $immuno_staining -> id_case , 0 , 2 ) == 'EX' ) {
$case_staining = Yii :: $app -> pathology -> getCase ( $immuno_staining -> id_case );
?>
< table class = " table truncate m-0 align-middle dataTable no-footer " >
< tr >
< th > Block ภายนอก </ th >
< td >< ? = $case_staining -> block_ex ?> </td>
< th > Block ภายใน </ th >
< td >< ? = isset ( $case_staining -> block_in ) ? $case_staining -> block_in : null ?> </td>
< th > จำนวน Block </ th >
< td >< ? = $case_staining -> block_amount ?> </td>
< th > จำนวน Slide </ th >
< td >< ? = $case_staining -> slide_amount ?> </td>
< th > Center No </ th >
< td >< ? = $case_staining -> center_no ?> </td>
< th > Note </ th >
< td >< ? = $case_staining -> note ?> </td>
</ tr >
</ table >
< ? php } ?>
< h5 class = " mt-4 " >< strong >< i class = " ri-arrow-right-s-line " ></ i > รายการ Special Staining </ strong ></ h5 >
< div class = " mt-4 " >
< ? = GridView :: widget ([
'dataProvider' => $histo ,
'summary' => false ,
'tableOptions' => [ 'class' => 'table truncate m-0 align-middle dataTable no-footer' ],
'columns' => [
//['class' => 'yii\grid\SerialColumn'],
'block_no' ,
'financeServiceCharge.charge.code' ,
'financeServiceCharge.charge.name' ,
'note' ,
'financeServiceCharge.price' ,
[
'attribute' => 'is_able' ,
'value' => function ( $model ) {
return $model -> is_able == 1 ? 'Dis.' : '' ;
}
],
'disable_comment' ,
'in_at' ,
'prepare_at' ,
'out_at'
]
]) ?>
</ div >
< h5 class = " mt-4 " >< strong >< i class = " ri-arrow-right-s-line " ></ i > รายการ Immuno Staining </ strong ></ h5 >
< div class = " mt-4 " >
< ? php $this -> registerJs ( '
$ . fn . init_charge = function (){
var cid = $ ( this ) . attr ( " id " );
var charge_id = $ ( this ) . val ();
var hospital_id = $ ( " #hospital_id " ) . val ();
var sid = cid . split ( " - " );
//alert(charge_id);
$ . get (
" ' . Url::toRoute('/site/hospital-service-charge') . ' " ,
{
charge_id : charge_id ,
hospital_id : hospital_id
},
function ( data )
{
var result = data . split ( " -- " );
//alert(sid);
$ ( " #immunostaining-items- " + sid [ 2 ] + " -charge_id " ) . val ( result [ 0 ]);
$ ( " .field-immunostaining-items- " + sid [ 2 ] + " -code " ) . text ( result [ 1 ]);
$ ( " .field-immunostaining-items- " + sid [ 2 ] + " -testing " ) . text ( result [ 2 ]);
$ ( " .field-immunostaining-items- " + sid [ 2 ] + " -price " ) . text ( result [ 3 ]);
}
);
};
' ) ?>
</ div >
< ? = Html :: hiddenInput ( 'hospital_id' , $case -> hospital_id , [ 'id' => 'hospital_id' ]) ?>
< ? = $form -> field ( $immuno_staining , 'items' ) -> label ( false ) -> widget ( MultipleInput :: class , [
'max' => 100 ,
'allowEmptyList' => true ,
//'min' => 1,
'id' => Html :: getInputId ( $immuno_staining , 'items' ),
'addButtonPosition' => MultipleInput :: POS_FOOTER ,
'columns' => [
[
'name' => 'id_case' ,
'title' => 'ID Case' ,
'value' => function ( $data ) {
return isset ( $data [ 'id_case' ]) ? $data [ 'id_case' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'id' ]) ? $data [ 'id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'from_id' ,
'title' => 'ID' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'from_id' ]) ? $data [ 'finance' ][ 'from_id' ] : '' ;
},
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'block_no' ,
'title' => 'Block No.' ,
'enableError' => true ,
],
[
'name' => 'request_type' ,
'title' => 'ID' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
],
[
'name' => 'charge_id' ,
'title' => 'ID' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_HIDDEN_INPUT ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge_id' ]) ? $data [ 'finance' ][ 'charge_id' ] : '' ;
},
],
[
'name' => 'finance_code' ,
'title' => 'ลงรายการย้อม Immuno' ,
'type' => AutoComplete :: class ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'code' ]) ? $data [ 'finance' ][ 'charge' ][ 'code' ] : '' ;
},
'enableError' => true ,
'options' => [
'options' => [
'class' => 'form-control'
],
'clientOptions' => [
'source' => ConstServiceCharge :: find () -> select ([ 'id as id' , 'code as value' , '(code + \' \' + name) as label' ]) -> where ([ 'lab' => 'immuno' ]) -> orderBy ([ 'code' => SORT_ASC ]) -> asArray () -> all (),
'change' => 'function(){$(this).init_charge();}' ,
'select' => new JsExpression ( " function( event, ui ) {
$ ( this ) . val ( ui . item . id );
$ ( this ) . init_charge ();
} " )
],
'class' => 'charge_class' ,
//
//'prompt' => 'เลือกค่าตัด',
//'onchange' => '$(this).init_charge();'
]
],
[
'name' => 'testing' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'รายการย้อม Immuno' ,
'value' => function ( $data ) {
return isset ( $data [ 'finance' ][ 'charge' ][ 'name' ]) ? $data [ 'finance' ][ 'charge' ][ 'name' ] : '' ;
},
'enableError' => true ,
],
[
'name' => 'note' ,
'title' => 'Note' ,
'enableError' => true ,
],
[
'name' => 'price' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'Price' ,
'value' => function ( $data ) use ( $case ) {
return number_format ( Yii :: $app -> pathology -> getHosPrice ( isset ( $case -> hospital_id ) ? $case -> hospital_id : null , ( isset ( $data [ 'finance' ]) ? $data [ 'finance' ][ 'charge_id' ] : null )), 2 );
},
'enableError' => true ,
],
[
'name' => 'is_able' ,
'title' => 'Dis.' ,
'enableError' => true ,
'type' => MultipleInputColumn :: TYPE_CHECKBOX ,
],
[
'name' => 'disable_comment' ,
'title' => 'Comment' ,
'enableError' => true ,
],
[
'name' => 'in_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'วันสั่งย้อม' ,
'enableError' => true ,
],
[
'name' => 'receive_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'วันรับงาน' ,
'enableError' => true ,
],
[
'name' => 'send_at' ,
'type' => MultipleInputColumn :: TYPE_STATIC ,
'title' => 'วันส่งงาน' ,
'enableError' => true ,
],
[
'name' => 'group_name' ,
'title' => 'รอบการย้อม' ,
'enableError' => true ,
],
]
]) ?>
< div class = " form-group " >
< ? = Html :: submitButton ( '<i class="ri-save-line"></i> บันทึกข้อมูล' , [ 'class' => 'btn btn-primary btn-block' ]) ?>
</ div >
< ? php //var_dump($items)
?>
< ? php $this -> registerJs ( "
$ ( '#" . Html::getInputId($immuno_staining, ' items ') . "' ) . on ( 'afterInit' , function (){
console . log ( 'calls on after initialization event' );
}) . on ( 'beforeAddRow' , function ( e ) {
//console.log('calls on before add row event');
}) . on ( 'afterAddRow' , function ( e ) {
//console.log('calls on after add row event');
}) . on ( 'beforeDeleteRow' , function ( e , item ){
//console.log(item);
return confirm ( 'คุณแน่ใจนะว่าต้องการลบ?' );
}) . on ( 'afterDeleteRow' , function ( e , item , currentIndex ){
//console.log(item);#immunostaining-items-0-from_id
var id_case = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"immunostaining-items-\"]' ) . val ();
var from_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"immunostaining-items-\"][id$=\"-from_id\"]' ) . val ();
var im_id = item . find ( '.list-cell__block_no' ) . find ( 'input[id*=\"immunostaining-items-\"][id$=\"-id\"]' ) . val ();
alert ( id_case + from_id );
$ . post ( \ " " . Url :: to ([ '/immuno/staining/finance-service-charge-delete' ]) . " \" ,
{
id_case : id_case ,
from_id : from_id ,
im_id : im_id
},
function ( data , status ){
alert ( \ " Data: \" + data); // + \" Status: \" + status
}
);
});
" ) ?>
</ div >
</ div >
</ div >
</ div >
< ? php ActiveForm :: end () ?>
< ? php if ( $immuno_staining -> receive_at ) {
?>
< div class = " card mt-3 " >
< div class = " card-header " >
< h5 class = " card-title " >< i class = " ri-file-text-line " ></ i > < ? = $this -> title ?> </h5>
</ div >
< div class = " card-body " >
< embed src = " <?= Url::to(['request-pdf', 'id_case' => $immuno_staining->id_case ], true) ?> "
2025-04-03 15:58:30 +00:00
type = " application/pdf " width = " 100% " height = " 500 " >
2024-12-25 03:04:59 +00:00
< ? php } ?>
</ div >
</ div >