update frozen task

master
mrkcp 2025-01-22 09:14:41 +07:00
parent d036c97b8a
commit ef628fba76
3 changed files with 429 additions and 308 deletions

View File

@ -1,177 +1,215 @@
<?php <?php
use common\models\CaseFrozen; use common\models\CaseFrozen;
use common\models\CenterApprove; use common\models\ConstPriority;
use common\models\ConstStatus; use common\models\ConstStatus;
use common\models\CytoNonGynDiagnosis; use common\models\PatientCase;
use kartik\form\ActiveForm;
use yii\grid\GridView; use yii\grid\GridView;
use yii\helpers\Html; use yii\helpers\Html;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use yii\widgets\MaskedInput; use yii\widgets\MaskedInput;
$this->title = Html::encode('My Frozen Case'); $this->title = Html::encode('My Frozen Case');
$this->params['breadcrumbs'][] = ['url' => '/pathologist/task/frozen', 'label' => 'Pathologist'];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="card">
<div class="card-header">
<h5 class="card-title"><i class="fa fa-user-md"></i> <?= $this->title ?></h5>
</div>
<div class="card-body">
<div class="table-responsive"> <!-- Row starts -->
<?= GridView::widget([ <div class="row gx-3">
'dataProvider' => $dataProvider, <div class="col-xxl-12 col-sm-12">
'pager' => ['class' => 'yii\bootstrap5\LinkPager'], <div class="card mb-3 bg-2">
'filterModel' => $searchModel, <div class="card-body">
'columns' => [ <div class="py-4 px-3 text-white">
['class' => 'yii\grid\SerialColumn'],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{transfer} {do-task}',
'visibleButtons' => [
'transfer' => function ($model) {
return $model->status_id <= 7;
},
],
'buttons' => [
'do-task' => function ($url, $model) {
return Html::a('<i data-feather="file-text" style="width: 14px; margin-bottom: -4px;"></i> Diagnosis', ['do', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-success btn-block']) . ' ';
},
'transfer' => function ($url, $model) {
return Html::a('<i data-feather="repeat" style="width: 14px; margin-bottom: -4px;"></i> Transfer', ['transfer', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-warning btn-block', 'data' => ['confirm' => 'ต้องการ Transfer Case นี้?']]);
}
]
],
[
'attribute' => 'register_at',
'filter' => MaskedInput::widget([
'model' => $searchModel,
'attribute' => 'register_at',
'mask' => '99/99/9999'
]),
'value' => function ($model) {
return $model->register_at;
}
],
//'register_at',
[
'attribute' => 'id_case',
'format' => 'raw',
'value' => function ($model) {
$case = Yii::$app->pathology->getCase($model->id_case);
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
$c = '';
$rt = '';
if(isset($case) && !empty($case->previous_report)) {
$c .= '<br /><small>('.$case->previous_report.')</small>';
}
if ($case_type == 'frozen') {
$case = CaseFrozen::findOne(['id_case' => $model->id_case]);
$rt .= (!empty($case->decal_end_date) ? '<small><br />Decal end:' . $case->decal_end_date . '</small>' : '');
}
return Html::a(Html::encode($model->id_case), ['do', 'id_case' => $model->id_case]).$c . '<br>' . Yii::$app->pathology->getExpress($model) . ' ' . Yii::$app->pathology->getCaseDate($model->id_case) . $rt;
}
],
//'title',
[
'attribute' => 'h_n',
'format' => 'raw',
'value' => function ($model) {
return Html::encode($model->h_n);
}
],
[ <h6><?= Yii::$app->pathology->sayHello() ?>,</h6>
'attribute' => 'patient_name', <h2><?= isset(Yii::$app->user->identity->realname) ? Html::encode(Yii::$app->user->identity->realname) : '' ?>
'value' => function ($model) { </h2>
return Html::encode(isset($model) ? ($model->getFullname()) : ''); <div class="mt-4 d-flex gap-3">
} <div class="d-flex align-items-center">
], <div class="icon-box lg bg-warning rounded-3 me-3">
[ <i class="ri-file-text-line fs-4"></i>
'attribute' => 'age', </div>
'value' => function ($model) { <div class="d-flex flex-column">
return intval($model->age); <h2 class="m-0 lh-1">
} <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'S%', false])->count()) ?>
], </h2>
'age_unit', <p class="m-0">Case Surgical</p>
[ </div>
'attribute' => 'hospital_name', </div>
'value' => function ($model) { <div class="d-flex align-items-center">
return Html::encode($model->hospital->name); <div class="icon-box lg bg-warning rounded-3 me-3">
} <i class="ri-file-text-line fs-4"></i>
], </div>
[ <div class="d-flex flex-column">
'attribute' => 'status_id', <h2 class="m-0 lh-1">
'filter' => ArrayHelper::map(ConstStatus::find()->all(), 'id', 'status'), <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'C%', false])->count()) ?>
'format' => 'raw', </h2>
'value' => function ($model) { <p class="m-0">Case Non Gyn</p>
//return $model->status->status; </div>
return Yii::$app->pathology->getStatus($model->status_id); </div>
} <div class="d-flex align-items-center">
], <div class="icon-box lg bg-warning rounded-3 me-3">
'remark', <i class="ri-file-text-line fs-4"></i>
/*[ </div>
'label' => 'Report Status', <div class="d-flex flex-column">
'format' => 'raw', <h2 class="m-0 lh-1">
'value' => function ($model) { <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'P%', false])->count()) ?>
$case_type = Yii::$app->pathology->getCaseType($model->id_case); </h2>
$rt = ''; <p class="m-0">Case Gyn</p>
</div>
if ($case_type == 'non-gyn') { </div>
$surgical_count = CytoNonGynDiagnosis::find() <div class="d-flex align-items-center">
->where([ <div class="icon-box lg bg-warning rounded-3 me-3">
'id_case' => $model->id_case <i class="ri-file-text-line fs-4"></i>
])->count(); </div>
if ($surgical_count > 0) { <div class="d-flex flex-column">
$rt .= '<table style="font-size: 11px;" class="table table-bordered table-hover table-striped">'; <h2 class="m-0 lh-1">
$rt .= '<thead>'; <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'A%', false])->count()) ?>
$rt .= '<tr><td>Report Type</td><td>Status</td><td>Authorised At</td><td>Approved At</td><td>Release At</td></tr>'; </h2>
$rt .= '</thead>'; <p class="m-0">Case Autopsy</p>
$rt .= '<tbody>'; </div>
foreach (CytoNonGynDiagnosis::find() </div>
->where([ <div class="d-flex align-items-center">
'id_case' => $model->id_case <div class="icon-box lg bg-warning rounded-3 me-3">
]) <i class="ri-file-text-line fs-4"></i>
->all() as $case) { </div>
<div class="d-flex flex-column">
$center_approve = CenterApprove::findOne([ <h2 class="m-0 lh-1">
'id_case' => $case->id_case, <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['or', ['like', 'id_case', 'F'], ['like', 'id_case', 'X']])->count()) ?>
'report_type' => $case->report_type, </h2>
'ref_id' => $case->id, <p class="m-0">Case Frozen</p>
]); </div>
</div>
if (!$center_approve) { </div>
$check = '<span class="badge badge-info">รอแพทย์ Authorized</span>'; </div>
} else { </div>
$arr = [1 => '<span class="badge badge-danger">ยังไม่ตรวจสอบ</span>', 2 => '<span class="badge badge-warning">รอแก้ไข</span>', 3 => '<span class="badge badge-info">แพทย์แก้ไขผลแล้ว</span>', 4 => '<span class="badge badge-success">ตรวจสอบแล้ว</span>'];
$check = $arr[$center_approve->approve_status];
}
$rt .= '<tr>';
$rt .= '<td>' . Html::encode(ucfirst($case->report_type)) . '</td>';
$rt .= '<td>' . (isset($case->status) ? Html::encode($case->status->name) : '') . '</td>';
$rt .= '<td>' . Html::encode($case->pathologist_at) . '</td>';
$rt .= '<td>' . $check . '</td>';
$rt .= '<td>' . (isset($center_approve->release_at) ? $center_approve->release_at : '') . '</td>';
$rt .= '</tr>';
}
$rt .= '</tbody>';
$rt .= '</table>';
}//surgical count
}
return $rt;
}
],*/
]
]) ?>
</div> </div>
</div> </div>
</div> </div>
<!-- Row ends -->
<div class="card md-3">
<div class="card-header d-flex align-items-center justify-content-between">
<h5 class="card-title"><i class="ri-file-edit-line"></i>
<?= $this->title ?></h5>
</div>
<div class="card-body">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'pager' => ['class' => 'yii\bootstrap5\LinkPager'],
'filterModel' => $searchModel,
'tableOptions' => ['class' => 'table align-middle 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'],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{transfer} {do-task}',
'visibleButtons' => [
'transfer' => function ($model) {
return $model->status_id <= 7;
},
],
'buttons' => [
'do-task' => function ($url, $model) {
return Html::a('<i class="ri-file-text-line"></i> Diagnosis', ['do', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-primary btn-block']) . ' ';
},
'transfer' => function ($url, $model) {
return Html::a('<i class="ri-repeat-line"></i> Transfer', ['transfer', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-warning btn-block', 'data' => ['confirm' => 'ต้องการ Transfer Case นี้?']]);
}
]
],
[
'attribute' => 'status_id',
'filter' => ArrayHelper::map(ConstStatus::find()->all(), 'id', 'status'),
'format' => 'raw',
'value' => function ($model) {
//return $model->status->status;
return Yii::$app->pathology->getStatus($model->status_id);
}
],
//'register_at',
[
'attribute' => 'id_case',
'format' => 'raw',
'value' => function ($model) {
$case = Yii::$app->pathology->getCase($model->id_case);
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
$c = '';
$rt = '';
if (isset($case) && !empty($case->previous_report)) {
$c .= '<br /><small>(' . $case->previous_report . ')</small>';
}
if ($case_type == 'frozen') {
$case = CaseFrozen::findOne(['id_case' => $model->id_case]);
$rt .= (!empty($case->decal_end_date) ? '<small><br />Decal end:' . $case->decal_end_date . '</small>' : '');
}
return Html::a(Html::encode($model->id_case), ['do', 'id_case' => $model->id_case]) . $c . '<br>' . Yii::$app->pathology->getExpress($model) . ' ' . Yii::$app->pathology->getCaseDate($model->id_case) . $rt;
}
],
//'title',
[
'attribute' => 'h_n',
'format' => 'raw',
'value' => function ($model) {
return Html::encode($model->h_n);
}
],
[
'attribute' => 'patient_name',
'label' => 'ชื่อ - นามสกุล',
'value' => function ($model) {
return isset($model) ? Html::encode($model->getFullname()) : null;
}
],
[
'attribute' => 'is_outlab',
'filter' => [1 => 'Case Outlab'],
'format' => 'raw',
'value' => function ($model) {
return $model->is_outlab == 1 ? '<span class="badge border border-danger bg-danger-subtle text-danger">Case Outlab</span>' : '';
}
],
[
'attribute' => 'age',
'value' => function ($model) {
return intval($model->age);
}
],
'age_unit',
[
'attribute' => 'hospital_name',
'value' => function ($model) {
return Html::encode($model->hospital->name);
}
],
[
'attribute' => 'register_at',
'filter' => MaskedInput::widget([
'model' => $searchModel,
'attribute' => 'register_at',
'mask' => '99/99/9999'
]),
'value' => function ($model) {
return $model->register_at;
}
],
'remark',
]
]) ?>
</div>
</div>
<?php $this->registerCss(" <?php $this->registerCss("
.grid-view td { .grid-view td {
white-space: nowrap; white-space: nowrap;
} }
")?> ") ?>

View File

@ -3,173 +3,256 @@
use common\models\CaseFrozen; use common\models\CaseFrozen;
use common\models\CenterApprove; use common\models\CenterApprove;
use common\models\ConstStatus; use common\models\ConstStatus;
use common\models\CytoNonGynDiagnosis;
use common\models\FrozenDiagnosis; use common\models\FrozenDiagnosis;
use common\models\PatientCase;
use yii\grid\GridView; use yii\grid\GridView;
use yii\helpers\Html; use yii\helpers\Html;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use yii\widgets\MaskedInput; use yii\widgets\MaskedInput;
$this->title = Html::encode('My Frozen Case'); $this->title = Html::encode('My Frozen Case');
$this->params['breadcrumbs'][] = ['url' => '/pathologist/task/frozen', 'label' => 'Pathologist']; $this->params['breadcrumbs'][] = ['url' => '/pathologist/task/frozen', 'label' => 'Pathologist'];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="card">
<div class="card-header">
<h5 class="card-title"><i class="fa fa-user-md"></i> <?= $this->title ?></h5> <div class="card mb-3 bg-2">
</div>
<div class="card-body"> <div class="card-body">
<div class="py-4 px-3 text-white">
<div class="table-responsive"> <h6><?= Yii::$app->pathology->sayHello() ?>,</h6>
<?= GridView::widget([ <h2><?= isset(Yii::$app->user->identity->realname) ? Html::encode(Yii::$app->user->identity->realname) : '' ?>
'dataProvider' => $dataProvider, </h2>
'pager' => ['class' => 'yii\bootstrap5\LinkPager'], <div class="mt-4 d-flex gap-3">
'filterModel' => $searchModel, <div class="d-flex align-items-center">
'columns' => [ <div class="icon-box lg bg-warning rounded-3 me-3">
['class' => 'yii\grid\SerialColumn'], <i class="ri-file-text-line fs-4"></i>
[ </div>
'class' => 'yii\grid\ActionColumn', <div class="d-flex flex-column">
'template' => '{transfer} {do-task}', <h2 class="m-0 lh-1">
'visibleButtons' => [ <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'S%', false])->count()) ?>
'transfer' => function ($model) { </h2>
return $model->status_id <= 7; <p class="m-0">Case Surgical</p>
}, </div>
], </div>
'buttons' => [ <div class="d-flex align-items-center">
'do-task' => function ($url, $model) { <div class="icon-box lg bg-warning rounded-3 me-3">
return Html::a('<i class="fa fa-file-text"></i> Diagnosis', ['do', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-success btn-block']) . ' '; <i class="ri-file-text-line fs-4"></i>
}, </div>
'transfer' => function ($url, $model) { <div class="d-flex flex-column">
return Html::a('<i class="fa fa-refresh"></i> Transfer', ['transfer', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-warning btn-block', 'data' => ['confirm' => 'ต้องการ Transfer Case นี้?']]); <h2 class="m-0 lh-1">
} <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'C%', false])->count()) ?>
] </h2>
], <p class="m-0">Case Non Gyn</p>
[ </div>
'attribute' => 'register_at', </div>
'filter' => MaskedInput::widget([ <div class="d-flex align-items-center">
'model' => $searchModel, <div class="icon-box lg bg-warning rounded-3 me-3">
'attribute' => 'register_at', <i class="ri-file-text-line fs-4"></i>
'mask' => '99/99/9999' </div>
]), <div class="d-flex flex-column">
'value' => function ($model) { <h2 class="m-0 lh-1">
return $model->register_at; <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'P%', false])->count()) ?>
} </h2>
], <p class="m-0">Case Gyn</p>
//'register_at', </div>
[ </div>
'attribute' => 'id_case', <div class="d-flex align-items-center">
'format' => 'raw', <div class="icon-box lg bg-warning rounded-3 me-3">
'value' => function ($model) { <i class="ri-file-text-line fs-4"></i>
$case = Yii::$app->pathology->getCase($model->id_case); </div>
$case_type = Yii::$app->pathology->getCaseType($model->id_case); <div class="d-flex flex-column">
$c = ''; <h2 class="m-0 lh-1">
$rt = ''; <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['like', 'id_case', 'A%', false])->count()) ?>
if (isset($case) && !empty($case->previous_report)) { </h2>
$c .= '<br /><small>(' . $case->previous_report . ')</small>'; <p class="m-0">Case Autopsy</p>
} </div>
if ($case_type == 'frozen') { </div>
$case = CaseFrozen::findOne(['id_case' => $model->id_case]); <div class="d-flex align-items-center">
$rt .= (!empty($case->decal_end_date) ? '<small><br />Decal end:' . $case->decal_end_date . '</small>' : ''); <div class="icon-box lg bg-warning rounded-3 me-3">
} <i class="ri-file-text-line fs-4"></i>
return Html::a(Html::encode($model->id_case), ['do', 'id_case' => $model->id_case]) . $c . '<br>' . Yii::$app->pathology->getExpress($model) . ' ' . Yii::$app->pathology->getCaseDate($model->id_case) . $rt; </div>
} <div class="d-flex flex-column">
], <h2 class="m-0 lh-1">
//'title', <?= number_format(PatientCase::find()->where(['DATE(register_at)' => date('Y-m-d')])->andWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['or', ['like', 'id_case', 'F'], ['like', 'id_case', 'X']])->count()) ?>
[ </h2>
'attribute' => 'h_n', <p class="m-0">Case Frozen</p>
'format' => 'raw', </div>
'value' => function ($model) { </div>
return Html::encode($model->h_n); </div>
}
],
[
'attribute' => 'patient_name',
'value' => function ($model) {
return isset($model) ? Html::encode($model->getFullname()) : null;
}
],
[
'attribute' => 'age',
'value' => function ($model) {
return intval($model->age);
}
],
'age_unit',
[
'attribute' => 'hospital_name',
'value' => function ($model) {
return Html::encode($model->hospital->name);
}
],
[
'attribute' => 'status_id',
'filter' => ArrayHelper::map(ConstStatus::find()->all(), 'id', 'status'),
'format' => 'raw',
'value' => function ($model) {
//return $model->status->status;
return Yii::$app->pathology->getStatus($model->status_id);
}
],
[
'label' => 'Report Status',
'headerOptions' => ['style' => 'text-align:center; width: 180;'],
'format' => 'raw',
'value' => function ($model) {
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
$rt = '';
if ($case_type == 'frozen') {
$frozen_count = FrozenDiagnosis::find()
->where([
'id_case' => $model->id_case
])->count();
if ($frozen_count > 0) {
$rt .= '<table style="font-size: 11px;" class="table table-bordered table-hover table-striped">';
$rt .= '<thead>';
$rt .= '<tr><td>Report Type</td><td>Status</td><td>Authorised At</td><td>Approved At</td><td>Release At</td></tr>';
$rt .= '</thead>';
$rt .= '<tbody>';
foreach (FrozenDiagnosis::find()
->where([
'id_case' => $model->id_case
])
->all() as $case) {
$center_approve = CenterApprove::findOne([
'id_case' => $case->id_case,
'report_type' => $case->report_type,
'ref_id' => $case->id,
]);
if (!$center_approve) {
$check = '<span class="badge badge-info">รอแพทย์ Authorized</span>';
} else {
$arr = [1 => '<span class="badge badge-danger">ยังไม่ตรวจสอบ</span>', 2 => '<span class="badge badge-warning">รอแก้ไข</span>', 3 => '<span class="badge badge-info">แพทย์แก้ไขผลแล้ว</span>', 4 => '<span class="badge badge-success">ตรวจสอบแล้ว</span>'];
$check = $arr[$center_approve->approve_status];
}
$rt .= '<tr>';
$rt .= '<td>' . Html::encode(ucfirst($case->report_type)) . '</td>';
$rt .= '<td>' . (isset($case->status) ? Html::encode($case->status->name) : '') . '</td>';
$rt .= '<td>' . Html::encode($case->pathologist_at) . '</td>';
$rt .= '<td>' . $check . '</td>';
$rt .= '<td>' . (isset($center_approve->release_at) ? $center_approve->release_at : '') . '</td>';
$rt .= '</tr>';
}
$rt .= '</tbody>';
$rt .= '</table>';
} //frozen count
}
return $rt;
}
],
]
]) ?>
</div> </div>
</div> </div>
</div> </div>
<div class="card md-3">
<div class="card-header d-flex align-items-center justify-content-between">
<h5 class="card-title"><i class="ri-file-edit-line"></i>
<?= $this->title ?></h5>
</div>
<div class="card-body">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'pager' => ['class' => 'yii\bootstrap5\LinkPager'],
'filterModel' => $searchModel,
'tableOptions' => ['class' => 'table align-middle 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'],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{transfer} {do-task}',
'visibleButtons' => [
'transfer' => function ($model) {
return $model->status_id <= 7;
},
],
'buttons' => [
'do-task' => function ($url, $model) {
return Html::a('<i class="ri-file-text-line"></i> Diagnosis', ['do', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-primary btn-block']) . ' ';
},
'transfer' => function ($url, $model) {
return Html::a('<i class="ri-repeat-line"></i> Transfer', ['transfer', 'id_case' => $model['id_case']], ['class' => 'btn btn-sm btn-warning btn-block', 'data' => ['confirm' => 'ต้องการ Transfer Case นี้?']]);
}
]
],
[
'attribute' => 'status_id',
'filter' => ArrayHelper::map(ConstStatus::find()->all(), 'id', 'status'),
'format' => 'raw',
'value' => function ($model) {
//return $model->status->status;
return Yii::$app->pathology->getStatus($model->status_id);
}
],
[
'label' => 'Report Status',
'headerOptions' => ['style' => 'text-align:center; width: 150;'],
'format' => 'raw',
'value' => function ($model) {
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
$rt = '';
if ($case_type == 'frozen') {
$frozen_count = FrozenDiagnosis::find()
->where([
'id_case' => $model->id_case
])->count();
if ($frozen_count > 0) {
$rt .= '<div class="table-outer"><table style="font-size: 11px;" class="table table-striped truncate m-0">';
$rt .= '<thead>';
$rt .= '<tr><td>Report Type</td><td>Status</td><td>Authorised At</td><td>Approved At</td><td>Release At</td></tr>';
$rt .= '</thead>';
$rt .= '<tbody>';
foreach (
FrozenDiagnosis::find()
->where([
'id_case' => $model->id_case
])
->all() as $case
) {
$center_approve = CenterApprove::findOne([
'id_case' => $case->id_case,
'report_type' => $case->report_type,
'ref_id' => $case->id,
]);
if (!$center_approve) {
$check = '<span class="badge border border-info bg-info-subtle text-info">รอแพทย์ Authorized</span>';
} else {
$arr = [1 => '<span class="badge border border-danger bg-danger-subtle text-danger">ยังไม่ตรวจสอบ</span>', 2 => '<span class="badge border border-warning bg-warning-subtle text-warning">รอแก้ไข</span>', 3 => '<span class="badge border border-info bg-info-subtle text-info">แพทย์แก้ไขผลแล้ว</span>', 4 => '<span class="badge border border-success bg-success-subtle text-success">ตรวจสอบแล้ว</span>'];
$check = $arr[$center_approve->approve_status];
}
$rt .= '<tr>';
$rt .= '<td>' . Html::encode(ucfirst($case->report_type)) . '</td>';
$rt .= '<td>' . (isset($case->status) ? Html::encode($case->status->name) : '') . '</td>';
$rt .= '<td>' . Html::encode($case->pathologist_at) . '</td>';
$rt .= '<td>' . $check . '</td>';
$rt .= '<td>' . (isset($center_approve->release_at) ? $center_approve->release_at : '') . '</td>';
$rt .= '</tr>';
}
$rt .= '</tbody>';
$rt .= '</table></div>';
} //frozen count
}
return $rt;
}
],
[
'attribute' => 'id_case',
'format' => 'raw',
'value' => function ($model) {
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
$rt = '';
if ($case_type == 'frozen') {
$case = CaseFrozen::findOne(['id_case' => $model->id_case]);
$rt .= (!empty($case->decal_end_date) ? '<small><br />Decal end:' . $case->decal_end_date . '</small>' : '');
}
return '<span class="id_case_style ' . (Yii::$app->pathology->getExpress($model) ? 'text-danger' : '') . '">' . Html::a(Html::encode($model->id_case), ['do', 'id_case' => $model->id_case]) . '</span> ' .
Yii::$app->pathology->getCaseDate($model->id_case) . (Yii::$app->pathology->getExpress($model) ? '<br />' . Yii::$app->pathology->getExpress($model) : '') . $rt;
}
],
//'title',
[
'attribute' => 'h_n',
'format' => 'raw',
'value' => function ($model) {
return Html::encode($model->h_n);
}
],
[
'attribute' => 'patient_name',
'label' => 'ชื่อ - นามสกุล',
'value' => function ($model) {
return isset($model) ? Html::encode($model->getFullname()) : null;
}
],
[
'attribute' => 'is_outlab',
'filter' => [1 => 'Case Outlab'],
'format' => 'raw',
'value' => function ($model) {
return $model->is_outlab == 1 ? '<span class="badge border border-danger bg-danger-subtle text-danger">Case Outlab</span>' : '';
}
],
[
'attribute' => 'age',
'value' => function ($model) {
return intval($model->age);
}
],
'age_unit',
[
'attribute' => 'hospital_name',
'value' => function ($model) {
return Html::encode($model->hospital->name);
}
],
[
'attribute' => 'register_at',
'filter' => MaskedInput::widget([
'model' => $searchModel,
'attribute' => 'register_at',
'mask' => '99/99/9999'
]),
'value' => function ($model) {
return $model->register_at;
}
],
]
]) ?>
</div>
</div>
<?php $this->registerCss(" <?php $this->registerCss("
.grid-view td { .grid-view td {
white-space: nowrap; white-space: nowrap;

View File

@ -262,7 +262,7 @@ if (Yii::$app->user->can('pathologist')) {
$count_new_surgical = PatientCase::find()->orFilterWhere(['like', 'id_case', 'S'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['=', 'status_id', 7])->count(); $count_new_surgical = PatientCase::find()->orFilterWhere(['like', 'id_case', 'S'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['=', 'status_id', 7])->count();
$count_new_non_gyn = PatientCase::find()->orFilterWhere(['like', 'id_case', 'C'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['in', 'status_id', [7, 9]])->count(); $count_new_non_gyn = PatientCase::find()->orFilterWhere(['like', 'id_case', 'C'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['in', 'status_id', [7, 9]])->count();
$count_new_pap = PatientCase::find()->orFilterWhere(['like', 'id_case', 'G'])/*->orFilterWhere(['like', 'id_case', 'L'])*/->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['in', 'status_id', [7, 9]])->count(); $count_new_pap = PatientCase::find()->orFilterWhere(['like', 'id_case', 'G'])/*->orFilterWhere(['like', 'id_case', 'L'])*/->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['in', 'status_id', [7, 9]])->count();
$count_new_frozen = PatientCase::find()->orFilterWhere(['like', 'id_case', 'Z'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count(); $count_new_frozen = PatientCase::find()->where(['or', ['like', 'id_case', 'F'], ['like', 'id_case', 'X']])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count();
//$count_new_fish = PatientCase::find()->orFilterWhere(['like', 'id_case', 'I'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count(); //$count_new_fish = PatientCase::find()->orFilterWhere(['like', 'id_case', 'I'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count();
//$count_new_dish = PatientCase::find()->orFilterWhere(['like', 'id_case', 'D'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count(); //$count_new_dish = PatientCase::find()->orFilterWhere(['like', 'id_case', 'D'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count();
///$count_new_flow = PatientCase::find()->orFilterWhere(['like', 'id_case', 'F'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count(); ///$count_new_flow = PatientCase::find()->orFilterWhere(['like', 'id_case', 'F'])->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()])->andFilterWhere(['<=', 'status_id', 7])->count();
@ -282,7 +282,7 @@ if (Yii::$app->user->can('pathologist')) {
['label' => '<i class="ri-git-commit-fill"></i> My Non-Gyn Case', 'url' => ['/pathologist/task/non-gyn-all']], ['label' => '<i class="ri-git-commit-fill"></i> My Non-Gyn Case', 'url' => ['/pathologist/task/non-gyn-all']],
['label' => '<i class="ri-git-commit-fill"></i> New Case Gyn' . ' <span class="badge border border-danger bg-danger-subtle text-danger ms-auto">' . $count_new_pap . '</span>', 'url' => ['/pathologist/task/pap-new']], ['label' => '<i class="ri-git-commit-fill"></i> New Case Gyn' . ' <span class="badge border border-danger bg-danger-subtle text-danger ms-auto">' . $count_new_pap . '</span>', 'url' => ['/pathologist/task/pap-new']],
['label' => '<i class="ri-git-commit-fill"></i> My Gyn Case', 'url' => ['/pathologist/task/pap-all']], ['label' => '<i class="ri-git-commit-fill"></i> My Gyn Case', 'url' => ['/pathologist/task/pap-all']],
['label' => '<i class="ri-git-commit-fill"></i> New Case Frozen<span style="margin-top:-6px !important; color: white;" class="badge badge-danger">' . $count_new_frozen . '</span>', 'url' => ['/pathologist/task/frozen-new']], ['label' => '<i class="ri-git-commit-fill"></i> New Case Frozen' . ' <span class="badge border border-danger bg-danger-subtle text-danger ms-auto">' . $count_new_frozen . '</span>', 'url' => ['/pathologist/task/frozen-new']],
['label' => '<i class="ri-git-commit-fill"></i> My Frozen Case', 'url' => ['/pathologist/task/frozen-all']], ['label' => '<i class="ri-git-commit-fill"></i> My Frozen Case', 'url' => ['/pathologist/task/frozen-all']],
//['label' => 'Case FISH<span style="margin-top:-6px !important; color: white;" class="badge badge-danger">' . $count_new_fish . '</span>', 'url' => ['/pathologist/task/fish-new']], //['label' => 'Case FISH<span style="margin-top:-6px !important; color: white;" class="badge badge-danger">' . $count_new_fish . '</span>', 'url' => ['/pathologist/task/fish-new']],
//['label' => 'My FISH Case', 'url' => ['/pathologist/task/fish-all']], //['label' => 'My FISH Case', 'url' => ['/pathologist/task/fish-all']],