fix approve report

master
SuraMew 2026-03-16 09:50:20 +07:00
parent 84d40ba29c
commit a94360c98c
6 changed files with 538 additions and 461 deletions

View File

@ -29,9 +29,9 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="card-body">
<div style="margin-bottom: 10px">
<?php if (!empty($case->files)) { ?>
<h6 class="mt-4">
Request file</h6>
<?= $case->getFileLink() ?>
<h6 class="mt-4">
Request file</h6>
<?= $case->getFileLink() ?>
<?php } ?>
</div>
@ -68,24 +68,54 @@ if ($model->approve_status == 1) {
</div>
<div class="card-body">
<?php
$ref_case = null;
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
if ($case_non_gyn_diagnosis) {
$ref_case = $case_non_gyn_diagnosis->id;
}
$url = '/report/case/' . $case_type . '-pdf';
$ref_case = null;
$case_type = Yii::$app->pathology->getCaseType($model->id_case);
if ($case_non_gyn_diagnosis) {
$ref_case = $case_non_gyn_diagnosis->id;
}
$url = '/report/case/' . $case_type . '-pdf';
?>
<embed
src="<?= Url::to([$url, 'id_case' => $model->id_case, 'report_type' => $model->report_type, 'mode' => 'final', 'id' => $ref_case, 'watermark' => false, 'file' => false], true) ?>"
type="application/pdf" width="100%" height="1300"></embed>
<?php if ($model->report_type == 'outlab') { ?>
<?php foreach ($case_non_gyn_diagnosis->getReport() as $key => $value) {
$fileExtension = pathinfo($case_non_gyn_diagnosis->uploadReportFolder . '/' . $value, PATHINFO_EXTENSION);
if ($fileExtension == 'pdf') { ?>
<embed
src="<?= Url::to(Yii::getAlias('@web') . '/' . $case_non_gyn_diagnosis->uploadReportFolder . '/' . $value, true) ?>"
type="application/pdf" width="100%" height="800"></embed>
<?php } elseif (in_array($fileExtension, ['jpg', 'jpeg', 'png', 'gif'])) { ?>
<embed
src="<?= Url::to([$url, 'id_case' => $model->id_case, 'report_type' => $model->report_type, 'mode' => 'final', 'id' => $ref_case, 'watermark' => false, 'file' => false], true) ?>"
type="application/pdf" width="100%" height="1300"></embed>
<?php } ?>
<?php break; ?>
<?php } ?>
<?php } else if ($model->report_type == 'consult-outlab') { ?>
<?php foreach ($case_non_gyn_diagnosis->getConsultReport() as $key => $value) {
$fileExtension = pathinfo($case_non_gyn_diagnosis->uploadConsultReportFolder . '/' . $value, PATHINFO_EXTENSION);
if ($fileExtension == 'pdf') { ?>
<embed
src="<?= Url::to(Yii::getAlias('@web') . '/' . $case_non_gyn_diagnosis->uploadConsultReportFolder . '/' . $value, true) ?>"
type="application/pdf" width="100%" height="800"></embed>
<?php } elseif (in_array($fileExtension, ['jpg', 'jpeg', 'png', 'gif'])) { ?>
<embed
src="<?= Url::to([$url, 'id_case' => $model->id_case, 'report_type' => $model->report_type, 'mode' => 'final', 'id' => $ref_case, 'watermark' => false, 'file' => false], true) ?>"
type="application/pdf" width="100%" height="1300"></embed>
<?php } ?>
<?php break; ?>
<?php } ?>
<?php } else { ?>
<embed
src="<?= Url::to([$url, 'id_case' => $model->id_case, 'report_type' => $model->report_type, 'mode' => 'final', 'id' => $ref_case, 'watermark' => false, 'file' => false], true) ?>"
type="application/pdf" width="100%" height="1300"></embed>
<?php } ?>
</div>
</div>
<div class="card mt-4">
<div class="card-header">
<h5 class="card-title"><i class="ri-file-edit-line"></i> Edit
@ -98,28 +128,29 @@ if ($model->approve_status == 1) {
<?php if ($case_type == 'non-gyn' && (!$model->isNewRecord) && $model->approve_status <= 4) { ?>
<?= $this->render('_form_non_gyn', ['model' => $case, 'form' => $form]) ?>
<?= $this->render('_form_non_gyn', ['model' => $case, 'form' => $form]) ?>
<?php } ?>
<div class="row mt-5">
<h5><i class="ri-checkbox-multiple-fill"></i> Release Report</h5>
<div class="col-md-4 mt-4">
<?php // $form->field($model, 'approve_status')->radioList([1 => 'ยังไม่ตรวจสอบ', 2 => 'ส่งให้แพทย์แก้ไข', 4 => 'ตรวจสอบแล้ว']) ?>
<?php // $form->field($model, 'approve_status')->radioList([1 => 'ยังไม่ตรวจสอบ', 2 => 'ส่งให้แพทย์แก้ไข', 4 => 'ตรวจสอบแล้ว'])
?>
<?php
$items = [
1 => 'ยังไม่ตรวจสอบ',
2 => 'ส่งให้แพทย์แก้ไข',
4 => 'ตรวจสอบแล้ว'
];
$items = [
1 => 'ยังไม่ตรวจสอบ',
2 => 'ส่งให้แพทย์แก้ไข',
4 => 'ตรวจสอบแล้ว'
];
// ถ้า approve_status เป็น 4 ให้ลบตัวเลือก 2 ออกจากรายการ
if ($model->approve_status == 4) {
unset($items[2]);
}
// ถ้า approve_status เป็น 4 ให้ลบตัวเลือก 2 ออกจากรายการ
if ($model->approve_status == 4) {
unset($items[2]);
}
echo $form->field($model, 'approve_status')->radioList($items);
?>
echo $form->field($model, 'approve_status')->radioList($items);
?>
</div>
</div>

View File

@ -127,18 +127,20 @@ class TaskController extends \yii\web\Controller
}
$dataProvider->query->andFilterWhere(['pathologist_id' => Yii::$app->user->getId()]);
$dataProvider->sort = [
$dataProvider->sort = [
'defaultOrder' => [
'id_case' => SORT_ASC,
//'id_case' => SORT_ASC,
//'id_case' => SORT_DESC,
'register_at' => SORT_DESC
]
];
//->andFilterWhere(['>', 'status_id', 11]);
/*->andFilterWhere(['<>', 'status_id', 12])
->andFilterWhere(['>', 'status_id', 3]);*/
$dataProvider->pagination = [
'pageSize' => 50
];
@ -237,7 +239,7 @@ class TaskController extends \yii\web\Controller
case 'autopsy':
return $this->redirect(['/pathologist/do/autopsy', 'id_case' => $id_case]);
break;
/*case 'dish':
/*case 'dish':
return $this->redirect(['/pathologist/do/dish', 'id_case' => $id_case]);
break;
case 'fish':
@ -255,7 +257,7 @@ class TaskController extends \yii\web\Controller
case 'surgical':
return $this->redirect(['/pathologist/do/surgical', 'id_case' => $id_case]);
break;
/* case 'flow':
/* case 'flow':
return $this->redirect(['/pathologist/do/flow', 'id_case' => $id_case]);
break;
case 'molecular':
@ -283,7 +285,7 @@ class TaskController extends \yii\web\Controller
case 'autopsy':
return $this->redirect(['/pathologist/do/autopsy-preview', 'id_case' => $id_case, 'mode' => $mode]);
break;
/* case 'dish':
/* case 'dish':
return $this->redirect(['/pathologist/do/dish-preview', 'id_case' => $id_case, 'mode' => $mode]);
break;
case 'fish':
@ -323,7 +325,7 @@ class TaskController extends \yii\web\Controller
case 'autopsy':
return CaseAutopsy::findOne(['id_case' => $id_case]);
break;
/*case 'dish':
/*case 'dish':
return CaseDish::findOne(['id_case' => $id_case]);
break;
case 'fish':
@ -341,7 +343,7 @@ class TaskController extends \yii\web\Controller
case 'surgical':
return CaseSurgical::findOne(['id_case' => $id_case]);
break;
/*case 'flow':
/*case 'flow':
return CaseFlow::findOne(['id_case' => $id_case]);
break;
case 'molecular':
@ -459,7 +461,7 @@ class TaskController extends \yii\web\Controller
$dataProvider->pagination = [
'pageSize' => 50,
];
/*$dataProvider->sort = [
'defaultOrder' => [
//'register_at' => SORT_DESC,
@ -954,5 +956,4 @@ class TaskController extends \yii\web\Controller
'searchModel' => $searchModel
]);
}
}

View File

@ -34,7 +34,7 @@ class PatientCaseSearch extends PatientCase
'query' => $query,
'sort' => [
'defaultOrder' => [
'register_at' => SORT_DESC
'id_case' => SORT_DESC
]
]
]);

View File

@ -14,6 +14,7 @@ use common\models\CaseSurgical;
use common\models\CenterApprove;
use common\models\CytoNonGynDiagnosis;
use common\models\CytoPapDiagnosis;
use common\models\FrozenDiagnosis;
use common\models\SurgicalDiagnosis;
$this->title = 'All My Case';
@ -263,6 +264,51 @@ $this->params['breadcrumbs'][] = $this->title;
} //non_gyn_count
}
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>';
} //frozen_count
}
if ($case_type == 'autopsy') {
$autopsy_count = AutopsyDiagnosis::find()
->where([
@ -336,7 +382,7 @@ $this->params['breadcrumbs'][] = $this->title;
//return '<strong>' . $model->id_case . '</strong> ' . Yii::$app->pathology->getExpress($model) . ' ' . Yii::$app->pathology->getCaseDate($model->id_case) . $rt;
return '<strong>' . $model->id_case . '</strong> '
. ($case_type == 'autopsy' ? Yii::$app->pathology->getExpressAutopsy($model) : Yii::$app->pathology->getExpress($model)) . ' '
. ($case_type == 'autopsy' ? Yii::$app->pathology->getExpressAutopsy($model) : Yii::$app->pathology->getExpress($model)) . ' '
. Yii::$app->pathology->getCaseDate($model->id_case)
. $rt;
}

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,6 @@ $this->params['breadcrumbs'][] = $this->title;
<?php /* foreach ($case->getReport() as $file => $val) { ?>
<?= Html::a(Html::img(Yii::getAlias('@web') . '/img/icon/pdf-red.png', ['width' => 30]), Yii::getAlias('@web') . '/' . $case->uploadReportFolder . '/' . $val, ['target' => '_blank', 'class' => 'text-success']); ?>
<?php } */ ?>
<?php
foreach ($case->getReport() as $key => $value) {
$fileExtension = pathinfo($case->uploadReportFolder . '/' . $value, PATHINFO_EXTENSION);