diff --git a/frontend/modules/register/controllers/HospitalImportController.php b/frontend/modules/register/controllers/HospitalImportController.php
index 5e826896..066764ae 100755
--- a/frontend/modules/register/controllers/HospitalImportController.php
+++ b/frontend/modules/register/controllers/HospitalImportController.php
@@ -43,6 +43,7 @@ use common\models\HospitalImport;
use common\models\ConstOrderPoint;
use yii\web\NotFoundHttpException;
use common\models\ConstNationality;
+use common\models\ConstOrgan;
use common\models\ConstServiceCharge;
use common\models\FinanceServiceCharge;
use common\models\HospitalImportServiceCharge;
@@ -329,7 +330,6 @@ class HospitalImportController extends Controller
'data' => $his_hn,
'message' => 'นำเข้าข้อมูลสำเร็จ จำนวน ' . $imported_count . ' รายการ',
];
-
} catch (Exception $e) {
return [
'status' => 'error',
diff --git a/frontend/modules/register/controllers/StatController.php b/frontend/modules/register/controllers/StatController.php
index e31ce14a..127b84fc 100755
--- a/frontend/modules/register/controllers/StatController.php
+++ b/frontend/modules/register/controllers/StatController.php
@@ -737,6 +737,56 @@ class StatController extends \yii\web\Controller
]);
}
+ public function actionDiagnosisSurgicalOutlab()
+ {
+ $dataProvider = false;
+ $data = false;
+ $model = new DateForm();
+ if ($model->load(Yii::$app->request->get())) {
+ //$pathologist_stat = !empty($model->pathologist_id) ? 'AND case_surgical.pathologist_id = ' . Html::encode($model->pathologist_id) : '';
+ $outlab_stat = !empty($model->outlab_id) ? 'AND case_surgical.outlab_id = ' . Html::encode($model->outlab_id) : '';
+ $sql = "
+ SELECT
+ case_surgical.id_case,
+ h_n,
+ patient_title.name AS title,
+ given_name,
+ surname,
+ const_outlab.name AS outlab,
+ receive_at,
+ surgical_diagnosis.pathologist_at AS patho_at
+ FROM
+ case_surgical
+ LEFT JOIN
+ surgical_diagnosis ON surgical_diagnosis.id_case = case_surgical.id_case
+ LEFT JOIN
+ user_table AS pathologist_user ON pathologist_user.id = case_surgical.pathologist_id
+ LEFT JOIN
+ patient_title ON patient_title.id = case_surgical.title_id
+ LEFT JOIN
+ const_outlab ON const_outlab.id = case_surgical.outlab_id
+ WHERE
+ (surgical_diagnosis.pathologist_at BETWEEN '" . Yii::$app->pathology->searchDateStart($model->date_start) . " 00:00:00'
+ AND '" . Yii::$app->pathology->searchDateEnd($model->date_end) . " 23:59:59')
+ AND surgical_diagnosis.report_type = 'outlab'
+ " . $outlab_stat . "
+ ORDER BY
+ case_surgical.id_case ASC;
+ ";
+
+ $data = Yii::$app->db->createCommand($sql)->queryAll();
+ $dataProvider = new ArrayDataProvider([
+ 'allModels' => $data,
+ 'pagination' => false,
+ ]);
+ }
+
+ return $this->render('diagnosis-surgical-outlab', [
+ 'dataProvider' => $dataProvider,
+ 'data' => $data,
+ 'model' => $model
+ ]);
+ }
public function actionDiagnosisSurgicalConsultOutlab()
{
@@ -783,4 +833,55 @@ class StatController extends \yii\web\Controller
'model' => $model
]);
}
-}
+
+ public function actionStatKidney()
+ {
+ $dataProvider = false;
+ $data = false;
+ $model = new DateForm();
+ if ($model->load(Yii::$app->request->get())) {
+ $pathologist_stat = !empty($model->pathologist_id) ? 'AND case_surgical.pathologist_id = ' . Html::encode($model->pathologist_id) : '';
+ //$organ_stat = !empty($model->organ_code) ? 'AND surgical_diagnosis.organ_code = ' . Html::encode($model->organ_code) : '';
+ $sql = "
+ SELECT
+ case_surgical.id_case,
+ h_n,
+ patient_title.name AS title,
+ given_name,
+ surname,
+ const_organ.name AS organ,
+ const_organ_code.code AS organ_code,
+ surgical_diagnosis.organ_remark AS organ_remark,
+ const_organ_code.price AS organ_price,
+ const_ward.name AS ward,
+ pathologist_user.report_name AS pathologist
+ FROM case_surgical
+ LEFT JOIN surgical_diagnosis ON surgical_diagnosis.id_case = case_surgical.id_case
+ LEFT JOIN const_ward ON const_ward.id = case_surgical.ward_id
+ LEFT JOIN const_organ ON const_organ.id = surgical_diagnosis.organ_id
+ LEFT JOIN const_organ_code ON const_organ_code.id = surgical_diagnosis.organ_code
+ LEFT JOIN user_table AS pathologist_user ON pathologist_user.id = case_surgical.pathologist_id
+ LEFT JOIN patient_title ON patient_title.id = case_surgical.title_id
+ WHERE
+ (receive_at BETWEEN '" . Yii::$app->pathology->searchDateStart($model->date_start) . " 00:00:00'
+ AND '" . Yii::$app->pathology->searchDateEnd($model->date_end) . " 23:59:59')
+ AND case_surgical.is_kidney = 1
+ " . $pathologist_stat . "
+ GROUP BY case_surgical.id_case
+ ORDER BY case_surgical.id_case ASC
+ ";
+
+ $data = Yii::$app->db->createCommand($sql)->queryAll();
+
+ $dataProvider = new ArrayDataProvider([
+ 'allModels' => $data,
+ 'pagination' => false,
+ ]);
+ }
+ return $this->render('stat-kidney', [
+ 'dataProvider' => $dataProvider,
+ 'data' => $data,
+ 'model' => $model
+ ]);
+ }
+}
\ No newline at end of file
diff --git a/frontend/modules/register/models/DateForm.php b/frontend/modules/register/models/DateForm.php
index 814393f6..fc0ac41e 100755
--- a/frontend/modules/register/models/DateForm.php
+++ b/frontend/modules/register/models/DateForm.php
@@ -13,6 +13,7 @@ class DateForm extends Model
public $pathologist_id;
public $cancer_registry_id;
public $organ_code;
+ public $outlab_id;
/**
* @return array|array[]
*/
@@ -20,7 +21,7 @@ class DateForm extends Model
{
return [
[['date_start', 'date_end'], 'required'],
- [['pathologist_id', 'cancer_registry_id', 'organ_code'], 'integer'],
+ [['pathologist_id', 'cancer_registry_id', 'organ_code', 'outlab_id'], 'integer'],
];
}
@@ -36,6 +37,7 @@ class DateForm extends Model
'date_end' => 'วันสิ้นสุด',
'pathologist_id' => 'พยาธิแพทย์',
'cancer_registry_id' => 'Cancer Registry',
+ 'outlab_id' => 'หน่วยงานที่ส่งตรวจ Outlab',
'organ_code' => 'Organ Code',
];
}
diff --git a/frontend/modules/register/views/case/_form_surgical.php b/frontend/modules/register/views/case/_form_surgical.php
index a44c8666..5b6072fd 100755
--- a/frontend/modules/register/views/case/_form_surgical.php
+++ b/frontend/modules/register/views/case/_form_surgical.php
@@ -468,81 +468,44 @@ use yii\web\View;
]) ?>
-
-
-
-
-
- = $form->field($model, 'clinical_diagnosis')->textarea(['rows' => 5, 'cols' => 50, 'spellcheck' => true])/*->widget(CKEditor::class, [
- 'preset' => 'custom',
- 'clientOptions' => [
- 'height' => 120,
- 'extraPlugins' => 'font',
- //'extraPlugins' => 'mentions,autocomplete,textwatcher',
- 'removeButtons' => '',
- 'toolbarGroups' => [
- ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste']],
- ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
- ['name' => 'paragraph', 'groups' => ['list', 'align']],
- ['name' => 'editing', 'groups' => ['find', 'selection', 'spellchecker']],
- ['name' => 'insert', 'groups' => ['table']],
- ['name' => 'tools', 'groups' => ['maximize']],
- //['name' => 'styles', 'groups' => ['font']],
- ],
- ]
- ])*/ ?>
-
-
-
- = $form->field($model, 'remark')->textarea(['rows' => 5, 'cols' => 50]) ?>
-
registerJs("
- $(\"input[name='" . Html::getInputName($model, 'is_express') . "']\").change(function() {
- if(this.checked == true){
- $('.express_div').show();
- }else{
- $('.express_div').hide();
- }
- });
- ") ?>
-
+ $(\"input[name='" . Html::getInputName($model, 'is_express') . "']\").change(function() {
+ if(this.checked == true){
+ $('.express_div').show();
+ }else{
+ $('.express_div').hide();
+ }
+ });
+ ") ?>
+
= $form->field($model, 'is_express')->checkbox() ?>
-
isNewRecord && $model->is_express ? '' : 'style="display: none;"' ?>>
-
-
- = $form->field($model, 'express_day')->dropDownList(['' => '', '3' => 'ผลด่วน 3 วัน', '5' => 'ผลด่วน 5 วัน', '7' => 'ผลด่วน 7 วัน']) ?>
-
-
- = $form->field($model, 'express_at')->widget(\kartik\date\DatePicker::class, [
- 'pluginOptions' => [
- 'format' => 'dd/mm/yyyy',
- 'allowClear' => true,
- 'autoclose' => true,
- 'todayHighlight' => true,
- 'todayBtn' => true,
- ]
- ]) ?>
-
+
isNewRecord && $model->is_express ? '' : 'style="display:none;"' ?>>
+ = $form->field($model, 'express_day')->dropDownList(['' => '', '3' => 'ผลด่วน 3 วัน', '5' => 'ผลด่วน 5 วัน', '7' => 'ผลด่วน 7 วัน']) ?>
-
+
isNewRecord && $model->is_express ? '' : 'style="display:none;"' ?>>
+ = $form->field($model, 'express_at')->widget(\kartik\date\DatePicker::class, [
+ 'pluginOptions' => [
+ 'format' => 'dd/mm/yyyy',
+ 'allowClear' => true,
+ 'autoclose' => true,
+ 'todayHighlight' => true,
+ 'todayBtn' => true,
+ ]
+ ]) ?>
+
+ db->createCommand("
+ SELECT DATE_FORMAT(off_at, '%Y-%m-%d') FROM hr_day_off
+ ")->queryColumn();
- db->createCommand("
- SELECT DATE_FORMAT(off_at, '%Y-%m-%d') FROM hr_day_off
- ")->queryColumn();
-
- // ส่งเป็น JSON เพื่อใช้ใน JS
- $holidayJson = Json::encode($holidayDates);
- $this->registerJs("
- var holidays = $holidayJson;
+ // ส่งเป็น JSON เพื่อใช้ใน JS
+ $holidayJson = Json::encode($holidayDates);
+ $this->registerJs("
+ var holidays = $holidayJson;
$('#" . Html::getInputId($model, 'express_day') . "').on('change', function() {
var receiveDate = $('#" . Html::getInputId($model, 'receive_at') . "').val();
@@ -583,81 +546,53 @@ use yii\web\View;
}
});
");
- ?>
-
-
- registerJs("
- $('#" . Html::getInputId($model, 'express_day') . "').on('change', function() {
- // Get the selected value
- var selectedValue = $(this).val();
- //alert(selectedValue);
- var currentDate = new Date();
- if (selectedValue == 3 || selectedValue == 5 || selectedValue == 7) {
- // Determine the number of days to add based on the selected value
- var daysToAdd;
- if (selectedValue == 3) {
- daysToAdd = 3;
- } else if (selectedValue == 5) {
- daysToAdd = 5;
- } else if (selectedValue == 7) {
- daysToAdd = 7;
- }
-
- // Add the specified number of days to the current date, skipping holidays, Saturdays, and Sundays
- var newDate = addBusinessDays(currentDate, daysToAdd);
-
- // Display the new date
- $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate));
-
- //alert(formatDate(newDate));
- }
-
- // Update the content of the
with the selected value
- //$('#selectedValue').text(selectedValue);
-
- function addBusinessDays(date, days) {
- var count = 0;
- while (count < days) {
- date.setDate(date.getDate() + 1);
- if (isWorkingDay(date)) {
- count++;
- }
- }
- return date;
- }
-
- function isWorkingDay(date) {
- // Check if the date is a Saturday or Sunday
- if (date.getDay() === 0 || date.getDay() === 6) {
- return false;
- }
- // Add logic here to check if the date is a holiday
- // You need to implement the logic to determine holidays based on your requirements
- // For simplicity, I'm leaving this part for you to implement
- return true;
- }
-
- function formatDate(date) {
- var day = date.getDate();
- var month = date.getMonth() + 1; // Months are zero-based
- var year = date.getFullYear();
-
- // Add leading zeros if needed
- day = (day < 10) ? '0' + day : day;
- month = (month < 10) ? '0' + month : month;
-
- // Return the formatted date
- return day + '/' + month + '/' + year;
- }
- });
- ");
- */ ?>
-
+ ?>
= $form->field($model, 'is_molecular')->checkbox() ?>
+
+ = $form->field($model, 'is_kidney')->checkbox() ?>
+
+
+
+
+
+
+
+
+
+ = $form->field($model, 'clinical_diagnosis')->textarea(['rows' => 5, 'cols' => 50, 'spellcheck' => true])/*->widget(CKEditor::class, [
+ 'preset' => 'custom',
+ 'clientOptions' => [
+ 'height' => 120,
+ 'extraPlugins' => 'font',
+ //'extraPlugins' => 'mentions,autocomplete,textwatcher',
+ 'removeButtons' => '',
+ 'toolbarGroups' => [
+ ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste']],
+ ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']],
+ ['name' => 'paragraph', 'groups' => ['list', 'align']],
+ ['name' => 'editing', 'groups' => ['find', 'selection', 'spellchecker']],
+ ['name' => 'insert', 'groups' => ['table']],
+ ['name' => 'tools', 'groups' => ['maximize']],
+ //['name' => 'styles', 'groups' => ['font']],
+ ],
+ ]
+ ])*/ ?>
+
+
+
+
+ = $form->field($model, 'remark')->textarea(['rows' => 5, 'cols' => 50]) ?>
+
+
+
isNewRecord) { ?>
รายการ Specimen
diff --git a/frontend/modules/register/views/const-outlab/view.php b/frontend/modules/register/views/const-outlab/view.php
index 5bf4ab05..765c11df 100644
--- a/frontend/modules/register/views/const-outlab/view.php
+++ b/frontend/modules/register/views/const-outlab/view.php
@@ -48,8 +48,8 @@ $this->params['breadcrumbs'][] = $this->title;
'value' => function ($model) {
// mapping สำหรับสถานะ (Bootstrap 5 ใช้ bg-*)
$arr = [
- 1 => '
ใช้งาน',
- 2 => '
ไม่ใช้งาน',
+ 1 => '
ใช้งาน',
+ 2 => '
ไม่ใช้งาน',
];
// แปลงเป็น int เพื่อความแน่นอน แล้วคืนค่า default เมื่อไม่มีคีย์
diff --git a/frontend/modules/register/views/stat/diagnosis-surgical-outlab.php b/frontend/modules/register/views/stat/diagnosis-surgical-outlab.php
new file mode 100644
index 00000000..0c566035
--- /dev/null
+++ b/frontend/modules/register/views/stat/diagnosis-surgical-outlab.php
@@ -0,0 +1,176 @@
+title = 'รายงานผล Surgical Outlab';
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
+
+
+
+ 'get', 'action' => ['diagnosis-surgical-outlab']]) ?>
+
+
+ = $form->field($model, 'date_start')->widget(DatePicker::class, [
+ 'pluginOptions' => [
+ 'format' => 'dd/mm/yyyy',
+ 'allowClear' => true,
+ 'autoclose' => true,
+ 'todayHighlight' => true,
+ 'todayBtn' => true,
+ 'endDate' => date('d/m/Y'),
+ ]
+ ]) ?>
+
+
+ = $form->field($model, 'date_end')->widget(DatePicker::class, [
+ 'pluginOptions' => [
+ 'format' => 'dd/mm/yyyy',
+ 'allowClear' => true,
+ 'autoclose' => true,
+ 'todayHighlight' => true,
+ 'todayBtn' => true,
+ 'endDate' => date('d/m/Y'),
+ ]
+ ]) ?>
+
+
+ = $form->field($model, 'outlab_id')->widget(Select2::class, [
+ 'data' => ArrayHelper::map(ConstOutlab::find()->where(['status' => 1])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1')
+ 'theme' => Select2::THEME_BOOTSTRAP,
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ 'placeholder' => 'เลือกหน่วยงานที่ส่งตรวจ Outlab...'
+ ],
+ ]) ?>
+
+
+ = Html::submitButton('
ค้นหา', ['class' => 'btn btn-primary']) ?>
+
+
+
+
+load(Yii::$app->request->get())) { ?>
+
+
+
+
+
+
= $this->title . ' :' . ' ' . Yii::$app->pathology->thaiDate($model->date_start) . ' ถึง ' . Yii::$app->pathology->thaiDate($model->date_end) ?>
+
+
+
+
+
+
+
+ | ลำดับที่ |
+ ID CASE |
+ HN |
+ ชื่อคนไข้ |
+ หน่วยงานที่ส่งตรวจ |
+ วันที่รับสิ่งส่งตรวจ |
+ วันที่ออกผล |
+
+
+
+
+
+ $d): ?>
+
+
+
+ | = $row + 1 ?> |
+ = $d['id_case'] ?> |
+ = $d['h_n'] ?> |
+ = $d['title'] . $d['given_name'] . ' ' . $d['surname'] ?> |
+ = $d['outlab'] ?> |
+
+
+ = (new DateTime($d['receive_at']))->format('d/m/Y') ?>
+
+ |
+ = !empty($d['patho_at']) ? date('d/m/Y H:i', strtotime($d['patho_at'])) : '' ?>
+ |
+
+
+
+
+
+
+
+
จำนวน Case ทั้งหมด: = $count ?> Case
+
+
+
+
+
+
+
+registerJsFile(Yii::getAlias('@web') . '/js/tableexport-xls-bold-headers.js', ['depends' => ['yii\web\JqueryAsset']]) ?>
+
+registerJs("
+$(\"#btnExcel\").click(function(){
+ $(\"#dailyDetail\").tableExport({
+ type: 'excel',
+ escape: 'false',
+ filename: '" . $model->date_start . '-' . $model->date_end . '-' . $this->title . ".xls'
+ });
+});
+") ?>
+
+
+
\ No newline at end of file
diff --git a/frontend/modules/register/views/stat/stat-kidney.php b/frontend/modules/register/views/stat/stat-kidney.php
new file mode 100644
index 00000000..efcefabe
--- /dev/null
+++ b/frontend/modules/register/views/stat/stat-kidney.php
@@ -0,0 +1,170 @@
+title = 'รายงานผล Kidney';
+$this->params['breadcrumbs'][] = $this->title;
+
+?>
+
+
+
+
+ 'get', 'action' => ['stat-kidney']]) ?>
+
+
+ = $form->field($model, 'date_start')->widget(DatePicker::class, [
+ 'pluginOptions' => [
+ 'format' => 'dd/mm/yyyy',
+ 'allowClear' => true,
+ 'autoclose' => true,
+ 'todayHighlight' => true,
+ 'todayBtn' => true,
+ 'endDate' => date('d/m/Y'),
+ ]
+ ]) ?>
+
+
+ = $form->field($model, 'date_end')->widget(DatePicker::class, [
+ 'pluginOptions' => [
+ 'format' => 'dd/mm/yyyy',
+ 'allowClear' => true,
+ 'autoclose' => true,
+ 'todayHighlight' => true,
+ 'todayBtn' => true,
+ 'endDate' => date('d/m/Y'),
+ ]
+ ]) ?>
+
+
+ = $form->field($model, 'pathologist_id')->dropDownList(ArrayHelper::map(User::find()
+ ->where(['like', 'role', 'pathologist'])
+ ->andWhere(['status' => User::STATUS_ACTIVE])
+ ->orderBy(['realname' => SORT_DESC])
+ ->all(), 'id', 'realname'), ['prompt' => 'เลือกพยาธิแพทย์....'])
+ ?>
+
+
+ = Html::submitButton('
ค้นหา', ['class' => 'btn btn-primary']) ?>
+
+
+
+
+load(Yii::$app->request->get())) { ?>
+
+
+
+
+
+
= $this->title . ' :' . ' ' . Yii::$app->pathology->thaiDate($model->date_start) . ' ถึง ' . Yii::$app->pathology->thaiDate($model->date_end) ?>
+
+
+
+
+
+
+
+ | # |
+ ID CASE |
+ H N |
+ ชื่อคนไข้ |
+
+ Ward |
+
+
+
+
+ $d): ?>
+
+
+
+ | = $row + 1 ?> |
+ = $d['id_case'] ?> |
+ = $d['h_n'] ?> |
+ = $d['title'] . $d['given_name'] . ' ' . $d['surname'] ?> |
+
+ = $d['ward'] ?> |
+
+
+
+
+
+
+
+
จำนวน Case ทั้งหมด: = $count ?> Case
+
+
+
+
+
+
+
+registerJsFile(Yii::getAlias('@web') . '/js/tableexport-xls-bold-headers.js', ['depends' => ['yii\web\JqueryAsset']]) ?>
+
+registerJs("
+$(\"#btnExcel\").click(function(){
+ $(\"#dailyDetail\").tableExport({
+ type: 'excel',
+ escape: 'false',
+ filename: '" . $model->date_start . '-' . $model->date_end . '-' . $this->title . ".xls'
+ });
+});
+") ?>
+
+
+
\ No newline at end of file
diff --git a/frontend/themes/nikom/views/layouts/_menu.php b/frontend/themes/nikom/views/layouts/_menu.php
index 3f6f44d4..94919c88 100755
--- a/frontend/themes/nikom/views/layouts/_menu.php
+++ b/frontend/themes/nikom/views/layouts/_menu.php
@@ -300,7 +300,9 @@ if (Yii::$app->user->can('center')) {
'options' => ['class' => 'treeview'],
'items' => [
['label' => '
สถิติการรายงานผล Surgical', 'url' => ['/register/stat/diagnosis-surgical']],
+ ['label' => '
สถิติการรายงานผล Kidney', 'url' => ['/register/stat/stat-kidney']],
['label' => '
สถิติการรายงานผล Frozen', 'url' => ['/register/stat/diagnosis-frozen']],
+ ['label' => '
สถิติการรายงานผล
Surgical Outlab', 'url' => ['/register/stat/diagnosis-surgical-outlab']],
['label' => '
สถิติการรายงานผล
Surgical Consult Outlab', 'url' => ['/register/stat/diagnosis-surgical-consult-outlab']],
['label' => '
สถิติ Cancer Registry', 'url' => ['/register/stat/diagnosis-cancer-registry']],
['label' => '
สถิติการรายงานผล Non Gyn', 'url' => ['/register/stat/diagnosis-non-gyn']],
diff --git a/frontend/web/patho_reports/SCAN_1970-01-01__1715932_S68-00008_68225243__.pdf b/frontend/web/patho_reports/SCAN_1970-01-01__1715932_S68-00008_68225243__.pdf
new file mode 100644
index 00000000..1a0ebc9c
Binary files /dev/null and b/frontend/web/patho_reports/SCAN_1970-01-01__1715932_S68-00008_68225243__.pdf differ