From 5d733bbfaa566d7735acf71e0c0a52bdbfce5348 Mon Sep 17 00:00:00 2001 From: mrkcp Date: Tue, 1 Apr 2025 16:27:47 +0700 Subject: [PATCH 01/13] update --- .../controllers/CaseUpdateController.php | 203 +++++++++++++++--- .../register/views/case-update/external.php | 9 + .../register/views/case/_form_external.php | 90 ++------ 3 files changed, 202 insertions(+), 100 deletions(-) create mode 100644 frontend/modules/register/views/case-update/external.php diff --git a/frontend/modules/register/controllers/CaseUpdateController.php b/frontend/modules/register/controllers/CaseUpdateController.php index 7bab4567..4131d0e2 100755 --- a/frontend/modules/register/controllers/CaseUpdateController.php +++ b/frontend/modules/register/controllers/CaseUpdateController.php @@ -2,42 +2,43 @@ namespace frontend\modules\register\controllers; -use common\models\AutopsyDiagnosis; -use common\models\CaseAutopsy; +use Yii; +use yii\web\Response; +use yii\base\Exception; +use common\models\CaseHpv; +use common\models\CasePap; +use common\models\Patient; use common\models\CaseDish; use common\models\CaseFish; -use common\models\CaseFrozen; use common\models\CaseFlow; -use common\models\CaseHpv; -use common\models\CaseMolecular; -use common\models\CaseNecropsy; -use common\models\CytoSpecimen; -use Yii; -use common\models\CaseSurgical; -use common\models\HistoStaining; -use common\models\ImmunoStaining; -use common\models\Patient; -use common\models\StainingTest; -use yii\base\Exception; -use yii\web\Response; use yii\widgets\ActiveForm; -use common\models\CasePap; +use common\models\CaseFrozen; use common\models\CaseNonGyn; +use common\models\CaseAutopsy; +use common\models\CaseExternal; +use common\models\CaseNecropsy; +use common\models\CaseSurgical; +use common\models\CytoSpecimen; +use common\models\StainingTest; +use common\models\CaseMolecular; use common\models\ConstHospital; -use common\models\ConstLookupAddressName; -use common\models\ConstServiceCharge; -use common\models\CytoNonGynContainer; -use common\models\CytoNonGynDiagnosis; -use common\models\CytoPapDiagnosis; use common\models\DishDiagnosis; -use common\models\FinanceServiceCharge; use common\models\FishDiagnosis; use common\models\FlowDiagnosis; +use common\models\HistoStaining; +use common\models\ImmunoStaining; use common\models\FrozenDiagnosis; -use common\models\MolecularDiagnosis; +use common\models\AutopsyDiagnosis; +use common\models\CytoPapDiagnosis; use common\models\NecropsyDiagnosis; use common\models\SurgicalContainer; use common\models\SurgicalDiagnosis; +use common\models\ConstServiceCharge; +use common\models\MolecularDiagnosis; +use common\models\CytoNonGynContainer; +use common\models\CytoNonGynDiagnosis; +use common\models\FinanceServiceCharge; +use common\models\ConstLookupAddressName; /** * Class CaseUpdateController @@ -102,6 +103,9 @@ class CaseUpdateController extends \yii\web\Controller if ($case_type == 'hpv') { return $this->redirect(['hpv', 'id_case' => $id_case]); } + if ($case_type == 'external') { + return $this->redirect(['external', 'id_case' => $id_case]); + } Yii::$app->session->setFlash('error', 'ไม่พบ Case นี้'); return $this->redirect(['/register/center/case-all']); @@ -1412,7 +1416,7 @@ class CaseUpdateController extends \yii\web\Controller Yii::$app->session->setFlash('success', 'ลงทะเบียน NonGyn เรียบร้อยแล้ว'); return $this->redirect(['/register/case-update/non-gyn', 'id_case' => $model->id_case]); } catch (Exception $e) { - + $transaction->rollBack(); Yii::$app->session->setFlash('error', 'ไม่สามารถลงทะเบียน Case ได้'); /*var_dump($model->getFirstErrors()); @@ -1667,6 +1671,155 @@ class CaseUpdateController extends \yii\web\Controller echo 'success'; } }*/ + + + + /** */ + /* + * Update Staining Case + */ + public function actionExternal($id_case) + { + $time_now = date('Y-m-d H:i:s'); + $model = CaseExternal::findOne(['id_case' => $id_case]); + + if (!$model) { + Yii::$app->session->setFlash('error', 'ไม่มี Case นี้ในระบบ'); + return $this->redirect(['/site/index']); + } + + $model->autocomplete_patient = '-'; + $model->autocomplete_title = '-55'; + $patient = isset($model->patient) ? $model->patient : new Patient(); + + $request = Yii::$app->getRequest(); + if ($request->isPost && $request->post('ajax') !== null) { + $model->load(Yii::$app->request->post()); + $patient->load(Yii::$app->request->post()); + Yii::$app->response->format = Response::FORMAT_JSON; + $result = ActiveForm::validate($model, $patient); + return $result; + } + if ($model->load(Yii::$app->request->post())) { + $transaction = Yii::$app->db->beginTransaction(); + + try { + + + + if ($model->status == 1) { + $model->status_id = 16; //ยกเลิกcase + } + if ($model->status == 0) { + $model->status_id = 1; //ยกเลิก การยกเลิกcase + } + + + $valid = true; + if ($model->is_histo_staining == 0 && $model->is_immuno_staining == 0) { + $model->addError('is_histo_staining', 'กรุณาเลือกการย้อม'); + $model->addError('is_immuno_staining', 'กรุณาเลือกการย้อม'); + $valid = false; + } + + //บันทึกผู้ป่วย + if (intval($model->patient_id)) { // เลือกผู้ป่วยที่มีอยู่แล้ว + $patient = Patient::findOne($model->patient_id); + $patient->load(Yii::$app->request->post()); + $patient->save(false); + } else { + + + + if ($model->autocomplete_patient == '-') { + $model->patient_id = null; + } else { + $patient = new Patient(); + $patient->load(Yii::$app->request->post()); //เมื่อมีการใส่ชื่อค่อยโหลด + $patient->title_id = $_POST['CaseExternal']['autocomplete_title']; + $patient->name = $model->autocomplete_patient; // หากเพิ่มผู้ป่วยใหม่ให้กำหนดชื่อให้ patient แล้วบันทึก + $patient->create_at = $time_now; + if (empty($patient->age)) { + $patient->age = 0; + } + + $patient->save(false); + + $model->patient_id = $patient->id; + } + } + if ($model->save()) { + + if ($model->is_histo_staining == 1) { //ส่งย้อม Histo + $staining = HistoStaining::findOne(['id_case' => $model->id_case]); + if (!$staining) { + $staining = new HistoStaining(); + $staining->id_case = $model->id_case; + $staining->block_no = ''; + $staining->note = ''; + $staining->is_able = 0; + $staining->is_routine = 0; + $staining->status_1 = 1; + $staining->in_at = $time_now; + $staining->save(); + } + } else { + $histo = HistoStaining::findOne(['id_case' => $model->id_case]); + if ($histo) { + foreach (HistoStaining::find()->where(['id_case' => $model->id_case])->all() as $hs) { + $hifi = FinanceServiceCharge::findOne(['from_id' => $hs->id, 'id_case' => $model->id_case]); + if ($hifi) { + $hifi->delete(); + } + HistoStaining::findOne(['id_case' => $model->id_case, 'id' => $hs->id])->delete(); + } + } + } + + if ($model->is_immuno_staining == 1) { //ส่งย้อม Immuno + $staining = new ImmunoStaining(); + $staining->id_case = $model->id_case; + $staining->block_no = ''; + $staining->note = ''; + $staining->status_1 = 1; + $staining->is_able = 0; + $staining->in_at = $time_now; + $staining->save(); + } else { + $immu = ImmunoStaining::findOne(['id_case' => $model->id_case]); + if ($immu) { + foreach (ImmunoStaining::find()->where(['id_case' => $model->id_case])->all() as $is) { + $imfi = FinanceServiceCharge::findOne(['from_id' => $is->id, 'id_case' => $model->id_case]); + if ($imfi) { + $imfi->delete(); + } + ImmunoStaining::findOne(['id_case' => $model->id_case, 'id' => $is->id])->delete(); + } + } + } + } + + //หากเปลี่ยน รพ. ให้ update all finance_service_charge ให้เป็น รพ.ใหม่ทั้งหมด + FinanceServiceCharge::updateAll(['hospital_id' => $model->hospital_id], 'id_case = \'' . $model->id_case . '\''); + + $transaction->commit(); + + Yii::$app->session->setFlash('success', 'แก้ไขข้อมูลเรียบร้อยแล้ว'); + return $this->redirect(['/register/case-update/external', 'id_case' => $model->id_case]); + } catch (Exception $e) { + $transaction->rollBack(); + } + } + + return $this->render('external', [ + 'model' => $model, + 'patient' => $patient, + ]); + } + /** */ + + + public function actionSurgicalContainerDelete() { Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; @@ -3077,4 +3230,4 @@ class CaseUpdateController extends \yii\web\Controller $subdistrict = ConstLookupAddressName::findOne(['province' => $province, 'amphur' => $amphur, 'tambon' => $tambon]); return isset($subdistrict) ? $subdistrict->zipcode : ''; } -} \ No newline at end of file +} diff --git a/frontend/modules/register/views/case-update/external.php b/frontend/modules/register/views/case-update/external.php new file mode 100644 index 00000000..8c623caa --- /dev/null +++ b/frontend/modules/register/views/case-update/external.php @@ -0,0 +1,9 @@ +title = 'Edit Case : ' . $model->id_case . ''; +?> + +render('../case/_form_external', [ + 'model' => $model, + 'patient' => $patient, +]) ?> \ No newline at end of file diff --git a/frontend/modules/register/views/case/_form_external.php b/frontend/modules/register/views/case/_form_external.php index 320491ec..5d5cfc6e 100644 --- a/frontend/modules/register/views/case/_form_external.php +++ b/frontend/modules/register/views/case/_form_external.php @@ -5,11 +5,13 @@ use yii\helpers\Html; use yii\jui\AutoComplete; use yii\web\JsExpression; use kartik\select2\Select2; +use common\models\ConstRace; use yii\helpers\ArrayHelper; use yii\widgets\MaskedInput; use yii\bootstrap5\ActiveForm; use common\models\PatientTitle; use common\models\ConstHospital; +use common\models\ConstNationality; ?>
@@ -91,82 +93,20 @@ use common\models\ConstHospital; field($patient, 'title_id')->dropDownList(ArrayHelper::map(PatientTitle::find()->all(), 'id', 'name'), ['prompt' => 'เลือกคำนำหน้า']) ?>
- isNewRecord) { ?> - - field($model, 'autocomplete_patient')->widget( - AutoComplete::class, - [ - //'value' => (!$model->isNewRecord ? $model->patient->name : ''), - 'options' => [ - 'id' => 'autocomplete-patient', - 'class' => 'form-control', - ], - 'clientOptions' => [ - 'autoFill' => true, - 'minLength' => 3, - 'source' => new JsExpression(" - function( request, response ) { - - $.ajax({ - url: \"" . Url::to(['/register/case/get-patient-list']) . "\", - type: 'post', - dataType: \"json\", - data: { - search: request.term - }, - success: function( data ) { - response( data ); - } - }); - } - "), - 'select' => new JsExpression(" - function( event, ui ){ - - var patient_id = ui.item.id; - //console.log($('#" . Html::getInputId($model, 'patient_id') . "').val()); - $.get( - '" . Url::toRoute('/site/patient') . "', - { - patient_id: patient_id, - }, - function (data) - { - //alert(data.gender); - //set input here - $('#" . Html::getInputId($model, 'patient_id') . "').val(data.id); - $('#" . Html::getInputId($patient, 'title_id') . "').val(data.title_id); - $('#" . Html::getInputId($patient, 'gender') . "').val(data.gender); - $('#" . Html::getInputId($patient, 'race') . "').val(data.race); - $('#" . Html::getInputId($patient, 'id_card') . "').val(data.id_card); - $('#" . Html::getInputId($patient, 'birthdate') . "').val(data.birthdate); - $('#" . Html::getInputId($patient, 'age') . "').val(data.age); - $('#" . Html::getInputId($patient, 'age_unit') . "').val(data.age_unit); - $('#" . Html::getInputId($patient, 'h_n') . "').val(data.h_n); - console.log($('#" . Html::getInputId($model, 'patient_id') . "').val()); - } - ); - - } - ") - ], - - ] - ); ?> - - field($model, 'patient_id')->widget(Select2::class, [ - 'data' => ArrayHelper::map(Patient::find()->where('id > 1')->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), - 'options' => ['placeholder' => 'เลือกผู้ป่วย'], - 'pluginOptions' => [ - 'allowClear' => true, - ], - ])*/ ?> - field($patient, 'name') ?> - + field($patient, 'given_name') ?> +
+
+ field($patient, 'surname') ?> +
+
+ field($patient, 'gender')->dropDownList(['U' => '', 'ช' => 'ชาย', 'ญ' => 'หญิง']) ?> +
+
+ field($patient, 'nation')->dropDownList(ArrayHelper::map(ConstNationality::find()->all(), 'id', 'name'), ['prompt' => 'Select Nationalily...']) ?> +
+
+ field($patient, 'race')->dropDownList(ArrayHelper::map(ConstRace::find()->all(), 'id', 'name'), ['prompt' => 'Select Race...']) ?>
-
- field($patient, 'gender')->dropDownList([3 => '', 0 => 'ชาย', 1 => 'หญิง']) ?>
-
field($patient, 'race')->textInput() ?>
From 32d67395985a42b99e209f84a2ff4b9529d77f0a Mon Sep 17 00:00:00 2001 From: Star Indy Date: Tue, 1 Apr 2025 22:25:25 +0700 Subject: [PATCH 02/13] fix --- common/models/CaseSurgical.php | 2 +- common/models/CytoNonGynDiagnosis.php | 3 +- .../histo/controllers/HeController.php | 8 +- .../pathologist/views/do/non-gyn-final.php | 166 ++++++------------ .../pathologist/views/order/staining.php | 4 +- .../controllers/CaseUpdateController.php | 2 +- .../report/controllers/CaseController.php | 11 +- .../report/views/case/_header_report.php | 5 +- .../report/views/case/_preview_non_gyn.php | 27 +-- .../report/views/case/_preview_surgical.php | 1 - .../surgical/views/case-surgical/all.php | 8 + 11 files changed, 96 insertions(+), 141 deletions(-) diff --git a/common/models/CaseSurgical.php b/common/models/CaseSurgical.php index ce66304e..2c30799e 100755 --- a/common/models/CaseSurgical.php +++ b/common/models/CaseSurgical.php @@ -147,7 +147,7 @@ class CaseSurgical extends PathologyActiveRecord return [ [['id_case', 'hospital_id', 'given_name'], 'required'], [['id_case', 'hospital_id'], 'required', 'on' => 'register'], - [['pathologist_id'], 'required', 'on' => 'update'], + //[['pathologist_id'], 'required', 'on' => 'update'], //[['note_id', 'cut_id'], 'required', 'on' => 'gross'], [['id_case'], 'unique'], [['autocomplete_hospital', 'autocomplete_patient', 'autocomplete_ward', /*'frozen_id_case', 'cons_pathologist',*/ 'hos_ref' /*'case_reference'*/, 'house', 'moo', 'soy', 'road', 'phone', 'email', 'review_remark'], 'string'], diff --git a/common/models/CytoNonGynDiagnosis.php b/common/models/CytoNonGynDiagnosis.php index bb8361a4..b14f0334 100755 --- a/common/models/CytoNonGynDiagnosis.php +++ b/common/models/CytoNonGynDiagnosis.php @@ -73,7 +73,7 @@ class CytoNonGynDiagnosis extends PathologyActiveRecord [['report_type', 'id_case'], 'required'], [['report_type', 'id_case'], 'required', 'on' => 'consult'], //[['diagnosis'], 'required', 'on' => 'pathologist'], - [['gross_description', 'comment', 'note', 'microscopic_description', 'diagnosis'], 'string'], + [['gross_description', 'comment', 'note', 'microscopic_description', 'diagnosis', 'suggestion'], 'string'], [['pathologist_id', 'status_id', 'is_critical_diagnosis', 'reference_img_id', 'is_edit_patient_information', 'cyto_non_gyn_diagnosis_id', 'diagnosis_type', 'pathologist2_id', 'is_agree', 'is_m', 'diag_by', 'is_no_microscopic', 'cytotech1_id', 'is_first_cancer', 'is_conference', 'is_cell_block', 'is_review', 'is_co_pathologist', 'co_pathologist_id', 'specimen_adequacy_1'], 'integer'], [['pathologist_at', 'cytotech1_at', 'conference_at', 'icdos', 'cell_block_at', 'review_at'], 'safe'], [['reason', 'diagnosis_comment', 'review_remark'], 'string'], @@ -119,6 +119,7 @@ class CytoNonGynDiagnosis extends PathologyActiveRecord 'is_review' => 'Review Block/Slides', 'review_remark' => 'Review Block/Slides Remark', 'is_co_pathologist' => 'Co Pathologist?', + 'suggestion' => 'Suggestion', 'co_pathologist_id' => 'Pathologist' ]; } diff --git a/frontend/modules/histo/controllers/HeController.php b/frontend/modules/histo/controllers/HeController.php index 140a6bee..e877cf40 100755 --- a/frontend/modules/histo/controllers/HeController.php +++ b/frontend/modules/histo/controllers/HeController.php @@ -156,11 +156,11 @@ class HeController extends Controller Yii::$app->session->setFlash('error', 'มีข้อผิดพลาดในการกรอกข้อมูล'); return $this->redirect(['section']); } - var_dump($model->id_case_block); - var_dump($model->id_case_slide); + //var_dump($model->id_case_block); + //var_dump($model->id_case_slide); - die(); + //die(); if ($model->id_case_block != $model->id_case_slide) { Yii::$app->session->setFlash('error', 'กรุณาระบุ Block และ Slide ให้ตรงกัน'); return $this->redirect(['section']); @@ -684,4 +684,4 @@ class HeController extends Controller $session->remove('he-staining-case'); return $this->redirect(['staining']); } -} +} \ No newline at end of file diff --git a/frontend/modules/pathologist/views/do/non-gyn-final.php b/frontend/modules/pathologist/views/do/non-gyn-final.php index 15fc576f..44287a3e 100755 --- a/frontend/modules/pathologist/views/do/non-gyn-final.php +++ b/frontend/modules/pathologist/views/do/non-gyn-final.php @@ -69,35 +69,8 @@ $this->params['breadcrumbs'][] = $this->title; -
Specimen And Clinical Information -
- - field($case_non_gyn, 'clinical_diagnosis')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ - 'preset' => 'custom', - 'clientOptions' => [ - 'height' => 150, - 'removePlugins' => 'scayt', - 'disableNativeSpellChecker' => false, - 'extraPlugins' => 'font,justify,colorbutton,iframe,dialogadvtab,liststyle', - 'removeButtons' => 'Source,Save,NewPage,Preview,Print,Templates,Find,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,PageBreak,Iframe,ShowBlocks,About,Replace,Snippet', - 'toolbarGroups' => [ - ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste', 'clipboard']], - ['name' => 'styles', 'groups' => ['font']], - ['name' => 'colors', 'groups' => ['TextColor', 'BGColor']], - ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], - ['name' => 'paragraph', 'groups' => ['list', 'align', 'bidi', 'paragraph']], - ['name' => 'editing', 'groups' => ['find', 'selection', /*'spellchecker'*/]], - //['name' => 'tools', 'groups' => ['dialogadvtab', 'devtools', 'div']], - ['name' => 'insert', 'groups' => ['table', 'specialchar']], - //['name' => 'tools', 'groups' => ['maximize']], - ], - ] - ]) ?> - -
Comment/Note -
- - field($model, 'comment')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ +
Diagnosis
+ field($model, 'diagnosis')->label(false)->inline()->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ 'preset' => 'custom', 'clientOptions' => [ 'height' => 200, @@ -118,9 +91,32 @@ $this->params['breadcrumbs'][] = $this->title; ], ] ]) ?> + registerJs(" + $('#checkDiagButton').on('click', function(event) { + event.preventDefault(); + var text = CKEDITOR.instances['cytonongyndiagnosis-diagnosis'].getData(); + + $.ajax({ + url: '" . Url::to(['/site/spell-checker']) . "', + type: 'POST', + data: { text: text }, + //dataType: 'json', + success: function(data) { + //highlightMisspelledWords(data); + $('#misspelledDiagWords').html(data); + } + }); + }); + + ") ?> +
+ + Check Spelling + + Diagnosis Template', ['class' => 'btn btn-info activity-select-diagnosis-template', 'data' => ['bs-toggle' => 'modal', 'bs-target' => '#activity-modal-diagnosis']]) ?> -
Gross - Description
+ +
Cytologic findings
field($model, 'gross_description')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ 'preset' => 'custom', @@ -173,64 +169,39 @@ $this->params['breadcrumbs'][] = $this->title;
-
Final Report
+
-
Microscopic Description
-
- field($model, 'is_no_microscopic')->checkbox() ?> - field($model, 'microscopic_description')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::class, [ - 'preset' => 'custom', - //'options' => ['id' => 'microscopic_description_editor'], - 'clientOptions' => [ - 'height' => 200, - 'removePlugins' => 'scayt', - 'disableNativeSpellChecker' => false, - 'extraPlugins' => 'font,justify,colorbutton,iframe,dialogadvtab,liststyle', - 'removeButtons' => 'Source,Save,NewPage,Preview,Print,Templates,Find,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,PageBreak,Iframe,ShowBlocks,About,Replace,Snippet', - 'toolbarGroups' => [ - ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste', 'clipboard']], - ['name' => 'styles', 'groups' => ['font']], - ['name' => 'colors', 'groups' => ['TextColor', 'BGColor']], - ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], - ['name' => 'paragraph', 'groups' => ['list', 'align', 'bidi', 'paragraph']], - ['name' => 'editing', 'groups' => ['find', 'selection', /*'spellchecker'*/]], - //['name' => 'tools', 'groups' => ['dialogadvtab', 'devtools', 'div']], - ['name' => 'insert', 'groups' => ['table', 'specialchar']], - //['name' => 'tools', 'groups' => ['maximize']], - ], - ] - ]) ?> -
-
-
- registerJs(" - $('#checkMicroButton').on('click', function(event) { - event.preventDefault(); - var text = CKEDITOR.instances['cytonongyndiagnosis-microscopic_description'].getData(); - - $.ajax({ - url: '" . Url::to(['/site/spell-checker']) . "', - type: 'POST', - data: { text: text }, - //dataType: 'json', - success: function(data) { - //highlightMisspelledWords(data); - $('#misspelledMicroWords').html(data); - } - }); - }); - - ") ?> - - Check Spelling - - Microscopic Template', ['class' => 'btn btn-info activity-select-microscopic-template', 'data' => ['bs-toggle' => 'modal', 'bs-target' => '#activity-modal-microscopic']]) ?> - เพิ่มรูปภาพ Micro', ['class' => 'btn btn-danger', 'value' => 'micro', 'name' => 'non-gyn']) ?> -
-
Diagnosis
- field($model, 'diagnosis')->label(false)->inline()->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ +
Comment/Note +
+ + field($model, 'comment')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ + 'preset' => 'custom', + 'clientOptions' => [ + 'height' => 200, + 'removePlugins' => 'scayt', + 'disableNativeSpellChecker' => false, + 'extraPlugins' => 'font,justify,colorbutton,iframe,dialogadvtab,liststyle', + 'removeButtons' => 'Source,Save,NewPage,Preview,Print,Templates,Find,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,PageBreak,Iframe,ShowBlocks,About,Replace,Snippet', + 'toolbarGroups' => [ + ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste', 'clipboard']], + ['name' => 'styles', 'groups' => ['font']], + ['name' => 'colors', 'groups' => ['TextColor', 'BGColor']], + ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], + ['name' => 'paragraph', 'groups' => ['list', 'align', 'bidi', 'paragraph']], + ['name' => 'editing', 'groups' => ['find', 'selection', /*'spellchecker'*/]], + //['name' => 'tools', 'groups' => ['dialogadvtab', 'devtools', 'div']], + ['name' => 'insert', 'groups' => ['table', 'specialchar']], + //['name' => 'tools', 'groups' => ['maximize']], + ], + ] + ]) ?> + +
Suggestion +
+ + field($model, 'suggestion')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ 'preset' => 'custom', 'clientOptions' => [ 'height' => 200, @@ -251,29 +222,6 @@ $this->params['breadcrumbs'][] = $this->title; ], ] ]) ?> - registerJs(" - $('#checkDiagButton').on('click', function(event) { - event.preventDefault(); - var text = CKEDITOR.instances['cytonongyndiagnosis-diagnosis'].getData(); - - $.ajax({ - url: '" . Url::to(['/site/spell-checker']) . "', - type: 'POST', - data: { text: text }, - //dataType: 'json', - success: function(data) { - //highlightMisspelledWords(data); - $('#misspelledDiagWords').html(data); - } - }); - }); - - ") ?> -
- - Check Spelling - - Diagnosis Template', ['class' => 'btn btn-info activity-select-diagnosis-template', 'data' => ['bs-toggle' => 'modal', 'bs-target' => '#activity-modal-diagnosis']]) ?>
render('_coder_non_gyn_form', [ diff --git a/frontend/modules/pathologist/views/order/staining.php b/frontend/modules/pathologist/views/order/staining.php index 74546144..830d4c64 100755 --- a/frontend/modules/pathologist/views/order/staining.php +++ b/frontend/modules/pathologist/views/order/staining.php @@ -401,7 +401,7 @@ $this->title = 'Pathologist Staining - สั่งย้อมพิเศษ ( 'required' => true, ], 'clientOptions' => [ - 'source' => ConstServiceCharge::find()->select(['id as id', 'code as value', 'CONCAT(code, \' \', name) as label'])->where(['lab' => 'immuno'])->orderBy(['code' => SORT_ASC])->asArray()->all(), + 'source' => ConstServiceCharge::find()->select(['id as id', 'code as value', 'CONCAT(code, \' \', name) as label'])->where(['lab' => 'immuno'])/*->orderBy(['code' => SORT_ASC])*/->asArray()->all(), 'change' => 'function(){$(this).init_immuno_charge();}', 'select' => new JsExpression("function( event, ui ) { $(this).val(ui.item.id); @@ -503,7 +503,7 @@ $this->title = 'Pathologist Staining - สั่งย้อมพิเศษ ( ") ?> - - is_critical_diagnosis ? '
(แจ้งแพทย์ด่วน)
' : '') ?> diff --git a/frontend/modules/surgical/views/case-surgical/all.php b/frontend/modules/surgical/views/case-surgical/all.php index d99be090..9d3ffedd 100755 --- a/frontend/modules/surgical/views/case-surgical/all.php +++ b/frontend/modules/surgical/views/case-surgical/all.php @@ -6,6 +6,7 @@ use kartik\select2\Select2; use yii\grid\GridView; use common\models\ConstStatus; use yii\helpers\ArrayHelper; +use yii\helpers\Html; use yii\widgets\MaskedInput; @@ -26,6 +27,13 @@ $this->params['breadcrumbs'][] = $this->title; 'layout' => "{summary}
\n{items}\n
{pager}
", 'columns' => [ ['class' => 'yii\grid\SerialColumn'], + [ + 'label' => 'Sticker', + 'format' => 'raw', + 'value' => function ($model) { + return Html::a(' Print Slides Sticker', ['/histo/case/he-sticker-auto', 'id_case' => $model->id_case], ['class' => 'btn btn-sm btn-info btn-block', 'target' => '_blank']); + } + ], [ 'attribute' => 'status_id', 'filter' => ArrayHelper::map(ConstStatus::find()->all(), 'id', 'status'), From 7bb6c5526fa66d43ad70c92511d9da7081fed5ae Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 00:03:43 +0700 Subject: [PATCH 03/13] fix cyto --- common/config/main-local.php | 13 +- common/models/CaseNonGyn.php | 12 +- common/models/CytoFixation.php | 46 +++++++ common/models/CytoSourceOfSpecimen.php | 46 +++++++ common/models/CytoTypeOfSpecimen.php | 46 +++++++ .../cyto/controllers/NonGynController.php | 5 +- .../cyto/views/non-gyn/non-gyn-final.php | 57 ++------ .../pathologist/views/do/non-gyn-final.php | 39 ++++++ .../controllers/CaseUpdateController.php | 4 +- .../controllers/CytoFixationController.php | 127 ++++++++++++++++++ .../CytoSourceOfSpecimenController.php | 127 ++++++++++++++++++ .../CytoTypeOfSpecimenController.php | 127 ++++++++++++++++++ .../register/models/CytoFixationSearch.php | 69 ++++++++++ .../models/CytoSourceOfSpecimenSearch.php | 69 ++++++++++ .../models/CytoTypeOfSpecimenSearch.php | 69 ++++++++++ .../register/views/case/_form_non_gyn.php | 26 +--- .../register/views/cyto-fixation/_form.php | 24 ++++ .../register/views/cyto-fixation/_search.php | 33 +++++ .../register/views/cyto-fixation/create.php | 27 ++++ .../register/views/cyto-fixation/index.php | 72 ++++++++++ .../register/views/cyto-fixation/update.php | 30 +++++ .../register/views/cyto-fixation/view.php | 44 ++++++ .../views/cyto-source-of-specimen/_form.php | 24 ++++ .../views/cyto-source-of-specimen/_search.php | 33 +++++ .../views/cyto-source-of-specimen/create.php | 27 ++++ .../views/cyto-source-of-specimen/index.php | 72 ++++++++++ .../views/cyto-source-of-specimen/update.php | 30 +++++ .../views/cyto-source-of-specimen/view.php | 44 ++++++ .../views/cyto-specimen-type/index.php | 2 +- .../views/cyto-type-of-specimen/_form.php | 24 ++++ .../views/cyto-type-of-specimen/_search.php | 33 +++++ .../views/cyto-type-of-specimen/create.php | 27 ++++ .../views/cyto-type-of-specimen/index.php | 72 ++++++++++ .../views/cyto-type-of-specimen/update.php | 30 +++++ .../views/cyto-type-of-specimen/view.php | 44 ++++++ .../report/views/case/_preview_non_gyn.php | 8 +- frontend/themes/nikom/views/layouts/_menu.php | 18 +-- 37 files changed, 1508 insertions(+), 92 deletions(-) create mode 100644 common/models/CytoFixation.php create mode 100644 common/models/CytoSourceOfSpecimen.php create mode 100644 common/models/CytoTypeOfSpecimen.php create mode 100644 frontend/modules/register/controllers/CytoFixationController.php create mode 100644 frontend/modules/register/controllers/CytoSourceOfSpecimenController.php create mode 100644 frontend/modules/register/controllers/CytoTypeOfSpecimenController.php create mode 100644 frontend/modules/register/models/CytoFixationSearch.php create mode 100644 frontend/modules/register/models/CytoSourceOfSpecimenSearch.php create mode 100644 frontend/modules/register/models/CytoTypeOfSpecimenSearch.php create mode 100644 frontend/modules/register/views/cyto-fixation/_form.php create mode 100644 frontend/modules/register/views/cyto-fixation/_search.php create mode 100644 frontend/modules/register/views/cyto-fixation/create.php create mode 100644 frontend/modules/register/views/cyto-fixation/index.php create mode 100644 frontend/modules/register/views/cyto-fixation/update.php create mode 100644 frontend/modules/register/views/cyto-fixation/view.php create mode 100644 frontend/modules/register/views/cyto-source-of-specimen/_form.php create mode 100644 frontend/modules/register/views/cyto-source-of-specimen/_search.php create mode 100644 frontend/modules/register/views/cyto-source-of-specimen/create.php create mode 100644 frontend/modules/register/views/cyto-source-of-specimen/index.php create mode 100644 frontend/modules/register/views/cyto-source-of-specimen/update.php create mode 100644 frontend/modules/register/views/cyto-source-of-specimen/view.php create mode 100644 frontend/modules/register/views/cyto-type-of-specimen/_form.php create mode 100644 frontend/modules/register/views/cyto-type-of-specimen/_search.php create mode 100644 frontend/modules/register/views/cyto-type-of-specimen/create.php create mode 100644 frontend/modules/register/views/cyto-type-of-specimen/index.php create mode 100644 frontend/modules/register/views/cyto-type-of-specimen/update.php create mode 100644 frontend/modules/register/views/cyto-type-of-specimen/view.php diff --git a/common/config/main-local.php b/common/config/main-local.php index 9a4978e2..9836ed11 100755 --- a/common/config/main-local.php +++ b/common/config/main-local.php @@ -3,6 +3,17 @@ return [ 'components' => [ 'db' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=localhost;dbname=surat_pathology', + 'username' => 'surat_pathology', + 'password' => 'Ss157344121165', + 'charset' => 'utf8', + 'enableSchemaCache' => false, + 'schemaCacheDuration' => 3600, + 'schemaCache' => 'cache', + ], + + /*'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=surat_pathology', 'username' => 'root', @@ -11,7 +22,7 @@ return [ 'enableSchemaCache' => false, 'schemaCacheDuration' => 3600, 'schemaCache' => 'cache', - ], + ],*/ 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', diff --git a/common/models/CaseNonGyn.php b/common/models/CaseNonGyn.php index 311aa528..8f749144 100755 --- a/common/models/CaseNonGyn.php +++ b/common/models/CaseNonGyn.php @@ -127,11 +127,11 @@ class CaseNonGyn extends PathologyActiveRecord return [ [['id_case', 'hospital_id', 'given_name'], 'required', 'on' => 'register'], [['pathologist_id'], 'required', 'on' => 'update'], - [['autocomplete_patient', 'hos_ref', 'house', 'moo', 'soy', 'road', 'phone', 'email'], 'string'], + [['autocomplete_patient', 'hos_ref', 'house', 'moo', 'soy', 'road', 'phone', 'email', 'color'], 'string'], [['id_case'], 'unique'], [['diagnosis'], 'required', 'on' => 'pathologist'], - [['title_id', 'is_histo_staining', 'specimen_type_id', 'specimen_id', 'is_stained', 'register_id', 'is_restain', 'is_pathologist_ot', 'specimen_adequacy', 'specimen_adequacy_1', 'specimen_adequacy_2', 'pathologist_id', 'status_id', 'is_print', 'is_critical_diagnosis', 'is_outlab', 'is_consult_outlab', 'cytotech1_id', 'hospital_id', 'lab_order_number', 'is_no_microscopic', 'is_express', 'ward_id', 'rights_id', 'doctor_id', 'order_point_id', 'hospital_import_id', 'order_by_id'/*, 'smears_receive', 'smears_processed', 'is_effusion', 'is_non_gyn_direction', 'is_fna', 'is_fna_direction'*/, 'const_rights_id', 'specimen_img_update_id', 'tambon', 'amphur', 'province', 'postcode', 'marriage', 'occupation', 'religious', 'race', 'nation', 'citizenship', 'is_cell_block', 'is_molecular', 'is_conference', 'clinic_id'], 'integer'], - [['id_case', 'given_name', 'surname', 'gender', 'id_card', 'age_unit', 'h_n', 'a_n', 'v_n', 'o_n', 'ward', 'clinician', 'collect_method', 'organ_and_location', 'side_of_specimen', 'fluid_volume', 'fluid_appearance', 'fluid_colour', 'fluid_description', 'clinical_diagnosis', 'clinical_diagnosis_his', 'adequacy_other', 'finding', 'screener_diagnosis', 'diagnosis', 'suggestion', 'cyto_side_of_specimen', 'additional_diagnosis', 'microscopic', 'gross_description', 'cytotech1_at', 'remark', 'non_gyn_specimen_other', 'cell_block_at'/*'fna_quantity', 'fna_slide', 'non_gyn_bal', 'non_gyn_other', 'fna_neck', 'fna_lymph_node', 'fna_salivary_gland', 'fna_other'*/, 'remark_consult_outlab', 'remark_report'], 'string'], + [['title_id', 'is_histo_staining', 'specimen_type_id', 'specimen_id', 'is_stained', 'register_id', 'is_restain', 'is_pathologist_ot', 'specimen_adequacy', 'specimen_adequacy_1', 'specimen_adequacy_2', 'pathologist_id', 'status_id', 'is_print', 'is_critical_diagnosis', 'is_outlab', 'is_consult_outlab', 'cytotech1_id', 'hospital_id', 'lab_order_number', 'is_no_microscopic', 'is_express', 'ward_id', 'rights_id', 'doctor_id', 'order_point_id', 'hospital_import_id', 'order_by_id'/*, 'smears_receive', 'smears_processed', 'is_effusion', 'is_non_gyn_direction', 'is_fna', 'is_fna_direction'*/, 'const_rights_id', 'specimen_img_update_id', 'tambon', 'amphur', 'province', 'postcode', 'marriage', 'occupation', 'religious', 'race', 'nation', 'citizenship', 'is_cell_block', 'is_molecular', 'is_conference', 'clinic_id', 'volume', 'spin', 'smear', 'cell_block', 'method_cell_block'], 'integer'], + [['id_case', 'given_name', 'surname', 'gender', 'id_card', 'age_unit', 'h_n', 'a_n', 'v_n', 'o_n', 'ward', 'clinician', 'collect_method', 'organ_and_location', 'side_of_specimen', 'fluid_volume', 'fluid_appearance', 'fluid_colour', 'fluid_description', 'clinical_diagnosis', 'clinical_diagnosis_his', 'adequacy_other', 'finding', 'screener_diagnosis', 'diagnosis', 'suggestion', 'cyto_side_of_specimen', 'additional_diagnosis', 'microscopic', 'gross_description', 'cytotech1_at', 'remark', 'non_gyn_specimen_other', 'cell_block_at'/*'fna_quantity', 'fna_slide', 'non_gyn_bal', 'non_gyn_other', 'fna_neck', 'fna_lymph_node', 'fna_salivary_gland', 'fna_other'*/, 'remark_consult_outlab', 'remark_report', 'method_cell_block_other'], 'string'], [['register_at', 'birthdate', 'collected_at', 'conference_at', 'report_at', 'patient_id', 'additional_at', 'receive_at', 'express_at'/*, 'non_gyn_type', 'fna_type'*/, 'express_day', 'specimen_img_at', 'slides'], 'safe'], [['age', 'no_slide', 'no_bottle', 'no_slide_dry_smear', 'is_provisional', 'is_consult', 'is_qa'], 'number'], [['his_ln', 'v_date', 'verify_date'], 'string', 'max' => 100], @@ -324,6 +324,10 @@ class CaseNonGyn extends PathologyActiveRecord 'conference_at' => 'วัน/เดือน/ปี ค.ศ. เช่น' . date('d/m/Y'), 'no_slide' => 'กรอกเฉพาะตัวเลขเท่านั้น', 'no_slide_dry_smear' => 'กรอกเฉพาะตัวเลขเท่านั้น', + 'volume' => 'ml.', + 'spin' => 'slides.', + 'smear' => 'slides.', + 'cell_block' => 'slides.' ]; } @@ -1003,4 +1007,4 @@ class CaseNonGyn extends PathologyActiveRecord } return $img; } -} +} \ No newline at end of file diff --git a/common/models/CytoFixation.php b/common/models/CytoFixation.php new file mode 100644 index 00000000..8c1d07e7 --- /dev/null +++ b/common/models/CytoFixation.php @@ -0,0 +1,46 @@ + 500], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + ]; + } +} \ No newline at end of file diff --git a/common/models/CytoSourceOfSpecimen.php b/common/models/CytoSourceOfSpecimen.php new file mode 100644 index 00000000..579af3b6 --- /dev/null +++ b/common/models/CytoSourceOfSpecimen.php @@ -0,0 +1,46 @@ + 500], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + ]; + } +} \ No newline at end of file diff --git a/common/models/CytoTypeOfSpecimen.php b/common/models/CytoTypeOfSpecimen.php new file mode 100644 index 00000000..3ff3d351 --- /dev/null +++ b/common/models/CytoTypeOfSpecimen.php @@ -0,0 +1,46 @@ + 500], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + ]; + } +} \ No newline at end of file diff --git a/frontend/modules/cyto/controllers/NonGynController.php b/frontend/modules/cyto/controllers/NonGynController.php index e89b807a..126959a9 100755 --- a/frontend/modules/cyto/controllers/NonGynController.php +++ b/frontend/modules/cyto/controllers/NonGynController.php @@ -13,6 +13,7 @@ use common\models\CytoNonGynDiagnosis; use common\models\IdCaseForm; use common\models\CytoOperate; use common\models\CytoPapDiagnosis; +use common\models\CytoSpecimen; use common\models\FinanceServiceCharge; use common\models\HistoStaining; use common\models\PathologistTransfer; @@ -767,8 +768,6 @@ class NonGynController extends \yii\web\Controller //ระบุ Cytotech $model->cytotech1_id = Yii::$app->user->getId(); - //$patient = Patient::findOne($case_non_gyn->patient_id); - if ( $model->load(Yii::$app->request->post()) && $case_non_gyn->load(Yii::$app->request->post()) @@ -1334,4 +1333,4 @@ class NonGynController extends \yii\web\Controller ]); } */ -} +} \ No newline at end of file diff --git a/frontend/modules/cyto/views/non-gyn/non-gyn-final.php b/frontend/modules/cyto/views/non-gyn/non-gyn-final.php index 4790014f..b1b0801c 100755 --- a/frontend/modules/cyto/views/non-gyn/non-gyn-final.php +++ b/frontend/modules/cyto/views/non-gyn/non-gyn-final.php @@ -215,35 +215,38 @@ $this->params['breadcrumbs'][] = $this->title;
- field($model, 'volume'); ?> + field($case_non_gyn, 'volume'); ?>
- field($model, 'color'); ?> + field($case_non_gyn, 'color'); ?>
- field($model, 'spin'); ?> + field($case_non_gyn, 'spin'); ?>
- field($model, 'smear'); ?> + field($case_non_gyn, 'smear'); ?>
- field($model, 'cell_block'); ?> + field($case_non_gyn, 'cell_block'); ?>
- field($model, 'method_cell_block')->dropDownList( + field($case_non_gyn, 'method_cell_block')->dropDownList( [1 => 'Fibrin', 2 => 'Gel Foam', 3 => 'Alcohol', 4 => 'Formalin', 5 => 'Other'], ['prompt' => 'เลือก Method Cell Block...'] ) ?>
+
+
+ field($case_non_gyn, 'method_cell_block_other')->textarea() ?> +
+
-
- Clinical Diagnosis -
+
Report
files)) { ?> @@ -263,45 +266,11 @@ $this->params['breadcrumbs'][] = $this->title; } ?> - - -
Clinical Diagnosis
- - field($case_non_gyn, 'clinical_diagnosis')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ - 'preset' => 'custom', - 'clientOptions' => [ - 'height' => 200, - 'removePlugins' => 'scayt', - 'disableNativeSpellChecker' => false, - 'extraPlugins' => 'font', - 'extraPlugins' => 'font,justify,colorbutton,iframe,dialogadvtab,liststyle', - 'removeButtons' => 'Source,Save,NewPage,Preview,Print,Templates,Find,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,PageBreak,Iframe,Styles,Format,Font,FontSize,ShowBlocks,About,Replace,Snippet', - 'toolbarGroups' => [ - ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste']], - ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], - ['name' => 'paragraph', 'groups' => ['list', 'indent', 'align', 'bidi', 'paragraph']], - ['name' => 'editing', 'groups' => ['find', 'selection']], - ['name' => 'insert', 'groups' => ['table']], - ['name' => 'tools', 'groups' => ['maximize']], - //['name' => 'styles', 'groups' => ['font']], - ], - ] - ]) ?> - - -
-
- -
-
-
Final Report
-
-
field($model, 'specimen_adequacy_1')->dropDownList(ArrayHelper::map(CytoSpecimenAdequacy1::find()->where(['type' => 'non_gyn'])->all(), 'id', function ($model) { return /*'(' . $model->code . ') ' .*/ $model->name; })); ?>
-
Diagnosis
+
Cytologic Diagnosis
field($model, 'diagnosis')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ 'preset' => 'custom', diff --git a/frontend/modules/pathologist/views/do/non-gyn-final.php b/frontend/modules/pathologist/views/do/non-gyn-final.php index 44287a3e..36601fe4 100755 --- a/frontend/modules/pathologist/views/do/non-gyn-final.php +++ b/frontend/modules/pathologist/views/do/non-gyn-final.php @@ -42,6 +42,45 @@ $this->params['breadcrumbs'][] = $this->title; errorSummary($case_non_gyn) ?> + +
+
+
+ Gross Description +
+
+
+
+
+ field($case_non_gyn, 'volume'); ?> +
+
+ field($case_non_gyn, 'color'); ?> +
+
+ field($case_non_gyn, 'spin'); ?> +
+
+ field($case_non_gyn, 'smear'); ?> +
+
+ field($case_non_gyn, 'cell_block'); ?> +
+
+ field($case_non_gyn, 'method_cell_block')->dropDownList( + [1 => 'Fibrin', 2 => 'Gel Foam', 3 => 'Alcohol', 4 => 'Formalin', 5 => 'Other'], + ['prompt' => 'เลือก Method Cell Block...'] + ) ?> +
+
+
+
+ field($case_non_gyn, 'method_cell_block_other')->textarea() ?> +
+
+
+
+
diff --git a/frontend/modules/register/controllers/CaseUpdateController.php b/frontend/modules/register/controllers/CaseUpdateController.php index b5ae3f32..51a564f2 100755 --- a/frontend/modules/register/controllers/CaseUpdateController.php +++ b/frontend/modules/register/controllers/CaseUpdateController.php @@ -120,7 +120,6 @@ class CaseUpdateController extends \yii\web\Controller */ public function actionPap($id_case) - { $model = CasePap::findOne(['id_case' => $id_case]); @@ -1304,6 +1303,7 @@ class CaseUpdateController extends \yii\web\Controller $cyto_non_gyn_container = new CytoNonGynContainer(); $cyto_non_gyn_container->items = CytoNonGynContainer::find()->where(['id_case' => $model->id_case])->all(); + $patient = Patient::findOne($model->patient_id); //$patient->race = 'ไทย'; $model->scenario = 'update'; @@ -3230,4 +3230,4 @@ class CaseUpdateController extends \yii\web\Controller $subdistrict = ConstLookupAddressName::findOne(['province' => $province, 'amphur' => $amphur, 'tambon' => $tambon]); return isset($subdistrict) ? $subdistrict->zipcode : ''; } -} +} \ No newline at end of file diff --git a/frontend/modules/register/controllers/CytoFixationController.php b/frontend/modules/register/controllers/CytoFixationController.php new file mode 100644 index 00000000..4906cef3 --- /dev/null +++ b/frontend/modules/register/controllers/CytoFixationController.php @@ -0,0 +1,127 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all CytoFixation models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CytoFixationSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single CytoFixation model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new CytoFixation model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new CytoFixation(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing CytoFixation model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing CytoFixation model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the CytoFixation model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return CytoFixation the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = CytoFixation::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} \ No newline at end of file diff --git a/frontend/modules/register/controllers/CytoSourceOfSpecimenController.php b/frontend/modules/register/controllers/CytoSourceOfSpecimenController.php new file mode 100644 index 00000000..82e0cf88 --- /dev/null +++ b/frontend/modules/register/controllers/CytoSourceOfSpecimenController.php @@ -0,0 +1,127 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all CytoSourceOfSpecimen models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CytoSourceOfSpecimenSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single CytoSourceOfSpecimen model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new CytoSourceOfSpecimen model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new CytoSourceOfSpecimen(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing CytoSourceOfSpecimen model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing CytoSourceOfSpecimen model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the CytoSourceOfSpecimen model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return CytoSourceOfSpecimen the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = CytoSourceOfSpecimen::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} \ No newline at end of file diff --git a/frontend/modules/register/controllers/CytoTypeOfSpecimenController.php b/frontend/modules/register/controllers/CytoTypeOfSpecimenController.php new file mode 100644 index 00000000..fdc0ab14 --- /dev/null +++ b/frontend/modules/register/controllers/CytoTypeOfSpecimenController.php @@ -0,0 +1,127 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all CytoTypeOfSpecimen models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CytoTypeOfSpecimenSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single CytoTypeOfSpecimen model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new CytoTypeOfSpecimen model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new CytoTypeOfSpecimen(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing CytoTypeOfSpecimen model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing CytoTypeOfSpecimen model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the CytoTypeOfSpecimen model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return CytoTypeOfSpecimen the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = CytoTypeOfSpecimen::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} \ No newline at end of file diff --git a/frontend/modules/register/models/CytoFixationSearch.php b/frontend/modules/register/models/CytoFixationSearch.php new file mode 100644 index 00000000..2f1a4232 --- /dev/null +++ b/frontend/modules/register/models/CytoFixationSearch.php @@ -0,0 +1,69 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]); + + return $dataProvider; + } +} \ No newline at end of file diff --git a/frontend/modules/register/models/CytoSourceOfSpecimenSearch.php b/frontend/modules/register/models/CytoSourceOfSpecimenSearch.php new file mode 100644 index 00000000..78500190 --- /dev/null +++ b/frontend/modules/register/models/CytoSourceOfSpecimenSearch.php @@ -0,0 +1,69 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]); + + return $dataProvider; + } +} \ No newline at end of file diff --git a/frontend/modules/register/models/CytoTypeOfSpecimenSearch.php b/frontend/modules/register/models/CytoTypeOfSpecimenSearch.php new file mode 100644 index 00000000..a2f79d2b --- /dev/null +++ b/frontend/modules/register/models/CytoTypeOfSpecimenSearch.php @@ -0,0 +1,69 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]); + + return $dataProvider; + } +} \ No newline at end of file diff --git a/frontend/modules/register/views/case/_form_non_gyn.php b/frontend/modules/register/views/case/_form_non_gyn.php index 61e48fce..f82a78e3 100755 --- a/frontend/modules/register/views/case/_form_non_gyn.php +++ b/frontend/modules/register/views/case/_form_non_gyn.php @@ -542,31 +542,7 @@ use unclead\multipleinput\MultipleInputColumn; field($model, 'non_gyn_specimen_other')->textarea() ?>
-
Gross - Description
-
- field($model, 'gross_description')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::className(), [ - 'preset' => 'custom', - 'clientOptions' => [ - 'height' => 200, - 'removePlugins' => 'scayt', - 'disableNativeSpellChecker' => false, - 'extraPlugins' => 'font,justify,colorbutton,iframe,dialogadvtab,liststyle', - 'removeButtons' => 'Source,Save,NewPage,Preview,Print,Templates,Find,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,PageBreak,Iframe,ShowBlocks,About,Replace,Snippet', - 'toolbarGroups' => [ - ['name' => 'clipboard', 'groups' => ['undo', 'redo', 'cut', 'copy', 'paste', 'clipboard']], - ['name' => 'styles', 'groups' => ['font']], - ['name' => 'colors', 'groups' => ['TextColor', 'BGColor']], - ['name' => 'basicstyles', 'groups' => ['basicstyles', 'cleanup']], - ['name' => 'paragraph', 'groups' => ['list', 'align', 'bidi', 'paragraph']], - ['name' => 'editing', 'groups' => ['find', 'selection', /*'spellchecker'*/]], - //['name' => 'tools', 'groups' => ['dialogadvtab', 'devtools', 'div']], - ['name' => 'insert', 'groups' => ['table', 'specialchar']], - //['name' => 'tools', 'groups' => ['maximize']], - ], - ] - ]) ?> -
+
diff --git a/frontend/modules/register/views/cyto-fixation/_form.php b/frontend/modules/register/views/cyto-fixation/_form.php new file mode 100644 index 00000000..0e257cf1 --- /dev/null +++ b/frontend/modules/register/views/cyto-fixation/_form.php @@ -0,0 +1,24 @@ + + + + + + +field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? 'เพิ่มข้อมูล' : 'แก้ไข', ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-danger']) ?> + +
+ + \ No newline at end of file diff --git a/frontend/modules/register/views/cyto-fixation/_search.php b/frontend/modules/register/views/cyto-fixation/_search.php new file mode 100644 index 00000000..d2ef0514 --- /dev/null +++ b/frontend/modules/register/views/cyto-fixation/_search.php @@ -0,0 +1,33 @@ + + + diff --git a/frontend/modules/register/views/cyto-fixation/create.php b/frontend/modules/register/views/cyto-fixation/create.php new file mode 100644 index 00000000..fd8bd42e --- /dev/null +++ b/frontend/modules/register/views/cyto-fixation/create.php @@ -0,0 +1,27 @@ +title = 'Create Cyto Fixation'; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Fixations', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+ title) ?> +
+
+ +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-fixation/index.php b/frontend/modules/register/views/cyto-fixation/index.php new file mode 100644 index 00000000..71727d9b --- /dev/null +++ b/frontend/modules/register/views/cyto-fixation/index.php @@ -0,0 +1,72 @@ +title = 'Cyto Fixation'; +$this->params['breadcrumbs'][] = $this->title; +?> + + +
+
+
+
title) ?> +
+ เพิ่ม Cyto Fixation', ['create'], ['class' => 'btn btn-primary']) ?> +
+
+ render('_search', ['model' => $searchModel]); + ?> +
+ ['class' => 'yii\bootstrap5\LinkPager'], + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'tableOptions' => ['class' => 'table align-middle table-hover m-0 truncate'], + 'layout' => "{summary}
\n{items}\n
{pager}
", + + 'columns' => [ + + ['class' => 'yii\grid\SerialColumn'], + + //'id', + 'name', + [ + 'class' => 'yii\grid\ActionColumn', + 'headerOptions' => ['class' => 'custom-action-column-header'], + 'contentOptions' => ['class' => 'custom-action-column'], + 'template' => '{view} {update} {delete}', // Customize buttons if needed + 'buttons' => [ + 'view' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'View'), + 'class' => 'btn btn-outline-info btn-sm' + ]); + }, + 'update' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Update'), + 'class' => 'btn btn-outline-warning btn-sm' + ]); + }, + 'delete' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Delete'), + 'data-confirm' => Yii::t('app', 'คุณแน่ใจว่าต้องการลบรายการนี้หรือไม่ ?'), + 'data-method' => 'post', + 'class' => 'btn btn-outline-danger btn-sm' + ]); + }, + ], + ], + ], + ]); ?> +
+
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-fixation/update.php b/frontend/modules/register/views/cyto-fixation/update.php new file mode 100644 index 00000000..6d00e2b8 --- /dev/null +++ b/frontend/modules/register/views/cyto-fixation/update.php @@ -0,0 +1,30 @@ +title = 'Update Cyto Source of Specimens: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Cyto Source of Specimens', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'แก้ไข'; +?> +
+
+
+

+ +
+
    +
  • +
+
+
+
+ render('_form', [ + 'model' => $model, + ]) ?> +
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-fixation/view.php b/frontend/modules/register/views/cyto-fixation/view.php new file mode 100644 index 00000000..a58851cd --- /dev/null +++ b/frontend/modules/register/views/cyto-fixation/view.php @@ -0,0 +1,44 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Specimen Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> + +
+
+
title) ?>
+
+ $model->id], ['class' => 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-info']) ?> +
+
+ +
+ $model, + 'attributes' => [ + 'id', + 'name', + 'group_case', + [ + //'attribute' => 'charge_id', + 'format' => 'raw', + 'label' => 'สถานะ', + 'value' => function ($model) { + $arr = [1 => ' ใช้งาน', 0 => ' ไม่ใช้งาน']; + return isset($model->is_view) ? ($arr[$model->is_view]) : ''; + }, + ], + //'is_view', + ], + ]) ?> +
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-source-of-specimen/_form.php b/frontend/modules/register/views/cyto-source-of-specimen/_form.php new file mode 100644 index 00000000..0e257cf1 --- /dev/null +++ b/frontend/modules/register/views/cyto-source-of-specimen/_form.php @@ -0,0 +1,24 @@ + + + + + + +field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? 'เพิ่มข้อมูล' : 'แก้ไข', ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-danger']) ?> + +
+ + \ No newline at end of file diff --git a/frontend/modules/register/views/cyto-source-of-specimen/_search.php b/frontend/modules/register/views/cyto-source-of-specimen/_search.php new file mode 100644 index 00000000..d2ef0514 --- /dev/null +++ b/frontend/modules/register/views/cyto-source-of-specimen/_search.php @@ -0,0 +1,33 @@ + + + diff --git a/frontend/modules/register/views/cyto-source-of-specimen/create.php b/frontend/modules/register/views/cyto-source-of-specimen/create.php new file mode 100644 index 00000000..90938a35 --- /dev/null +++ b/frontend/modules/register/views/cyto-source-of-specimen/create.php @@ -0,0 +1,27 @@ +title = 'Create Cyto Source of Specimen'; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Source of Specimens', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+ title) ?> +
+
+ +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-source-of-specimen/index.php b/frontend/modules/register/views/cyto-source-of-specimen/index.php new file mode 100644 index 00000000..886ffe5f --- /dev/null +++ b/frontend/modules/register/views/cyto-source-of-specimen/index.php @@ -0,0 +1,72 @@ +title = 'Cyto Source of Specimen'; +$this->params['breadcrumbs'][] = $this->title; +?> + + +
+
+
+
title) ?> +
+ เพิ่ม Cyto Source of Specimen', ['create'], ['class' => 'btn btn-primary']) ?> +
+
+ render('_search', ['model' => $searchModel]); + ?> +
+ ['class' => 'yii\bootstrap5\LinkPager'], + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'tableOptions' => ['class' => 'table align-middle table-hover m-0 truncate'], + 'layout' => "{summary}
\n{items}\n
{pager}
", + + 'columns' => [ + + ['class' => 'yii\grid\SerialColumn'], + + //'id', + 'name', + [ + 'class' => 'yii\grid\ActionColumn', + 'headerOptions' => ['class' => 'custom-action-column-header'], + 'contentOptions' => ['class' => 'custom-action-column'], + 'template' => '{view} {update} {delete}', // Customize buttons if needed + 'buttons' => [ + 'view' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'View'), + 'class' => 'btn btn-outline-info btn-sm' + ]); + }, + 'update' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Update'), + 'class' => 'btn btn-outline-warning btn-sm' + ]); + }, + 'delete' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Delete'), + 'data-confirm' => Yii::t('app', 'คุณแน่ใจว่าต้องการลบรายการนี้หรือไม่ ?'), + 'data-method' => 'post', + 'class' => 'btn btn-outline-danger btn-sm' + ]); + }, + ], + ], + ], + ]); ?> +
+
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-source-of-specimen/update.php b/frontend/modules/register/views/cyto-source-of-specimen/update.php new file mode 100644 index 00000000..6d00e2b8 --- /dev/null +++ b/frontend/modules/register/views/cyto-source-of-specimen/update.php @@ -0,0 +1,30 @@ +title = 'Update Cyto Source of Specimens: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Cyto Source of Specimens', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'แก้ไข'; +?> +
+
+
+

+ +
+
    +
  • +
+
+
+
+ render('_form', [ + 'model' => $model, + ]) ?> +
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-source-of-specimen/view.php b/frontend/modules/register/views/cyto-source-of-specimen/view.php new file mode 100644 index 00000000..a58851cd --- /dev/null +++ b/frontend/modules/register/views/cyto-source-of-specimen/view.php @@ -0,0 +1,44 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Specimen Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> + +
+
+
title) ?>
+
+ $model->id], ['class' => 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-info']) ?> +
+
+ +
+ $model, + 'attributes' => [ + 'id', + 'name', + 'group_case', + [ + //'attribute' => 'charge_id', + 'format' => 'raw', + 'label' => 'สถานะ', + 'value' => function ($model) { + $arr = [1 => ' ใช้งาน', 0 => ' ไม่ใช้งาน']; + return isset($model->is_view) ? ($arr[$model->is_view]) : ''; + }, + ], + //'is_view', + ], + ]) ?> +
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-specimen-type/index.php b/frontend/modules/register/views/cyto-specimen-type/index.php index d8a120f6..5d4a3dd1 100755 --- a/frontend/modules/register/views/cyto-specimen-type/index.php +++ b/frontend/modules/register/views/cyto-specimen-type/index.php @@ -27,7 +27,7 @@ $this->params['breadcrumbs'][] = $this->title; 'pager' => ['class' => 'yii\bootstrap5\LinkPager'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, - 'tableOptions' => ['class' => 'table table-striped truncate m-0'], + 'tableOptions' => ['class' => 'table align-middle table-hover m-0 truncate'], 'layout' => "{summary}
\n{items}\n
{pager}
", 'columns' => [ diff --git a/frontend/modules/register/views/cyto-type-of-specimen/_form.php b/frontend/modules/register/views/cyto-type-of-specimen/_form.php new file mode 100644 index 00000000..0e257cf1 --- /dev/null +++ b/frontend/modules/register/views/cyto-type-of-specimen/_form.php @@ -0,0 +1,24 @@ + + + + + + +field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? 'เพิ่มข้อมูล' : 'แก้ไข', ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-danger']) ?> + +
+ + \ No newline at end of file diff --git a/frontend/modules/register/views/cyto-type-of-specimen/_search.php b/frontend/modules/register/views/cyto-type-of-specimen/_search.php new file mode 100644 index 00000000..d2ef0514 --- /dev/null +++ b/frontend/modules/register/views/cyto-type-of-specimen/_search.php @@ -0,0 +1,33 @@ + + + diff --git a/frontend/modules/register/views/cyto-type-of-specimen/create.php b/frontend/modules/register/views/cyto-type-of-specimen/create.php new file mode 100644 index 00000000..0afc278a --- /dev/null +++ b/frontend/modules/register/views/cyto-type-of-specimen/create.php @@ -0,0 +1,27 @@ +title = 'Create Cyto Type of Specimen'; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Type of Specimens', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+ title) ?> +
+
+ +
+ + render('_form', [ + 'model' => $model, + ]) ?> + +
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-type-of-specimen/index.php b/frontend/modules/register/views/cyto-type-of-specimen/index.php new file mode 100644 index 00000000..7dbbd5aa --- /dev/null +++ b/frontend/modules/register/views/cyto-type-of-specimen/index.php @@ -0,0 +1,72 @@ +title = 'Cyto Type of Specimen'; +$this->params['breadcrumbs'][] = $this->title; +?> + + +
+
+
+
title) ?> +
+ เพิ่ม Cyto Type of Specimen', ['create'], ['class' => 'btn btn-primary']) ?> +
+
+ render('_search', ['model' => $searchModel]); + ?> +
+ ['class' => 'yii\bootstrap5\LinkPager'], + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'tableOptions' => ['class' => 'table align-middle table-hover m-0 truncate'], + 'layout' => "{summary}
\n{items}\n
{pager}
", + + 'columns' => [ + + ['class' => 'yii\grid\SerialColumn'], + + //'id', + 'name', + [ + 'class' => 'yii\grid\ActionColumn', + 'headerOptions' => ['class' => 'custom-action-column-header'], + 'contentOptions' => ['class' => 'custom-action-column'], + 'template' => '{view} {update} {delete}', // Customize buttons if needed + 'buttons' => [ + 'view' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'View'), + 'class' => 'btn btn-outline-info btn-sm' + ]); + }, + 'update' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Update'), + 'class' => 'btn btn-outline-warning btn-sm' + ]); + }, + 'delete' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Delete'), + 'data-confirm' => Yii::t('app', 'คุณแน่ใจว่าต้องการลบรายการนี้หรือไม่ ?'), + 'data-method' => 'post', + 'class' => 'btn btn-outline-danger btn-sm' + ]); + }, + ], + ], + ], + ]); ?> +
+
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-type-of-specimen/update.php b/frontend/modules/register/views/cyto-type-of-specimen/update.php new file mode 100644 index 00000000..6d00e2b8 --- /dev/null +++ b/frontend/modules/register/views/cyto-type-of-specimen/update.php @@ -0,0 +1,30 @@ +title = 'Update Cyto Source of Specimens: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Cyto Source of Specimens', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'แก้ไข'; +?> +
+
+
+

+ +
+
    +
  • +
+
+
+
+ render('_form', [ + 'model' => $model, + ]) ?> +
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/cyto-type-of-specimen/view.php b/frontend/modules/register/views/cyto-type-of-specimen/view.php new file mode 100644 index 00000000..a58851cd --- /dev/null +++ b/frontend/modules/register/views/cyto-type-of-specimen/view.php @@ -0,0 +1,44 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Specimen Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> + +
+
+
title) ?>
+
+ $model->id], ['class' => 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-info']) ?> +
+
+ +
+ $model, + 'attributes' => [ + 'id', + 'name', + 'group_case', + [ + //'attribute' => 'charge_id', + 'format' => 'raw', + 'label' => 'สถานะ', + 'value' => function ($model) { + $arr = [1 => ' ใช้งาน', 0 => ' ไม่ใช้งาน']; + return isset($model->is_view) ? ($arr[$model->is_view]) : ''; + }, + ], + //'is_view', + ], + ]) ?> +
+
\ No newline at end of file diff --git a/frontend/modules/report/views/case/_preview_non_gyn.php b/frontend/modules/report/views/case/_preview_non_gyn.php index 89ba8b67..83706fcc 100755 --- a/frontend/modules/report/views/case/_preview_non_gyn.php +++ b/frontend/modules/report/views/case/_preview_non_gyn.php @@ -59,14 +59,14 @@ $final_report = CytoNonGynDiagnosis::findOne(['id_case' => $model->id_case, 'rep    Site: - - Thyroid nodule + specimen->name ?> +    Appearance: - + volume . ' ml, ' . $model->color?>
@@ -80,7 +80,7 @@ $final_report = CytoNonGynDiagnosis::findOne(['id_case' => $model->id_case, 'rep Number of slides: - 6 + spin ?>    diff --git a/frontend/themes/nikom/views/layouts/_menu.php b/frontend/themes/nikom/views/layouts/_menu.php index 497a4b4c..e262f3c9 100755 --- a/frontend/themes/nikom/views/layouts/_menu.php +++ b/frontend/themes/nikom/views/layouts/_menu.php @@ -216,11 +216,6 @@ if (Yii::$app->user->can('center')) { ['label' => ' การประเมินคุณภาพสไลด์
Special Staining', 'url' => ['/slideqa/surgical/special-staining']], ['label' => ' การประเมินคุณภาพสไลด์
Immuno Staining', 'url' => ['/slideqa/surgical/immuno-staining']], ['label' => ' การประเมินคุณภาพสไลด์
กลุ่มงานพยาธิวิทยากายวิภาค', 'url' => ['/slideqa/surgical/immuno']], - //['label' => 'การประเมินคุณภาพสไลด์
Cyto Block', 'url' => ['/slideqa/cyto/cyto-block']], - //['label' => 'การประเมินคุณภาพสไลด์
Fluid specimens', 'url' => ['/slideqa/cyto/fluid-specimens']], - //['label' => 'การประเมินคุณภาพสไลด์
FNA & PAP Smear', 'url' => ['/slideqa/cyto/slide-specimens']], - //['label' => 'การประเมินคุณภาพสไลด์
กลุ่มงานจุลพยาธิ', 'url' => ['/slideqa/cyto/slide-specimens']], - //['label' => 'การแบบประเมินคุณภาพ
งานย้อมสี
Immunohistochemistry', 'url' => ['/slideqa/cyto/slide-specimens']], ['label' => ' การประเมินคุณภาพสไลด์
งานเชลล์วิทยา', 'url' => ['/slideqa/cyto/slide-qa-1']], ], ]; @@ -230,10 +225,7 @@ if (Yii::$app->user->can('center')) { 'url' => 'javascript:void()', 'options' => ['class' => 'treeview'], 'items' => [ - //['label' => ' รายการค่าตรวจ HIS', 'url' => ['/register/service-charge-his/index']], ['label' => ' รายการค่าตรวจ', 'url' => ['/register/service-charge/index']], - //['label' => ' รายการค่าตรวจ Mapping', 'url' => ['/register/hospital-import-service-charge-mapping/index']], - //['label' => ' ค่าตรวจแต่ละหน่วยงาน', 'url' => ['/register/hospital-service-charge/index']], ['label' => ' โรงพยาบาล/หน่วยงาน
(ลูกค้า)', 'url' => ['/register/hospital/index']], ['label' => ' ประเภทหน่วยงาน', 'url' => ['/register/hospital-type/index']], ['label' => ' รายชื่อแพทย์เจ้าของคนไข้', 'url' => ['/register/const-doctor/index']], @@ -241,6 +233,16 @@ if (Yii::$app->user->can('center')) { ['label' => ' รายการ Ward', 'url' => ['/register/const-ward/index']], ['label' => ' คำนำหน้า', 'url' => ['/register/patient-title/index']], ['label' => ' ข้อมูลวันหยุด', 'url' => ['/stat/hr-day-off/index']], + ['label' => ' ข้อมูล Cyto Specimen Types', 'url' => ['/register/cyto-specimen-type/index']], + ['label' => ' ข้อมูล Cyto Specimen', 'url' => ['/register/cyto-specimen/index']], + ['label' => ' ข้อมูล Cyto Source of Specimen', 'url' => ['/register/cyto-source-of-specimen/index']], + ['label' => ' ข้อมูล Cyto type of Specimen', 'url' => ['/register/cyto-type-of-specimen/index']], + ['label' => ' ข้อมูล Cyto Fixation', 'url' => ['/register/cyto-fixation/index']], + ['label' => ' ข้อมูล Cyto Specimen
Adequacy 1', 'url' => ['/cyto/cyto-specimen-adequacy-1/index']], + ['label' => ' ข้อมูล Cyto Specimen
Adequacy 2', 'url' => ['/cyto/cyto-specimen-adequacy-2/index']], + ['label' => ' ข้อมูล Cyto Specimen
Adequacy 3', 'url' => ['/cyto/cyto-specimen-adequacy-3/index']], + ['label' => ' ข้อมูล Cyto General
Categorization 1', 'url' => ['/cyto/cyto-general-categorization-1/index']], + ['label' => ' ข้อมูล Cyto General
Categorization 2', 'url' => ['/cyto/cyto-general-categorization-2/index']], ], ]; From 8bed83f31a5a966feccb5a1f4b74be54a7549ecf Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 00:29:14 +0700 Subject: [PATCH 04/13] fix non gyn --- common/models/CaseNonGyn.php | 30 ++++++++++- .../register/views/case/_form_non_gyn.php | 54 ++++++++++++++++++- .../report/views/case/_preview_non_gyn.php | 14 ++--- 3 files changed, 89 insertions(+), 9 deletions(-) diff --git a/common/models/CaseNonGyn.php b/common/models/CaseNonGyn.php index 8f749144..f9f94d47 100755 --- a/common/models/CaseNonGyn.php +++ b/common/models/CaseNonGyn.php @@ -6,6 +6,7 @@ use Imagick; use Imagine\Image\Box; use Yii; use common\components\PathologyActiveRecord; +use frontend\modules\cyto\controllers\CytoSourceController; use yii\imagine\Image; use yii\web\UploadedFile; use yii\helpers\ArrayHelper; @@ -130,7 +131,7 @@ class CaseNonGyn extends PathologyActiveRecord [['autocomplete_patient', 'hos_ref', 'house', 'moo', 'soy', 'road', 'phone', 'email', 'color'], 'string'], [['id_case'], 'unique'], [['diagnosis'], 'required', 'on' => 'pathologist'], - [['title_id', 'is_histo_staining', 'specimen_type_id', 'specimen_id', 'is_stained', 'register_id', 'is_restain', 'is_pathologist_ot', 'specimen_adequacy', 'specimen_adequacy_1', 'specimen_adequacy_2', 'pathologist_id', 'status_id', 'is_print', 'is_critical_diagnosis', 'is_outlab', 'is_consult_outlab', 'cytotech1_id', 'hospital_id', 'lab_order_number', 'is_no_microscopic', 'is_express', 'ward_id', 'rights_id', 'doctor_id', 'order_point_id', 'hospital_import_id', 'order_by_id'/*, 'smears_receive', 'smears_processed', 'is_effusion', 'is_non_gyn_direction', 'is_fna', 'is_fna_direction'*/, 'const_rights_id', 'specimen_img_update_id', 'tambon', 'amphur', 'province', 'postcode', 'marriage', 'occupation', 'religious', 'race', 'nation', 'citizenship', 'is_cell_block', 'is_molecular', 'is_conference', 'clinic_id', 'volume', 'spin', 'smear', 'cell_block', 'method_cell_block'], 'integer'], + [['title_id', 'is_histo_staining', 'specimen_type_id', 'specimen_id', 'is_stained', 'register_id', 'is_restain', 'is_pathologist_ot', 'specimen_adequacy', 'specimen_adequacy_1', 'specimen_adequacy_2', 'pathologist_id', 'status_id', 'is_print', 'is_critical_diagnosis', 'is_outlab', 'is_consult_outlab', 'cytotech1_id', 'hospital_id', 'lab_order_number', 'is_no_microscopic', 'is_express', 'ward_id', 'rights_id', 'doctor_id', 'order_point_id', 'hospital_import_id', 'order_by_id'/*, 'smears_receive', 'smears_processed', 'is_effusion', 'is_non_gyn_direction', 'is_fna', 'is_fna_direction'*/, 'const_rights_id', 'specimen_img_update_id', 'tambon', 'amphur', 'province', 'postcode', 'marriage', 'occupation', 'religious', 'race', 'nation', 'citizenship', 'is_cell_block', 'is_molecular', 'is_conference', 'clinic_id', 'volume', 'spin', 'smear', 'cell_block', 'method_cell_block', 'source_of_specimen_id', 'type_of_specimen_id', 'fixation_id'], 'integer'], [['id_case', 'given_name', 'surname', 'gender', 'id_card', 'age_unit', 'h_n', 'a_n', 'v_n', 'o_n', 'ward', 'clinician', 'collect_method', 'organ_and_location', 'side_of_specimen', 'fluid_volume', 'fluid_appearance', 'fluid_colour', 'fluid_description', 'clinical_diagnosis', 'clinical_diagnosis_his', 'adequacy_other', 'finding', 'screener_diagnosis', 'diagnosis', 'suggestion', 'cyto_side_of_specimen', 'additional_diagnosis', 'microscopic', 'gross_description', 'cytotech1_at', 'remark', 'non_gyn_specimen_other', 'cell_block_at'/*'fna_quantity', 'fna_slide', 'non_gyn_bal', 'non_gyn_other', 'fna_neck', 'fna_lymph_node', 'fna_salivary_gland', 'fna_other'*/, 'remark_consult_outlab', 'remark_report', 'method_cell_block_other'], 'string'], [['register_at', 'birthdate', 'collected_at', 'conference_at', 'report_at', 'patient_id', 'additional_at', 'receive_at', 'express_at'/*, 'non_gyn_type', 'fna_type'*/, 'express_day', 'specimen_img_at', 'slides'], 'safe'], [['age', 'no_slide', 'no_bottle', 'no_slide_dry_smear', 'is_provisional', 'is_consult', 'is_qa'], 'number'], @@ -308,6 +309,9 @@ class CaseNonGyn extends PathologyActiveRecord 'religious' => 'ศาสนา', 'race' => 'เชิ้อชาติ', 'citizenship' => 'สัญชาติ', + 'source_of_specimen_id' => 'Source Of Specimen', + 'type_of_specimen_id' => 'Type Of Specimen', + 'fixation_id' => 'Fixation', 'specimen_container_img' => 'Specimen Container' ]; } @@ -384,6 +388,30 @@ class CaseNonGyn extends PathologyActiveRecord return $this->hasOne(CytoSpecimenType::class, ['id' => 'specimen_type_id']); } + /** + * @return \yii\db\ActiveQuery + */ + public function getSourceSpecimen() + { + return $this->hasOne(CytoSourceOfSpecimen::class, ['id' => 'source_of_specimen_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getTypeSpecimen() + { + return $this->hasOne(CytoTypeOfSpecimen::class, ['id' => 'type_of_specimen_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getFixation() + { + return $this->hasOne(CytoFixation::class, ['id' => 'fixation_id']); + } + /** * @return \yii\db\ActiveQuery */ diff --git a/frontend/modules/register/views/case/_form_non_gyn.php b/frontend/modules/register/views/case/_form_non_gyn.php index f82a78e3..a3633dcf 100755 --- a/frontend/modules/register/views/case/_form_non_gyn.php +++ b/frontend/modules/register/views/case/_form_non_gyn.php @@ -20,7 +20,10 @@ use common\models\ConstHospital; use dosamigos\ckeditor\CKEditor; use yii\data\ActiveDataProvider; use common\models\ConstNationality; +use common\models\CytoFixation; +use common\models\CytoSourceOfSpecimen; use common\models\CytoSpecimenType; +use common\models\CytoTypeOfSpecimen; use kartik\datetime\DateTimePicker; use common\models\FinanceServiceCharge; use unclead\multipleinput\MultipleInput; @@ -542,7 +545,56 @@ use unclead\multipleinput\MultipleInputColumn; field($model, 'non_gyn_specimen_other')->textarea() ?>
- +
+
+ field($model, 'source_of_specimen_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + CytoSourceOfSpecimen::find()->orderBy(['name' => SORT_ASC])->all(), + 'id', + function ($model) { + return $model->fullname; + } + ), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + 'placeholder' => 'เลือก source of specimen...' + ], + ]) ?> +
+
+ field($model, 'type_of_specimen_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(CytoTypeOfSpecimen::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + /*'options' => [ + 'placeholder' => 'เลือกสิทธิ์การรักษา ....', + ],*/ + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + 'placeholder' => 'เลือก type of specimen...' + ], + ]) ?> +
+
+ field($model, 'fixation_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + CytoFixation::find()->orderBy(['name' => SORT_ASC])->all(), + 'id', + function ($model) { + return $model->fullname; + } + ), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + 'placeholder' => 'เลือก fixation...' + ], + ]) ?> +
+
diff --git a/frontend/modules/report/views/case/_preview_non_gyn.php b/frontend/modules/report/views/case/_preview_non_gyn.php index 83706fcc..b32b8a08 100755 --- a/frontend/modules/report/views/case/_preview_non_gyn.php +++ b/frontend/modules/report/views/case/_preview_non_gyn.php @@ -53,40 +53,40 @@ $final_report = CytoNonGynDiagnosis::findOne(['id_case' => $model->id_case, 'rep
Source of specimen: - Fine Needle Aspiration + sourceSpecimen) ? $model->sourceSpecimen->name : '' ?>    Site: - specimen->name ?> + specimen) ? $model->specimen->name : '' ?>    Appearance: - volume . ' ml, ' . $model->color?> + volume) && isset($model->color) ? $model->volume . ' ml, ' . $model->color : '' ?>
Type of specimen received: - Smear slides + typeSpecimen) ? $model->typeSpecimen->name : '' ?>      Number of slides: - spin ?> + spin) ? $model->spin : '' ?>    Fixation: - in 95% alcohol + fixation) ? $model->fixation->name : '' ?>
@@ -100,7 +100,7 @@ $final_report = CytoNonGynDiagnosis::findOne(['id_case' => $model->id_case, 'rep

report_type) ?> report_type != 'addendum') { ?>report_type == 'corrected') { ?> - REPORTCytologic Diagnosis:Cytologic diagnosis:report_type) .' ' . $diagnosis->pathologist_at; } ?>

From 04bb1bf011f0b904693bfeb914feed2e1db0b598 Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 01:01:30 +0700 Subject: [PATCH 05/13] fix header --- .../pathologist/views/order/staining.php | 1 + .../report/controllers/CaseController.php | 868 +++++++++--------- .../report/views/case/_preview_non_gyn.php | 10 - .../report/views/case/_preview_pap.php | 42 +- .../report/views/case/_preview_surgical.php | 10 - 5 files changed, 468 insertions(+), 463 deletions(-) diff --git a/frontend/modules/pathologist/views/order/staining.php b/frontend/modules/pathologist/views/order/staining.php index 830d4c64..c71188de 100755 --- a/frontend/modules/pathologist/views/order/staining.php +++ b/frontend/modules/pathologist/views/order/staining.php @@ -323,6 +323,7 @@ $this->title = 'Pathologist Staining - สั่งย้อมพิเศษ ( 'allowEmptyList' => true, //'min' => 1, 'addButtonPosition' => MultipleInput::POS_FOOTER, + 'addButtonOptions' => ['class' => 'btn btn-primary'], 'attributeOptions' => [], 'columns' => [ [ diff --git a/frontend/modules/report/controllers/CaseController.php b/frontend/modules/report/controllers/CaseController.php index 8b114e0d..beacd68e 100755 --- a/frontend/modules/report/controllers/CaseController.php +++ b/frontend/modules/report/controllers/CaseController.php @@ -1244,306 +1244,327 @@ class CaseController extends Controller public function header($id_case, $name, $vn = null, $is_critical_diagnosis = null, $is_first_diagnosis = null) { - if ($is_critical_diagnosis == 1) { - $alert = ' - -
-        แจ้งแพทย์ด่วน        -
- - '; - } else { - $alert = null; + + $case_type = Yii::$app->pathology->getCaseType($id_case); + + $case_type = Yii::$app->pathology->getCaseType($id_case); + + $case = null; + $alert = null; // กำหนดค่าเริ่มต้น + + // ค้นหาข้อมูลจากตารางที่เกี่ยวข้อง + if ($case_type == 'surgical') { + $case = SurgicalDiagnosis::findOne(['id_case' => $id_case]); + } elseif ($case_type == 'non-gyn') { + $case = CytoNonGynDiagnosis::findOne(['id_case' => $id_case]); + } elseif ($case_type == 'pap') { + $case = CytoPapDiagnosis::findOne(['id_case' => $id_case]); } - - if ($alert) { - $height = "1.3cm"; - } else { - $height = "1.81cm"; - } - - $vn_text = null; - if ($vn != '') { - - if (preg_match('/^[a-z0-9-_+.]+$/i', $vn)) { // ห้าม key ไทย - $vn_text = '
VN : ' . $vn . '
'; - } - } - return ' - - - + // ตรวจสอบว่ามีการตั้งค่า critical diagnosis หรือไม่ + if (!empty($case) && $case->is_critical_diagnosis == 1) { + $alert = '
- - - - -
' . Html::img(Yii::getAlias('@webroot') . '/img/logo_report/logo.png', ['width' => '', 'height' => '2.8cm']) . '
- - Suratthani Hospital, Muang Suratthani,
- Suratthani 84000 Tel. 077 952 900 ต่อ 7322, 7328
-
+
+ CRITICAL REPORT
+ แจ้งแพทย์ด่วน
- PATHOLOGY REPORT
- Department of Anatomical Pathology
- -
' . $id_case . '
' . '
' . $alert . '
' . '
- - +
'; + } + +// กำหนดความสูงของ element +$height = ($alert !== null) ? "1.3cm" : "1.81cm"; + $vn_text = null; + if ($vn != '') { + + if (preg_match('/^[a-z0-9-_+.]+$/i', $vn)) { // ห้าม key ไทย + $vn_text = '
VN : ' . $vn . '
'; + } + } +return ' + + + - + + + + -
- ' . strtoupper($name) . ' PATHOLOGY REPORT - + ' . Html::img(Yii::getAlias('@webroot') . '/img/logo_report/logo.png', ['width' => '', 'height' => '2.8cm']) . '
+ + Suratthani Hospital, Muang Suratthani,
+ Suratthani 84000 Tel. 077 952 900 ต่อ 7322, 7328
+
+
+ PATHOLOGY REPORT
+ Department of Anatomical Pathology
+
+
' . $alert . '
+ ' . Html::encode($id_case) . ' +
'; + + + + + + + +
+ ' . strtoupper($name) . ' PATHOLOGY REPORT +
'; +} + +/** +* @param $id_case +* @param $mode +* @return string|Response +*/ +public function actionFlow($id_case, $mode = null) +{ +$case_non_gyn = CaseFlow::findOne(['id_case' => $id_case]); +//$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); +if (!$case_non_gyn) { +Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่ค้นหา หรือยังไม่ได้ออก Final Report'); +return $this->redirect(['/report']); +} +Yii::$app->session->setFlash('info', 'กำลังสร้างรายงาน Case : ' . $id_case); +return $this->render('flow', [ +'case_non_gyn' => $case_non_gyn, +'mode' => $mode, +]); +} + +/** +* @param $id_case +* @param $mode +* @param $file +* @return mixed|void|Response +* @throws \Mpdf\MpdfException +* @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException +* @throws \setasign\Fpdi\PdfParser\PdfParserException +* @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException +* @throws \yii\base\Exception +* @throws \yii\base\InvalidConfigException +*/ +public function actionFlowPdf($id_case, $id, $report_type, $mode = 'preview', $file = false, $watermark = true) +{ +$case = CaseFlow::findOne(['id_case' => $id_case]); +//$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); +//var_dump($case_non_gyn); +//die(); +if (!$case) { +Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่เลือก'); +return $this->redirect(['/report']); +} +//$cyto_operate = CytoOperate::findOne(['id_case' => $case_non_gyn->id_case]); +//$model = $case_non_gyn; +$flow_diagnosis = FlowDiagnosis::findOne([ +'id_case' => $case->id_case, +'report_type' => $report_type, +'id' => $id, +]); + +// get your HTML raw content without any layouts or scripts +$content = $this->renderPartial('_preview_flow', [ +'model' => $case, +'mode' => $mode, +'diagnosis' => $flow_diagnosis +]); + + +$header = $this->renderPartial('_header_report', [ +'model' => $case, +'diagnosis' => $flow_diagnosis, +'mode' => $mode, +]); + +// setup kartik\mpdf\Pdf component +$pdf = new Pdf([ +// set to use core fonts only +'mode' => Pdf::MODE_UTF8, +// A4 paper format +'format' => Pdf::FORMAT_A4, +// portrait orientation +'orientation' => Pdf::ORIENT_PORTRAIT, +// stream to browser inline +'destination' => Pdf::DEST_BROWSER, +// your html content input +'content' => $content, +// format content from your own css file if needed or use the +// enhanced bootstrap css built by Krajee for mPDF formatting +'cssFile' => '@frontend/web/css/pdf.css', +// any css to be embedded if required +'cssInline' => '.bd{border:1.5px solid; text-align: center;} .ar{text-align:right} .imgbd{border:1px solid}', +// set mPDF properties on the fly +'options' => [ +'title' => 'Preview Report Case: ' . $case->id_case, +'defaultheaderline' => 0, +'defaultfooterline' => 0, +'showWatermarkText' => ($watermark == true ? true : false), +'watermark_font' => 'browallia', +'setAutoTopMargin' => false, //pad +'autoMarginPadding' => 2, +'useSubstitutions' => true +], +// call mPDF methods on the fly +'methods' => [ +'SetWatermarkText' => ['COPY', 0.05], +'SetHtmlHeader' => [$this->header($case->id_case, 'FLOW') . $header], +'SetFooter' => ['' . $case->id_case . '|' . + Yii::$app->params['settings']['non_gyn_rev'] . '|Report Page + {PAGENO}/{nbpg}'], + ], + 'marginLeft' => 12, + 'marginRight' => 10, + 'marginTop' => 85, + 'marginBottom' => 15, + 'marginFooter' => 3, + ]); + + $defaultConfig = (new ConfigVariables())->getDefaults(); + $fontDirs = $defaultConfig['fontDir']; + + $defaultFontConfig = (new FontVariables())->getDefaults(); + $fontData = $defaultFontConfig['fontdata']; + + $pdf->options['fontDir'] = array_merge($fontDirs, [ + Yii::getAlias('@webroot') . '/fonts' + ]); + + + $pdf->options['fontdata'] = $fontData + [ + 'angsananew' => [ + 'R' => 'AngsanaNew.ttf', + 'TTCfontID' => [ + 'R' => 1, + ], + ], + 'sarabun' => [ + 'R' => 'THSarabunNew.ttf', + ], + 'browallia' => [ + 'R' => 'Browallia.ttf', + ], + ]; + + if ($file == true) { + FileHelper::createDirectory(Yii::getAlias('@webroot') . '/patho_reports/'); + $pdf->Output($content, Yii::getAlias('@webroot') . '/patho_reports/' . $case->id_case . '_' . $case->h_n . '_' . + $flow_diagnosis->report_type . '.pdf', Destination::FILE); + } else { + return $pdf->render(); } - - /** - * @param $id_case - * @param $mode - * @return string|Response - */ - public function actionFlow($id_case, $mode = null) - { - $case_non_gyn = CaseFlow::findOne(['id_case' => $id_case]); - //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); - if (!$case_non_gyn) { - Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่ค้นหา หรือยังไม่ได้ออก Final Report'); - return $this->redirect(['/report']); - } - Yii::$app->session->setFlash('info', 'กำลังสร้างรายงาน Case : ' . $id_case); - return $this->render('flow', [ - 'case_non_gyn' => $case_non_gyn, - 'mode' => $mode, - ]); - } - - /** - * @param $id_case - * @param $mode - * @param $file - * @return mixed|void|Response - * @throws \Mpdf\MpdfException - * @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException - * @throws \setasign\Fpdi\PdfParser\PdfParserException - * @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException - * @throws \yii\base\Exception - * @throws \yii\base\InvalidConfigException - */ - public function actionFlowPdf($id_case, $id, $report_type, $mode = 'preview', $file = false, $watermark = true) - { - $case = CaseFlow::findOne(['id_case' => $id_case]); - //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); - //var_dump($case_non_gyn); - //die(); - if (!$case) { - Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่เลือก'); - return $this->redirect(['/report']); - } - //$cyto_operate = CytoOperate::findOne(['id_case' => $case_non_gyn->id_case]); - //$model = $case_non_gyn; - $flow_diagnosis = FlowDiagnosis::findOne([ - 'id_case' => $case->id_case, - 'report_type' => $report_type, - 'id' => $id, - ]); - - // get your HTML raw content without any layouts or scripts - $content = $this->renderPartial('_preview_flow', [ - 'model' => $case, - 'mode' => $mode, - 'diagnosis' => $flow_diagnosis - ]); - - - $header = $this->renderPartial('_header_report', [ - 'model' => $case, - 'diagnosis' => $flow_diagnosis, - 'mode' => $mode, - ]); - - // setup kartik\mpdf\Pdf component - $pdf = new Pdf([ - // set to use core fonts only - 'mode' => Pdf::MODE_UTF8, - // A4 paper format - 'format' => Pdf::FORMAT_A4, - // portrait orientation - 'orientation' => Pdf::ORIENT_PORTRAIT, - // stream to browser inline - 'destination' => Pdf::DEST_BROWSER, - // your html content input - 'content' => $content, - // format content from your own css file if needed or use the - // enhanced bootstrap css built by Krajee for mPDF formatting - 'cssFile' => '@frontend/web/css/pdf.css', - // any css to be embedded if required - 'cssInline' => '.bd{border:1.5px solid; text-align: center;} .ar{text-align:right} .imgbd{border:1px solid}', - // set mPDF properties on the fly - 'options' => [ - 'title' => 'Preview Report Case: ' . $case->id_case, - 'defaultheaderline' => 0, - 'defaultfooterline' => 0, - 'showWatermarkText' => ($watermark == true ? true : false), - 'watermark_font' => 'browallia', - 'setAutoTopMargin' => false, //pad - 'autoMarginPadding' => 2, - 'useSubstitutions' => true - ], - // call mPDF methods on the fly - 'methods' => [ - 'SetWatermarkText' => ['COPY', 0.05], - 'SetHtmlHeader' => [$this->header($case->id_case, 'FLOW') . $header], - 'SetFooter' => ['' . $case->id_case . '|' . Yii::$app->params['settings']['non_gyn_rev'] . '|Report Page {PAGENO}/{nbpg}'], - ], - 'marginLeft' => 12, - 'marginRight' => 10, - 'marginTop' => 85, - 'marginBottom' => 15, - 'marginFooter' => 3, - ]); - - $defaultConfig = (new ConfigVariables())->getDefaults(); - $fontDirs = $defaultConfig['fontDir']; - - $defaultFontConfig = (new FontVariables())->getDefaults(); - $fontData = $defaultFontConfig['fontdata']; - - $pdf->options['fontDir'] = array_merge($fontDirs, [ - Yii::getAlias('@webroot') . '/fonts' - ]); - - - $pdf->options['fontdata'] = $fontData + [ - 'angsananew' => [ - 'R' => 'AngsanaNew.ttf', - 'TTCfontID' => [ - 'R' => 1, - ], - ], - 'sarabun' => [ - 'R' => 'THSarabunNew.ttf', - ], - 'browallia' => [ - 'R' => 'Browallia.ttf', - ], - ]; - - if ($file == true) { - FileHelper::createDirectory(Yii::getAlias('@webroot') . '/patho_reports/'); - $pdf->Output($content, Yii::getAlias('@webroot') . '/patho_reports/' . $case->id_case . '_' . $case->h_n . '_' . $flow_diagnosis->report_type . '.pdf', Destination::FILE); - } else { - return $pdf->render(); - } } /** - * @param $id_case - * @param $mode - * @return string|Response - */ + * @param $id_case + * @param $mode + * @return string|Response + */ public function actionMolecular($id_case, $mode = null) { - $case = CaseMolecular::findOne(['id_case' => $id_case]); - //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); - if (!$case) { - Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่ค้นหา หรือยังไม่ได้ออก Final Report'); - return $this->redirect(['/report']); - } - Yii::$app->session->setFlash('info', 'กำลังสร้างรายงาน Case : ' . $id_case); - return $this->render('molecular', [ - 'case_non_gyn' => $case, - 'mode' => $mode, - ]); + $case = CaseMolecular::findOne(['id_case' => $id_case]); + //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); + if (!$case) { + Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่ค้นหา หรือยังไม่ได้ออก Final Report'); + return $this->redirect(['/report']); + } + Yii::$app->session->setFlash('info', 'กำลังสร้างรายงาน Case : ' . $id_case); + return $this->render('molecular', [ + 'case_non_gyn' => $case, + 'mode' => $mode, + ]); } /** - * @param $id_case - * @param $mode - * @param $file - * @return mixed|void|Response - * @throws \Mpdf\MpdfException - * @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException - * @throws \setasign\Fpdi\PdfParser\PdfParserException - * @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException - * @throws \yii\base\Exception - * @throws \yii\base\InvalidConfigException - */ + * @param $id_case + * @param $mode + * @param $file + * @return mixed|void|Response + * @throws \Mpdf\MpdfException + * @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException + * @throws \setasign\Fpdi\PdfParser\PdfParserException + * @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException + * @throws \yii\base\Exception + * @throws \yii\base\InvalidConfigException + */ public function actionMolecularPdf($id_case, $id, $report_type, $mode = 'preview', $file = false, $watermark = true) { - $case = CaseMolecular::findOne(['id_case' => $id_case]); - $finance = FinanceServiceCharge::findOne(['id_case' => $case->id_case]); - //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); - //var_dump($case_non_gyn); - //die(); - if (!$case) { - Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่เลือก'); - return $this->redirect(['/report']); - } - //$cyto_operate = CytoOperate::findOne(['id_case' => $case_non_gyn->id_case]); - //$model = $case_non_gyn; - $molecular_diagnosis = MolecularDiagnosis::findOne([ - 'id_case' => $case->id_case, - 'report_type' => $report_type, - 'id' => $id, - ]); + $case = CaseMolecular::findOne(['id_case' => $id_case]); + $finance = FinanceServiceCharge::findOne(['id_case' => $case->id_case]); + //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); + //var_dump($case_non_gyn); + //die(); + if (!$case) { + Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่เลือก'); + return $this->redirect(['/report']); + } + //$cyto_operate = CytoOperate::findOne(['id_case' => $case_non_gyn->id_case]); + //$model = $case_non_gyn; + $molecular_diagnosis = MolecularDiagnosis::findOne([ + 'id_case' => $case->id_case, + 'report_type' => $report_type, + 'id' => $id, + ]); - // get your HTML raw content without any layouts or scripts - $content = $this->renderPartial('_preview_molecular', [ - 'model' => $case, - 'finance' => $finance, - 'mode' => $mode, - 'diagnosis' => $molecular_diagnosis - ]); + // get your HTML raw content without any layouts or scripts + $content = $this->renderPartial('_preview_molecular', [ + 'model' => $case, + 'finance' => $finance, + 'mode' => $mode, + 'diagnosis' => $molecular_diagnosis + ]); - $header = $this->renderPartial('_header_report', [ - 'model' => $case, - 'diagnosis' => $molecular_diagnosis, - 'mode' => $mode, - ]); + $header = $this->renderPartial('_header_report', [ + 'model' => $case, + 'diagnosis' => $molecular_diagnosis, + 'mode' => $mode, + ]); - // setup kartik\mpdf\Pdf component - $pdf = new Pdf([ - // set to use core fonts only - 'mode' => Pdf::MODE_UTF8, - // A4 paper format - 'format' => Pdf::FORMAT_A4, - // portrait orientation - 'orientation' => Pdf::ORIENT_PORTRAIT, - // stream to browser inline - 'destination' => Pdf::DEST_BROWSER, - // your html content input - 'content' => $content, - // format content from your own css file if needed or use the - // enhanced bootstrap css built by Krajee for mPDF formatting - 'cssFile' => '@frontend/web/css/pdf.css', - // any css to be embedded if required - 'cssInline' => '.bd{border:1.5px solid; text-align: center;} .ar{text-align:right} .imgbd{border:1px solid}', - // set mPDF properties on the fly - 'options' => [ - 'title' => 'Preview Report Case: ' . $case->id_case, - 'defaultheaderline' => 0, - 'defaultfooterline' => 0, - 'showWatermarkText' => ($watermark == true ? true : false), - 'watermark_font' => 'browallia', - 'setAutoTopMargin' => false, //pad - 'autoMarginPadding' => 2, - 'useSubstitutions' => true - ], - // call mPDF methods on the fly - 'methods' => [ - 'SetWatermarkText' => ['COPY', 0.05], - 'SetHtmlHeader' => [$this->header($case->id_case, 'Molecular') . $header], - 'SetFooter' => ['' . $case->id_case . '|' . Yii::$app->params['settings']['non_gyn_rev'] . '|Report Page {PAGENO}/{nbpg}'], - ], - 'marginLeft' => 12, - 'marginRight' => 10, - 'marginTop' => 85, - 'marginBottom' => 15, - 'marginFooter' => 3, + // setup kartik\mpdf\Pdf component + $pdf = new Pdf([ + // set to use core fonts only + 'mode' => Pdf::MODE_UTF8, + // A4 paper format + 'format' => Pdf::FORMAT_A4, + // portrait orientation + 'orientation' => Pdf::ORIENT_PORTRAIT, + // stream to browser inline + 'destination' => Pdf::DEST_BROWSER, + // your html content input + 'content' => $content, + // format content from your own css file if needed or use the + // enhanced bootstrap css built by Krajee for mPDF formatting + 'cssFile' => '@frontend/web/css/pdf.css', + // any css to be embedded if required + 'cssInline' => '.bd{border:1.5px solid; text-align: center;} .ar{text-align:right} .imgbd{border:1px solid}', + // set mPDF properties on the fly + 'options' => [ + 'title' => 'Preview Report Case: ' . $case->id_case, + 'defaultheaderline' => 0, + 'defaultfooterline' => 0, + 'showWatermarkText' => ($watermark == true ? true : false), + 'watermark_font' => 'browallia', + 'setAutoTopMargin' => false, //pad + 'autoMarginPadding' => 2, + 'useSubstitutions' => true + ], + // call mPDF methods on the fly + 'methods' => [ + 'SetWatermarkText' => ['COPY', 0.05], + 'SetHtmlHeader' => [$this->header($case->id_case, 'Molecular') . $header], + 'SetFooter' => ['' . $case->id_case . '|' . + Yii::$app->params['settings']['non_gyn_rev'] . '|Report Page + {PAGENO}/{nbpg}'], + ], + 'marginLeft' => 12, + 'marginRight' => 10, + 'marginTop' => 85, + 'marginBottom' => 15, + 'marginFooter' => 3, ]); $defaultConfig = (new ConfigVariables())->getDefaults(); @@ -1553,219 +1574,224 @@ class CaseController extends Controller $fontData = $defaultFontConfig['fontdata']; $pdf->options['fontDir'] = array_merge($fontDirs, [ - Yii::getAlias('@webroot') . '/fonts' + Yii::getAlias('@webroot') . '/fonts' ]); $pdf->options['fontdata'] = $fontData + [ - 'angsananew' => [ - 'R' => 'AngsanaNew.ttf', - 'TTCfontID' => [ - 'R' => 1, - ], - ], - 'sarabun' => [ - 'R' => 'THSarabunNew.ttf', - ], - 'browallia' => [ - 'R' => 'Browallia.ttf', - ], + 'angsananew' => [ + 'R' => 'AngsanaNew.ttf', + 'TTCfontID' => [ + 'R' => 1, + ], + ], + 'sarabun' => [ + 'R' => 'THSarabunNew.ttf', + ], + 'browallia' => [ + 'R' => 'Browallia.ttf', + ], ]; if ($file == true) { - FileHelper::createDirectory(Yii::getAlias('@webroot') . '/patho_reports/'); - $pdf->Output($content, Yii::getAlias('@webroot') . '/patho_reports/' . $case->id_case . '_' . $case->h_n . '_' . $molecular_diagnosis->report_type . '.pdf', Destination::FILE); + FileHelper::createDirectory(Yii::getAlias('@webroot') . '/patho_reports/'); + $pdf->Output($content, Yii::getAlias('@webroot') . '/patho_reports/' . $case->id_case . '_' . $case->h_n . '_' . + $molecular_diagnosis->report_type . '.pdf', Destination::FILE); } else { - return $pdf->render(); + return $pdf->render(); + } } - } - /** - * @param $id_case - * @param $mode - * @return string|Response - */ - public function actionNecropsy($id_case, $mode = null) - { + /** + * @param $id_case + * @param $mode + * @return string|Response + */ + public function actionNecropsy($id_case, $mode = null) + { $case_necropsy = CaseNecropsy::findOne(['id_case' => $id_case]); //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); if (!$case_necropsy) { - Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่ค้นหา หรือยังไม่ได้ออก Final Report'); - return $this->redirect(['/report']); + Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่ค้นหา หรือยังไม่ได้ออก Final Report'); + return $this->redirect(['/report']); } Yii::$app->session->setFlash('info', 'กำลังสร้างรายงาน Case : ' . $id_case); return $this->render('necropsy', [ - 'case_necropsy' => $case_necropsy, - 'mode' => $mode, + 'case_necropsy' => $case_necropsy, + 'mode' => $mode, ]); - } + } - /** - * @param $id_case - * @param $mode - * @param $file - * @return mixed|void|Response - * @throws \Mpdf\MpdfException - * @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException - * @throws \setasign\Fpdi\PdfParser\PdfParserException - * @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException - * @throws \yii\base\Exception - * @throws \yii\base\InvalidConfigException - */ - public function actionNecropsyPdf($id_case, $id, $report_type, $mode = 'preview', $file = false, $watermark = true) - { + /** + * @param $id_case + * @param $mode + * @param $file + * @return mixed|void|Response + * @throws \Mpdf\MpdfException + * @throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException + * @throws \setasign\Fpdi\PdfParser\PdfParserException + * @throws \setasign\Fpdi\PdfParser\Type\PdfTypeException + * @throws \yii\base\Exception + * @throws \yii\base\InvalidConfigException + */ + public function actionNecropsyPdf($id_case, $id, $report_type, $mode = 'preview', $file = false, $watermark = + true) + { $case_necropsy = CaseNecropsy::findOne(['id_case' => $id_case]); $finance = FinanceServiceCharge::findOne(['id_case' => $case_necropsy->id_case]); //$patient_case_approve = PatientCaseApprove::findOne(['id_case' => $id_case]); //var_dump($case_necropsy); //die(); if (!$case_necropsy) { - Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่เลือก'); - return $this->redirect(['/report']); + Yii::$app->session->setFlash('error', 'ไม่พบ Case ที่เลือก'); + return $this->redirect(['/report']); } //$cyto_operate = CytoOperate::findOne(['id_case' => $case_necropsy->id_case]); //$model = $case_necropsy; $necropsy_diagnosis = NecropsyDiagnosis::findOne([ - 'id_case' => $case_necropsy->id_case, - 'report_type' => $report_type, - 'id' => $id, + 'id_case' => $case_necropsy->id_case, + 'report_type' => $report_type, + 'id' => $id, ]); // get your HTML raw content without any layouts or scripts $content = $this->renderPartial('_preview_necropsy', [ - 'model' => $case_necropsy, - 'finance' => $finance, - 'mode' => $mode, - 'diagnosis' => $necropsy_diagnosis, + 'model' => $case_necropsy, + 'finance' => $finance, + 'mode' => $mode, + 'diagnosis' => $necropsy_diagnosis, ]); $header = $this->renderPartial('_header_report', [ - 'model' => $case_necropsy, - 'diagnosis' => $necropsy_diagnosis, - 'mode' => $mode, + 'model' => $case_necropsy, + 'diagnosis' => $necropsy_diagnosis, + 'mode' => $mode, ]); // setup kartik\mpdf\Pdf component $pdf = new Pdf([ - // set to use core fonts only - 'mode' => Pdf::MODE_UTF8, - // A4 paper format - 'format' => Pdf::FORMAT_A4, - // portrait orientation - 'orientation' => Pdf::ORIENT_PORTRAIT, - // stream to browser inline - 'destination' => Pdf::DEST_BROWSER, - // your html content input - 'content' => $content, - // format content from your own css file if needed or use the - // enhanced bootstrap css built by Krajee for mPDF formatting - 'cssFile' => '@frontend/web/css/pdf.css', - // any css to be embedded if required - 'cssInline' => '.bd{border:1.5px solid; text-align: center;} .ar{text-align:right} .imgbd{border:1px solid}', - // set mPDF properties on the fly - 'options' => [ - 'title' => 'Preview Report Case: ' . $case_necropsy->id_case, - 'defaultheaderline' => 0, - 'defaultfooterline' => 0, - 'showWatermarkText' => ($watermark == true ? true : false), - 'watermark_font' => 'browallia', - 'setAutoTopMargin' => false, //pad - 'autoMarginPadding' => 2, - 'useSubstitutions' => true - ], - // call mPDF methods on the fly - 'methods' => [ - 'SetWatermarkText' => ['COPY', 0.05], - 'SetHtmlHeader' => [$this->header($case_necropsy->id_case, 'Necropsy') . $header], - 'SetFooter' => ['' . $case_necropsy->id_case . '|' . Yii::$app->params['settings']['non_gyn_rev'] . '|Report Page {PAGENO}/{nbpg}'], + // set to use core fonts only + 'mode' => Pdf::MODE_UTF8, + // A4 paper format + 'format' => Pdf::FORMAT_A4, + // portrait orientation + 'orientation' => Pdf::ORIENT_PORTRAIT, + // stream to browser inline + 'destination' => Pdf::DEST_BROWSER, + // your html content input + 'content' => $content, + // format content from your own css file if needed or use the + // enhanced bootstrap css built by Krajee for mPDF formatting + 'cssFile' => '@frontend/web/css/pdf.css', + // any css to be embedded if required + 'cssInline' => '.bd{border:1.5px solid; text-align: center;} .ar{text-align:right} .imgbd{border:1px solid}', + // set mPDF properties on the fly + 'options' => [ + 'title' => 'Preview Report Case: ' . $case_necropsy->id_case, + 'defaultheaderline' => 0, + 'defaultfooterline' => 0, + 'showWatermarkText' => ($watermark == true ? true : false), + 'watermark_font' => 'browallia', + 'setAutoTopMargin' => false, //pad + 'autoMarginPadding' => 2, + 'useSubstitutions' => true + ], + // call mPDF methods on the fly + 'methods' => [ + 'SetWatermarkText' => ['COPY', 0.05], + 'SetHtmlHeader' => [$this->header($case_necropsy->id_case, 'Necropsy') . $header], + 'SetFooter' => ['' . $case_necropsy->id_case . '|' . Yii::$app->params['settings']['non_gyn_rev'] . '|Report Page {PAGENO}/{nbpg}'], ], 'marginLeft' => 12, 'marginRight' => 10, 'marginTop' => 90, 'marginBottom' => 15, 'marginFooter' => 3, - ]); + ]); - $defaultConfig = (new ConfigVariables())->getDefaults(); - $fontDirs = $defaultConfig['fontDir']; + $defaultConfig = (new ConfigVariables())->getDefaults(); + $fontDirs = $defaultConfig['fontDir']; - $defaultFontConfig = (new FontVariables())->getDefaults(); - $fontData = $defaultFontConfig['fontdata']; + $defaultFontConfig = (new FontVariables())->getDefaults(); + $fontData = $defaultFontConfig['fontdata']; - $pdf->options['fontDir'] = array_merge($fontDirs, [ + $pdf->options['fontDir'] = array_merge($fontDirs, [ Yii::getAlias('@webroot') . '/fonts' - ]); + ]); - $pdf->options['fontdata'] = $fontData + [ + $pdf->options['fontdata'] = $fontData + [ 'angsananew' => [ - 'R' => 'AngsanaNew.ttf', - 'TTCfontID' => [ - 'R' => 1, - ], + 'R' => 'AngsanaNew.ttf', + 'TTCfontID' => [ + 'R' => 1, + ], ], 'sarabun' => [ - 'R' => 'THSarabunNew.ttf', + 'R' => 'THSarabunNew.ttf', ], 'browallia' => [ - 'R' => 'Browallia.ttf', + 'R' => 'Browallia.ttf', ], - ]; + ]; - if ($file == true) { + if ($file == true) { FileHelper::createDirectory(Yii::getAlias('@webroot') . '/patho_reports/'); - $pdf->Output($content, Yii::getAlias('@webroot') . '/patho_reports/' . $case_necropsy->id_case . '_' . $case_necropsy->h_n . '_' . $necropsy_diagnosis->report_type . '.pdf', Destination::FILE); - } else { + $pdf->Output($content, Yii::getAlias('@webroot') . '/patho_reports/' . $case_necropsy->id_case . '_' . + $case_necropsy->h_n . '_' . $necropsy_diagnosis->report_type . '.pdf', Destination::FILE); + } else { return $pdf->render(); - } - } + } + } - /** - * Search Surgical - * - * @return void - */ - public function actionSearchSurgical() - { - $searchModel = new SurgicalDiagnosisSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + /** + * Search Surgical + * + * @return void + */ + public function actionSearchSurgical() + { + $searchModel = new SurgicalDiagnosisSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('search-surgical', [ + return $this->render('search-surgical', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, - ]); - } + ]); + } - /** - * Search Surgical - * - * @return void - */ - public function actionSearchNonGyn() - { - $searchModel = new CytoNonGynDiagnosisSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + /** + * Search Surgical + * + * @return void + */ + public function actionSearchNonGyn() + { + $searchModel = new CytoNonGynDiagnosisSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('search-surgical', [ + return $this->render('search-surgical', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, - ]); - } + ]); + } - /** - * Search Surgical - * - * @return void - */ - public function actionSearchPap() - { - $searchModel = new CytoPapDiagnosisSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + /** + * Search Surgical + * + * @return void + */ + public function actionSearchPap() + { + $searchModel = new CytoPapDiagnosisSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('search-surgical', [ + return $this->render('search-surgical', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, - ]); - } -} \ No newline at end of file + ]); + } + } \ No newline at end of file diff --git a/frontend/modules/report/views/case/_preview_non_gyn.php b/frontend/modules/report/views/case/_preview_non_gyn.php index b32b8a08..8c3666c6 100755 --- a/frontend/modules/report/views/case/_preview_non_gyn.php +++ b/frontend/modules/report/views/case/_preview_non_gyn.php @@ -17,16 +17,6 @@ $final_report = CytoNonGynDiagnosis::findOne(['id_case' => $model->id_case, 'rep - is_critical_diagnosis == 1) { ?> - - - - -
- CRITICAL REPORT
- แจ้งแพทย์ด่วน
-
- is_conference == 1) { ?> diff --git a/frontend/modules/report/views/case/_preview_pap.php b/frontend/modules/report/views/case/_preview_pap.php index c170c5e2..ee81bb94 100755 --- a/frontend/modules/report/views/case/_preview_pap.php +++ b/frontend/modules/report/views/case/_preview_pap.php @@ -16,35 +16,33 @@ $hospital = ConstHospital::findOne($model->hospital_id); //$type = ['EP' => 'Conventional Pap smear', 'RP' => 'Conventional Pap smear', 'TP' => 'Thin prep', 'NP' => 'Nova prep', 'CP' => 'Clear prep', 'PT' => 'Path tezt']; ?> - - render('__pap', ['model' => $model, 'cyto_pap_diagnosis' => $cyto_pap_diagnosis]) ?> pathologist_id)) { ?> - -
-

- Authorized by:
- cytotech1) ? $cyto_pap_diagnosis->cytotech1->report_name : null ?>
- cytotech2) ? '' . $cyto_pap_diagnosis->cytotech2->report_name . '
' : null ?> - ATTENDING CYTOTECHNOLOGIST
- pathologist) ? $cyto_pap_diagnosis->pathologist->report_name : null ?>
- ATTENDING PATHOLOGIST (Electronically signed) - pathology->engToDateOnly($cyto_pap_diagnosis->pathologist_at) ?>

-

+ +
+

+ Authorized by:
+ cytotech1) ? $cyto_pap_diagnosis->cytotech1->report_name : null ?>
+ cytotech2) ? '' . $cyto_pap_diagnosis->cytotech2->report_name . '
' : null ?> + ATTENDING CYTOTECHNOLOGIST
+ pathologist) ? $cyto_pap_diagnosis->pathologist->report_name : null ?>
+ ATTENDING PATHOLOGIST (Electronically signed) + pathology->engToDateOnly($cyto_pap_diagnosis->pathologist_at) ?>

+

- -
-

- Authorized by:
- cytotech1) ? $cyto_pap_diagnosis->cytotech1->report_name : null ?>
- cytotech2) ? '' . $cyto_pap_diagnosis->cytotech2->report_name . '
' : null ?> - ATTENDING CYTOTECHNOLOGIST, - pathology->engToDateOnly(isset($cyto_pap_diagnosis->cytotech2) ? $cyto_pap_diagnosis->cytotech2_at : $cyto_pap_diagnosis->cytotech1_at) ?>
+ +
+

+ Authorized by:
+ cytotech1) ? $cyto_pap_diagnosis->cytotech1->report_name : null ?>
+ cytotech2) ? '' . $cyto_pap_diagnosis->cytotech2->report_name . '
' : null ?> + ATTENDING CYTOTECHNOLOGIST, + pathology->engToDateOnly(isset($cyto_pap_diagnosis->cytotech2) ? $cyto_pap_diagnosis->cytotech2_at : $cyto_pap_diagnosis->cytotech1_at) ?>
-

+


diff --git a/frontend/modules/report/views/case/_preview_surgical.php b/frontend/modules/report/views/case/_preview_surgical.php index 38981b39..d803a3b7 100755 --- a/frontend/modules/report/views/case/_preview_surgical.php +++ b/frontend/modules/report/views/case/_preview_surgical.php @@ -25,16 +25,6 @@ die();*/
- is_critical_diagnosis == 1) { ?> - - - - -
- CRITICAL REPORT
- แจ้งแพทย์ด่วน
-
- is_conference == 1) { ?> From 889fe4a64f6b5d079730f5e234f74cdff63c7cbf Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 01:43:50 +0700 Subject: [PATCH 06/13] fix gyn --- common/models/CytoPapDiagnosisLog.php | 5 +- .../center-approve-gyn/_cyto_screener.php | 242 +++++++++--------- .../cyto/controllers/NonGynController.php | 2 + .../cyto/controllers/PapController.php | 21 ++ .../pathologist/views/do/_cyto_screener.php | 151 +++++++++++ .../pathologist/views/do/pap-final.php | 4 +- 6 files changed, 296 insertions(+), 129 deletions(-) create mode 100644 frontend/modules/pathologist/views/do/_cyto_screener.php diff --git a/common/models/CytoPapDiagnosisLog.php b/common/models/CytoPapDiagnosisLog.php index 4435a19e..f28f0219 100755 --- a/common/models/CytoPapDiagnosisLog.php +++ b/common/models/CytoPapDiagnosisLog.php @@ -42,7 +42,7 @@ class CytoPapDiagnosisLog extends \yii\db\ActiveRecord return [ [['id_case', 'report_type', 'user_id'], 'required'], [['id', 'specimen_adequacy', 'specimen_adequacy_1', 'specimen_adequacy_2', 'general_categorization', 'general_categorization_1', 'user_id'], 'integer'], - [['specimen_adequacy_3', 'general_categorization_2', 'suggestion'], 'string'], + [['specimen_adequacy_3', 'general_categorization_2', 'suggestion', 'specimen_adequacy_4'], 'string'], [['approve_at'], 'safe'], [['id_case', 'report_type'], 'string', 'max' => 50], [['adequacy_other', 'categorization_other', 'suggestion_list'], 'string', 'max' => 600], @@ -60,8 +60,9 @@ class CytoPapDiagnosisLog extends \yii\db\ActiveRecord 'report_type' => 'Report Type', 'specimen_adequacy' => 'Specimen Adequacy', 'specimen_adequacy_1' => 'Specimen Adequacy 1', - 'specimen_adequacy_2' => 'Specimen Adequacy 2', + 'specimen_adequacy_2' => 'Specimen Adequacy 5', 'specimen_adequacy_3' => 'Specimen Adequacy 3', + 'specimen_adequacy_4' => 'Specimen Adequacy 2', 'adequacy_other' => 'Adequacy Other', 'general_categorization' => 'General Categorization', 'general_categorization_1' => 'General Categorization 1', diff --git a/frontend/modules/approve/views/center-approve-gyn/_cyto_screener.php b/frontend/modules/approve/views/center-approve-gyn/_cyto_screener.php index afa22e99..21d96a28 100755 --- a/frontend/modules/approve/views/center-approve-gyn/_cyto_screener.php +++ b/frontend/modules/approve/views/center-approve-gyn/_cyto_screener.php @@ -1,7 +1,6 @@ where([ 'id_case' => $case_pap->id_case, ]) - ->all(); + ->one(); // ใช้ one() เพื่อดึงรายการเดียว ?> -
-
-

All Report of id_case) ?>

-
-
- -
- - -
-
- -
-
-
- $log, - 'attributes' => [ - [ - 'attribute' => 'specimen_adequacy_1', - 'value' => function ($model) { - $adequacies1 = CytoSpecimenAdequacy1::find() - ->where(['type' => 'pap']) - ->andWhere(['<>', 'id', 2]) - ->all(); - - $adequacyMap1 = []; - foreach ($adequacies1 as $adequacy1) { - $adequacyMap1[$adequacy1->id] = '(' . $adequacy1->code . ') ' . $adequacy1->name; - } - - return isset($adequacyMap1[$model->specimen_adequacy_1]) ? $adequacyMap1[$model->specimen_adequacy_1] : ''; - } - ], - [ - 'attribute' => 'general_categorization_1', - 'value' => function ($model) { - $general1 = CytoGeneralCategorization1::find() - ->orderBy(['code' => SORT_ASC])->all(); - - $generalMap1 = []; - foreach ($general1 as $categorization1) { - $generalMap1[$categorization1->id] = '(' . $categorization1->code . ') ' . $categorization1->name; - } - - return isset($generalMap1[$model->general_categorization_1]) ? $generalMap1[$model->general_categorization_1] : ''; - } - ], - [ - 'attribute' => 'specimen_adequacy_2', - 'value' => function ($model) { - $adequacies2 = CytoSpecimenAdequacy2::find()->orderBy(['code' => SORT_ASC])->all(); - - $adequacyMap2 = []; - foreach ($adequacies2 as $adequacy2) { - $adequacyMap2[$adequacy2->id] = '(' . $adequacy2->code . ') ' . $adequacy2->name; - } - - return isset($adequacyMap2[$model->specimen_adequacy_2]) ? $adequacyMap2[$model->specimen_adequacy_2] : ''; - } - ], - [ - 'attribute' => 'specimen_adequacy_3', - 'format' => 'raw', - 'value' => function ($model) { - $adequacies3 = CytoSpecimenAdequacy3::find()->where(['in', 'id', unserialize($model->specimen_adequacy_3)])->all(); - - $rt3 = '
    '; - foreach ($adequacies3 as $ad3) { - $rt3 .= '
  • ' . '(' . $ad3->code . ') ' . $ad3->name . '
  • '; - } - $rt3 .= '
'; - - return $rt3; - } - ], - [ - 'attribute' => 'general_categorization_2', - 'format' => 'raw', - 'value' => function ($model) { - $general2 = CytoGeneralCategorization2::find()->where(['in', 'id', unserialize($model->general_categorization_2)])->all(); - - $rt3 = '
    '; - foreach ($general2 as $gc2) { - $rt3 .= '
  • ' . '(' . $gc2->code . ') ' . $gc2->name . '
  • '; - } - $rt3 .= '
'; - - return $rt3; - } - ], - 'adequacy_other', - 'categorization_other', - 'is_no_comment', - 'suggestion', - [ - 'attribute' => 'user_id', - 'format' => 'raw', - 'value' => function ($model) { - return $model->user->report_name; - } - ], - ], - ]) ?> -
-
-
-
-
- + +
+
+ +
+
+
+ $cytoPapDiagnosisLog, + 'attributes' => [ + [ + 'attribute' => 'specimen_adequacy_1', + 'value' => function ($model) { + $adequacies1 = CytoSpecimenAdequacy1::find() + ->where(['type' => 'pap']) + ->andWhere(['<>', 'id', 2]) + ->all(); + $adequacyMap1 = []; + foreach ($adequacies1 as $adequacy1) { + $adequacyMap1[$adequacy1->id] = '(' . $adequacy1->code . ') ' . $adequacy1->name; + } + + return isset($adequacyMap1[$model->specimen_adequacy_1]) ? $adequacyMap1[$model->specimen_adequacy_1] : ''; + } + ], + [ + 'attribute' => 'general_categorization_1', + 'value' => function ($model) { + $general1 = CytoGeneralCategorization1::find() + ->orderBy(['code' => SORT_ASC])->all(); + + $generalMap1 = []; + foreach ($general1 as $categorization1) { + $generalMap1[$categorization1->id] = '(' . $categorization1->code . ') ' . $categorization1->name; + } + + return isset($generalMap1[$model->general_categorization_1]) ? $generalMap1[$model->general_categorization_1] : ''; + } + ], + [ + 'attribute' => 'specimen_adequacy_2', + 'value' => function ($model) { + $adequacies2 = CytoSpecimenAdequacy2::find()->orderBy(['code' => SORT_ASC])->all(); + + $adequacyMap2 = []; + foreach ($adequacies2 as $adequacy2) { + $adequacyMap2[$adequacy2->id] = '(' . $adequacy2->code . ') ' . $adequacy2->name; + } + + return isset($adequacyMap2[$model->specimen_adequacy_2]) ? $adequacyMap2[$model->specimen_adequacy_2] : ''; + } + ], + [ + 'attribute' => 'specimen_adequacy_3', + 'format' => 'raw', + 'value' => function ($model) { + $adequacies3 = CytoSpecimenAdequacy3::find()->where(['in', 'id', unserialize($model->specimen_adequacy_3)])->all(); + + $rt3 = '
    '; + foreach ($adequacies3 as $ad3) { + $rt3 .= '
  • ' . '(' . $ad3->code . ') ' . $ad3->name . '
  • '; + } + $rt3 .= '
'; + + return $rt3; + } + ], + [ + 'attribute' => 'general_categorization_2', + 'format' => 'raw', + 'value' => function ($model) { + $general2 = CytoGeneralCategorization2::find()->where(['in', 'id', unserialize($model->general_categorization_2)])->all(); + + $rt3 = '
    '; + foreach ($general2 as $gc2) { + $rt3 .= '
  • ' . '(' . $gc2->code . ') ' . $gc2->name . '
  • '; + } + $rt3 .= '
'; + + return $rt3; + } + ], + 'adequacy_other', + 'categorization_other', + 'is_no_comment', + 'suggestion', + [ + 'attribute' => 'user_id', + 'format' => 'raw', + 'value' => function ($model) { + return $model->user->report_name; + } + ], + ], + ]) ?> +
+
+
-
\ No newline at end of file +
+ \ No newline at end of file diff --git a/frontend/modules/cyto/controllers/NonGynController.php b/frontend/modules/cyto/controllers/NonGynController.php index 126959a9..962444ac 100755 --- a/frontend/modules/cyto/controllers/NonGynController.php +++ b/frontend/modules/cyto/controllers/NonGynController.php @@ -804,6 +804,8 @@ class NonGynController extends \yii\web\Controller if ($case_non_gyn->save() && $model->save()) { + + Yii::$app->session->setFlash('success', 'บันทึกข้อมูลและส่งให้พยาธิแพทย์ เรียบร้อยแล้ว'); return $this->redirect(['/cyto/non-gyn/non-gyn-new']); } diff --git a/frontend/modules/cyto/controllers/PapController.php b/frontend/modules/cyto/controllers/PapController.php index 8a3874e1..4f32d8ed 100755 --- a/frontend/modules/cyto/controllers/PapController.php +++ b/frontend/modules/cyto/controllers/PapController.php @@ -552,6 +552,27 @@ class PapController extends \yii\web\Controller if ($case_pap->save() && $model->save()) { + $log = new CytoPapDiagnosisLog([ + 'id_case' => $model->id_case, + 'user_id' => Yii::$app->user->getId(), + 'report_type' => $model->report_type, + 'specimen_adequacy' => $model->specimen_adequacy, + 'specimen_adequacy_1' => $model->specimen_adequacy_1, + 'specimen_adequacy_2' => $model->specimen_adequacy_2, + 'specimen_adequacy_3' => $model->specimen_adequacy_3, + 'specimen_adequacy_4' => $model->specimen_adequacy_4, + 'adequacy_other' => $model->adequacy_other, + 'general_categorization' => $model->general_categorization, + 'general_categorization_1' => $model->general_categorization_1, + 'general_categorization_2' => $model->general_categorization_2, + 'categorization_other' => $model->categorization_other, + 'suggestion_list' => $model->suggestion_list, + 'suggestion' => $model->suggestion, + 'approve_at' => date('Y-m-d H:i:s'), + ]); + if ($log->save()) { + } + Yii::$app->session->setFlash('success', 'บันทึกข้อมูลและส่งให้พยาธิแพทย์ เรียบร้อยแล้ว'); return $this->redirect(['/cyto/pap/pap-new']); } diff --git a/frontend/modules/pathologist/views/do/_cyto_screener.php b/frontend/modules/pathologist/views/do/_cyto_screener.php new file mode 100644 index 00000000..bbd36e5c --- /dev/null +++ b/frontend/modules/pathologist/views/do/_cyto_screener.php @@ -0,0 +1,151 @@ +where([ + 'id_case' => $case_pap->id_case, + ]) + ->one(); // ใช้ one() เพื่อดึงรายการเดียว +?> + + +
+
+ +
+
+
+ $cytoPapDiagnosisLog, + 'attributes' => [ + [ + 'attribute' => 'specimen_adequacy_1', + 'value' => function ($model) { + $adequacies1 = CytoSpecimenAdequacy1::find() + ->where(['type' => 'pap']) + ->andWhere(['<>', 'id', 2]) + ->all(); + + $adequacyMap1 = []; + foreach ($adequacies1 as $adequacy1) { + $adequacyMap1[$adequacy1->id] = $adequacy1->name; + } + + return isset($adequacyMap1[$model->specimen_adequacy_1]) ? $adequacyMap1[$model->specimen_adequacy_1] : ''; + } + ], + [ + 'attribute' => 'general_categorization_1', + 'value' => function ($model) { + $general1 = CytoGeneralCategorization1::find() + ->orderBy(['code' => SORT_ASC])->all(); + + $generalMap1 = []; + foreach ($general1 as $categorization1) { + $generalMap1[$categorization1->id] = $categorization1->name; + } + + return isset($generalMap1[$model->general_categorization_1]) ? $generalMap1[$model->general_categorization_1] : ''; + } + ], + /*[ + 'attribute' => 'specimen_adequacy_4', + 'value' => function ($model) { + $adequacies2 = CytoSpecimenAdequacy2::find()->orderBy(['code' => SORT_ASC])->all(); + + $adequacyMap2 = []; + foreach ($adequacies2 as $adequacy2) { + $adequacyMap2[$adequacy2->id] = $adequacy2->name; + } + + return isset($adequacyMap2[$model->specimen_adequacy_4]) ? $adequacyMap2[$model->specimen_adequacy_4] : ''; + } + ],*/ + [ + 'attribute' => 'specimen_adequacy_4', + 'format' => 'raw', + 'value' => function ($model) { + $adequacies3 = CytoSpecimenAdequacy2::find()->where(['in', 'id', unserialize($model->specimen_adequacy_4)])->all(); + + $rt3 = '
    '; + foreach ($adequacies3 as $ad3) { + $rt3 .= '
  • ' . $ad3->name . '
  • '; + } + $rt3 .= '
'; + + return $rt3; + } + ], + [ + 'attribute' => 'specimen_adequacy_3', + 'format' => 'raw', + 'value' => function ($model) { + $adequacies3 = CytoSpecimenAdequacy3::find()->where(['in', 'id', unserialize($model->specimen_adequacy_3)])->all(); + + $rt3 = '
    '; + foreach ($adequacies3 as $ad3) { + $rt3 .= '
  • ' . $ad3->name . '
  • '; + } + $rt3 .= '
'; + + return $rt3; + } + ], + [ + 'attribute' => 'general_categorization_2', + 'format' => 'raw', + 'value' => function ($model) { + $general2 = CytoGeneralCategorization2::find()->where(['in', 'id', unserialize($model->general_categorization_2)])->all(); + + $rt3 = '
    '; + foreach ($general2 as $gc2) { + $rt3 .= '
  • ' . $gc2->name . '
  • '; + } + $rt3 .= '
'; + + return $rt3; + } + ], + 'adequacy_other', + 'categorization_other', + 'is_no_comment', + 'suggestion', + [ + 'attribute' => 'user_id', + 'format' => 'raw', + 'value' => function ($model) { + return $model->user->report_name; + } + ], + ], + ]) ?> +
+
+
+
+
+ \ No newline at end of file diff --git a/frontend/modules/pathologist/views/do/pap-final.php b/frontend/modules/pathologist/views/do/pap-final.php index d8f5e04f..1c0d3d56 100755 --- a/frontend/modules/pathologist/views/do/pap-final.php +++ b/frontend/modules/pathologist/views/do/pap-final.php @@ -38,7 +38,9 @@ $this->params['breadcrumbs'][] = $this->title; field($case_pap, 'id_case')->label(false)->hiddenInput() ?> -
+render('_cyto_screener', ['case_pap' => $case_pap]) ?> + +
From 4bae328cb4bb5df268436e4a034fbcc685691222 Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 02:19:32 +0700 Subject: [PATCH 07/13] fix non gyn log --- common/models/CytoNonGynDiagnosisLog.php | 76 +++++++++++++++++++ .../cyto/controllers/NonGynController.php | 14 +++- .../views/do/_cyto_non_gyn_screener.php | 76 +++++++++++++++++++ .../pathologist/views/do/_cyto_screener.php | 1 + .../pathologist/views/do/non-gyn-final.php | 1 + 5 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 common/models/CytoNonGynDiagnosisLog.php create mode 100644 frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php diff --git a/common/models/CytoNonGynDiagnosisLog.php b/common/models/CytoNonGynDiagnosisLog.php new file mode 100644 index 00000000..6620c510 --- /dev/null +++ b/common/models/CytoNonGynDiagnosisLog.php @@ -0,0 +1,76 @@ + 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'id_case' => 'Id Case', + 'report_type' => 'Report Type', + 'specimen_adequacy' => 'Specimen Adequacy', + 'gross_description' => 'Cytologic Findings', + 'diagnosis' => 'Cytologic Diagnosis', + 'comment' => 'Note', + 'user_id' => 'User ID', + 'approve_at' => 'Approve At', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getUser() + { + return $this->hasOne(User::class, ['id' => 'user_id']); + } +} \ No newline at end of file diff --git a/frontend/modules/cyto/controllers/NonGynController.php b/frontend/modules/cyto/controllers/NonGynController.php index 962444ac..6946f0cd 100755 --- a/frontend/modules/cyto/controllers/NonGynController.php +++ b/frontend/modules/cyto/controllers/NonGynController.php @@ -10,6 +10,7 @@ use common\models\CasePap; use common\models\Patient; use common\models\CaseNonGyn; use common\models\CytoNonGynDiagnosis; +use common\models\CytoNonGynDiagnosisLog; use common\models\IdCaseForm; use common\models\CytoOperate; use common\models\CytoPapDiagnosis; @@ -803,7 +804,18 @@ class NonGynController extends \yii\web\Controller if ($case_non_gyn->save() && $model->save()) { - + $log = new CytoNonGynDiagnosisLog([ + 'id_case' => $model->id_case, + 'user_id' => Yii::$app->user->getId(), + 'report_type' => $model->report_type, + 'specimen_adequacy' => $model->specimen_adequacy_1, + 'gross_description' => $model->gross_description, + 'diagnosis' => $model->diagnosis, + 'comment' => $model->comment, + 'approve_at' => date('Y-m-d H:i:s'), + ]); + if ($log->save()) { + } Yii::$app->session->setFlash('success', 'บันทึกข้อมูลและส่งให้พยาธิแพทย์ เรียบร้อยแล้ว'); diff --git a/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php b/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php new file mode 100644 index 00000000..4818938e --- /dev/null +++ b/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php @@ -0,0 +1,76 @@ +where([ + 'id_case' => $case_pap->id_case, + ]) + ->one(); // ใช้ one() เพื่อดึงรายการเดียว +?> + + +
+
+ +
+
+
+ $cytoNonGynDiagnosisLog, + 'attributes' => [ + [ + 'attribute' => 'specimen_adequacy', + 'value' => function ($model) { + $adequacies1 = CytoSpecimenAdequacy1::find() + ->where(['type' => 'non_gyn']) + ->andWhere(['<>', 'id', 2]) + ->all(); + + $adequacyMap1 = []; + foreach ($adequacies1 as $adequacy1) { + $adequacyMap1[$adequacy1->id] = $adequacy1->name; + } + + return isset($adequacyMap1[$model->specimen_adequacy]) ? $adequacyMap1[$model->specimen_adequacy] : ''; + } + ], + 'gross_description:html', + 'diagnosis:html', + 'comment:html', + [ + 'attribute' => 'user_id', + 'label' => 'Cytotech', + 'format' => 'raw', + 'value' => function ($model) { + return $model->user->report_name; + } + ], + ], + ]) ?> +
+
+
+
+
+ \ No newline at end of file diff --git a/frontend/modules/pathologist/views/do/_cyto_screener.php b/frontend/modules/pathologist/views/do/_cyto_screener.php index bbd36e5c..cd68076e 100644 --- a/frontend/modules/pathologist/views/do/_cyto_screener.php +++ b/frontend/modules/pathologist/views/do/_cyto_screener.php @@ -136,6 +136,7 @@ $cytoPapDiagnosisLog = CytoPapDiagnosisLog::find() 'suggestion', [ 'attribute' => 'user_id', + 'label' => 'Cytotech', 'format' => 'raw', 'value' => function ($model) { return $model->user->report_name; diff --git a/frontend/modules/pathologist/views/do/non-gyn-final.php b/frontend/modules/pathologist/views/do/non-gyn-final.php index 36601fe4..492551d1 100755 --- a/frontend/modules/pathologist/views/do/non-gyn-final.php +++ b/frontend/modules/pathologist/views/do/non-gyn-final.php @@ -42,6 +42,7 @@ $this->params['breadcrumbs'][] = $this->title; errorSummary($case_non_gyn) ?> +render('_cyto_non_gyn_screener', ['case_pap' => $case_non_gyn]) ?>
From 0c913cc229df56049cde315770e7fc9116a2cfd5 Mon Sep 17 00:00:00 2001 From: mrkcp Date: Wed, 2 Apr 2025 08:49:13 +0700 Subject: [PATCH 08/13] update case --- .../register/controllers/CaseController.php | 40 +- .../views/case/_form_surgical-raw-3.php | 901 +++++++++++++++++ .../views/case/_form_surgical-raw.php | 851 ++++++++++++++++ .../register/views/case/_form_surgical.php | 59 +- .../views/case/_old_form_surgical2.php | 913 ++++++++++++++++++ .../surgical/controllers/PrintController.php | 2 +- 6 files changed, 2734 insertions(+), 32 deletions(-) create mode 100644 frontend/modules/register/views/case/_form_surgical-raw-3.php create mode 100644 frontend/modules/register/views/case/_form_surgical-raw.php create mode 100644 frontend/modules/register/views/case/_old_form_surgical2.php diff --git a/frontend/modules/register/controllers/CaseController.php b/frontend/modules/register/controllers/CaseController.php index a0fde4ef..1d43df55 100755 --- a/frontend/modules/register/controllers/CaseController.php +++ b/frontend/modules/register/controllers/CaseController.php @@ -11,6 +11,7 @@ use yii\base\Exception; use common\models\CaseHpv; use common\models\CasePap; use common\models\Patient; +use yii\httpclient\Client; use common\models\CaseDish; use common\models\CaseFish; use common\models\CaseFlow; @@ -42,8 +43,7 @@ use common\models\MolecularDiagnosis; use common\models\CytoNonGynDiagnosis; use common\models\FinanceServiceCharge; use common\models\ConstLookupAddressName; -use frontend\modules\immuno\models\CaseExternalSearch; -use yii\httpclient\Client; +use frontend\modules\register\models\CaseExternalSearch; class CaseController extends \yii\web\Controller @@ -3003,6 +3003,7 @@ class CaseController extends \yii\web\Controller return isset($subdistrict) ? $subdistrict->zipcode : ''; } + /* public function actionSearchPatient($hn) { Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; @@ -3033,5 +3034,40 @@ class CaseController extends \yii\web\Controller 'message' => 'ไม่พบข้อมูลผู้ป่วย หรือ API มีปัญหา' ]; } + }*/ + + public function actionSearchPatient($hn) + { + Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; + + /*$client = new Client(); + $response = $client->createRequest() + ->setMethod('GET') + ->setUrl('https://api.hospital.com/patients/search') // เปลี่ยน URL ตรงนี้ให้ตรงกับระบบจริง + ->setData(['hn' => $hn]) + ->send(); + + if ($response->isOk && isset($response->data['patient'])) { + $data = $response->data['patient'];*/ + + // หากต้องการแปลงข้อมูลเป็น model + // $model = new Patient(); + // $model->load(['Patient' => $data]); + + $data = [ + 'hn' => '123456', + ]; + // หรือส่งตรงเลย + return [ + 'success' => true, + 'html' => $this->renderAjax('_patient_detail', ['model' => (object) $data]), + 'data' => $data + ]; + /*} else { + return [ + 'success' => false, + 'message' => 'ไม่พบข้อมูลผู้ป่วย หรือ API มีปัญหา' + ]; + }*/ } } diff --git a/frontend/modules/register/views/case/_form_surgical-raw-3.php b/frontend/modules/register/views/case/_form_surgical-raw-3.php new file mode 100644 index 00000000..b8c8cba2 --- /dev/null +++ b/frontend/modules/register/views/case/_form_surgical-raw-3.php @@ -0,0 +1,901 @@ + + +
+
+
title ?>
+
+
+ true, + 'enableClientValidation' => false, + 'validateOnChange' => true, + 'validateOnSubmit' => true, + 'validateOnBlur' => false, + ]) ?> + errorSummary([$model]) ?> +
+
+
+
+
+ field($model, 'id_case')->widget(MaskedInput::class, [ + 'mask' => Yii::$app->params['idCaseMask'], + 'options' => [ + 'class' => 'form-control', + 'style' => 'font-weight: bold', + 'disabled' => true, + ] + ]) ?> +
+
+
+ field($model, 'his_ln')->textInput(['readonly' => true]) ?> +
+
+
+ field($model, 'hospital_id')->widget(Select2::classname(), [ + 'data' => ArrayHelper::map(ConstHospital::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'options' => [ + 'placeholder' => 'เลือกหน่วยงาน ....', + ], + 'theme' => Select2::THEME_BOOTSTRAP, + //'initValueText' => (!$model->isNewRecord ? ConstHospital::findOne($model->hospital_id)->name : ''), + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + /*'ajax' => [ + 'url' => Url::to(['/site/hospital-list']), + 'dataType' => 'json',1 + 'data' => new JsExpression('function(params) { return {q:params.term}; }') + ],*/ + ], + ]) ?> +
+
+
+ +
+
+ isNewRecord) { ?> + + +
+
+ +
+
ข้อมูลผู้ป่วย (Patient)
+
+ isNewRecord) { ?> + field($model, 'patient_id')->label(false)->hiddenInput() ?> + +
+
+
+ field($model, 'title_id')->widget(Select2::classname(), [ + 'data' => ArrayHelper::map(PatientTitle::find()->all(), 'id', 'name'), //->where('id > 1') + 'options' => [ + 'placeholder' => 'เลือกคำนำหน้า ....', + ], + 'theme' => Select2::THEME_BOOTSTRAP, + //'initValueText' => (!$model->isNewRecord ? ConstHospital::findOne($model->hospital_id)->name : ''), + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + /*'ajax' => [ + 'url' => Url::to(['/site/hospital-list']), + 'dataType' => 'json',1 + 'data' => new JsExpression('function(params) { return {q:params.term}; }') + ],*/ + ], + ]) ?> +
+
+ field($model, 'given_name')->textInput() ?> +
+
+ field($model, 'surname')->textInput() ?> +
+
+ field($model, 'gender')->dropDownList(['U' => '', 'ช' => 'ชาย', 'ญ' => 'หญิง']) ?> +
+
+ 'btn btn-info', 'data-toggle' => 'modal', 'data-target' => '#patientModal']) ?> + + 'patientModal', + 'title' => '

ค้นหาผู้ป่วย

', + ]); + + ?> + +
+ + +
+ +
+ 'btn btn-primary', 'id' => 'btn-search-patient']) ?> +
+ +
+ + + + registerJs(<<' + response.message + '
'); + } + }); +}); + +function selectPatient(data) { + $('#" . Html::getInputId($model, 'patient_id') . "').val(data.id); + $('#" . Html::getInputId($model, 'title_id') . "').val(data.title_id); + $('#" . Html::getInputId($model, 'gender') . "').val(data.gender); + $('#" . Html::getInputId($model, 'race') . "').val(data.race); + $('#" . Html::getInputId($model, 'id_card') . "').val(data.id_card); + $('#" . Html::getInputId($model, 'birthdate') . "').val(data.birthdate); + $('#" . Html::getInputId($model, 'age') . "').val(data.age); + $('#" . Html::getInputId($model, 'age_unit') . "').val(data.age_unit); + $('#" . Html::getInputId($model, 'h_n') . "').val(data.h_n); + + $('#patientModal').modal('hide'); +} +JS); + ?> +
+
+
+
+
+ field($model, 'id_card')->widget(MaskedInput::class, [ + 'mask' => '9-9999-99999-99-9' + ]) ?> +
+
field($model, 'birthdate')->widget(MaskedInput::class, [ + 'mask' => '99/99/9999', + 'options' => [ + 'id' => 'patient-birthdate', + ], + ]) + ?> +
+
+ field($model, 'nation')->dropDownList(ArrayHelper::map(ConstNationality::find()->all(), 'id', 'name'), ['prompt' => 'Select Nationalily...']) ?> +
+
+ field($model, 'race')->dropDownList(ArrayHelper::map(ConstRace::find()->all(), 'id', 'name'), ['prompt' => 'Select Race...']) ?> +
+
field($model, 'age')->textInput(['id' => 'patient-age']) ?> +
+
+ field($model, 'age_unit')->dropDownList(['ปี' => 'ปี', 'เดือน' => 'เดือน', 'วัน' => 'วัน'], ['id' => 'patient-age_unit']) ?> +
+
+
+
field($model, 'h_n')->textInput() ?>
+
+ field($model, 'a_n'); ?> +
+
+ field($model, 'v_n'); ?> +
+
+ field($model, 'rights_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstRights::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกสิทธิ์การรักษา....' + ], + ]) ?> +
+
+
+
+ field($model, 'ward_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstWard::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + /*'options' => [ + 'placeholder' => 'เลือกสิทธิ์การรักษา ....', + ],*/ + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกแผนก....' + ], + ]) ?> +
+ +
+ field($model, 'doctor_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + ConstDoctor::find()->orderBy(['fullname' => SORT_ASC])->all(), + 'id', + function ($model) { + return $model->fullname; + } + ), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกแพทย์เจ้าของคนไข้....' + ], + ]) ?> + + field($model, 'clinician')->textInput() + ?> +
+
+ +
+
ข้อมูลการส่งตรวจ (Case)
+
+
+
+ isNewRecord) { ?> +
+ field($model, 'pathologist_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(User::find()->where(['role' => 'pathologist', 'status' => 10])->orderBy(['realname' => SORT_ASC])->all(), 'id', 'realname'), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือก Pathologist...' + ] + ]) ?> +
+ +
+ field($model, 'note_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + User::find() + ->where(['!=', 'role', 'hospital']) + ->andWhere(['status' => User::STATUS_ACTIVE]) + ->orderBy(['realname' => SORT_DESC]) + ->all(), + 'id', + 'realname' + ), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'placeholder' => 'กรุณาเลือกผู้จด....', + 'allowClear' => true, // Optional: allows clearing of the selection + ], + ]) ?> +
+
+ field($model, 'cut_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(User::find()->where(['!=', 'role', 'hospital'])->andWhere(['status' => User::STATUS_ACTIVE])->orderBy(['realname' => SORT_DESC])->all(), 'id', 'realname'), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'placeholder' => 'กรุณาเลือกผู้ตัด....', + 'allowClear' => true, + ] + ]) ?> +
+
+ field($model, 'collected_at')->widget(DatePicker::class, [ + 'options' => ['placeholder' => 'เลือกวันที่เก็บสิ่งส่งตรวจ ...'], + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + //'todayBtn' => true, + ] + ]) + ?> +
+
+
+
+
+ field($model, 'receive_at')->widget(DatePicker::class, [ + 'options' => ['placeholder' => 'เลือกวันที่รับสิ่งส่งตรวจ ...'], + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + //'todayBtn' => true, + ] + ]) ?> +
+ + + + +
+ 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']], + ], + ] + ])*/ ?> +
+ +
+ 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(); + } + }); + ") ?> +
+ field($model, 'is_express')->checkbox() ?> +
+
isNewRecord && $model->is_express ? '' : 'style="display: none;"' ?>> + +
+ field($model, 'express_day')->dropDownList(['' => '', '3' => 'ผลด่วน 3 วัน', '5' => 'ผลด่วน 5 วัน', '7' => 'ผลด่วน 7 วัน']) ?> +
+
+ field($model, 'express_at')->widget(\kartik\date\DatePicker::class, [ + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + 'todayBtn' => true, + ] + ]) ?> +
+
+
+ + 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){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 3); + + // Display the new date + $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate)); + + //alert(formatDate(newDate)); + } + if(selectedValue == 5){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 5); + + // Display the new date + $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate)); + + //alert(formatDate(newDate)); + } + if(selectedValue == 7){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 7); + + // 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 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; new date + } + }); + "); ?> + + + + 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; + } + }); + "); + */ ?> +
+
+ field($model, 'is_molecular')->checkbox() ?> +
+
+ isNewRecord) { ?> +
+
รายการ Specimen
+
+
+
+ field($sc_surgical_container, 'items')->label(false)->widget(MultipleInput::class, [ + 'max' => 50, + 'id' => 'surgicalcontainer-items', + 'allowEmptyList' => true, + 'addButtonOptions' => ['class' => 'btn btn-primary'], + //'min' => 1, + 'addButtonPosition' => MultipleInput::POS_FOOTER, + 'attributeOptions' => [], + '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' => 'container_type', + 'title' => 'รายการ', + 'type' => MultipleInputColumn::TYPE_DROPDOWN, + 'value' => function ($data) { + return isset($data['container_type']) ? $data['container_type'] : null; + }, + 'items' => [ + 1 => 'ขวด', + 2 => 'ถุง', + 3 => 'Block', + 4 => 'Slide' + ], + 'enableError' => true, + 'options' => [ + 'class' => 'new_class', + 'prompt' => 'เลือกรายการ.....', + ] + ], + [ + 'name' => 'amount', + 'title' => 'จำนวน', + 'options' => ['class' => 'uppercase-input'], + //'enableError' => true, + 'value' => function ($data) { + return strtoupper(isset($data['amount'])) ? $data['amount'] : ''; + }, + ], + [ + 'name' => 'specimen_size', + 'title' => 'ขนาดชิ้นเนื้อ', + 'type' => MultipleInputColumn::TYPE_DROPDOWN, + 'value' => function ($data) { + return isset($data['specimen_size']) ? $data['specimen_size'] : null; + }, + 'items' => [ + 1 => 'smc(เนื้อเล็ก)', + 2 => 'smc(เนื้อกลาง)', + 3 => 'smc(เนื้อใหญ่)' + ], + 'enableError' => true, + 'options' => [ + 'class' => 'new_class', + 'prompt' => 'เลือกขนาดชิ้นเนื้อ', + ] + ], + [ + 'name' => 'remark', + 'title' => 'remark', + 'enableError' => true, + ], + ] + ]) ?> +
+
+ + + registerJs(" + $('.uppercase-input').on('keyup', function() { + var input = $(this); + var value = input.val().toUpperCase(); + input.val(value); + }); + "); ?> + + + registerJs(" + $('#surgicalcontainer-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){ + //console.log(item);#surgicalcontainer-items-0-from_id + var id_case = item.find('.list-cell__block_no').find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id_case\"]').val(); + var id = item.find('.list-cell__block_no').find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id\"]').val(); + //alert(id_case + from_id); + $.post(\"" . Url::to(['/register/case-update/surgical-container-delete']) . "\", + { + id_case: id_case, + hs_id: hs_id + }, + ); + }); + + ") ?> + + registerJs( + "$('#surgicalcontainer-items').on('afterInit', function() { + // Initialization event if needed + }).on('beforeAddRow', function(e) { + // Before adding a row event if needed + }).on('afterAddRow', function(e) { + // After adding a row event if needed + }).on('beforeDeleteRow', function(e, item) { + return confirm('คุณแน่ใจนะว่าต้องการลบ?'); // Confirm deletion + }).on('afterDeleteRow', function(e, item) { + var id_case = item.find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id_case\"]').val(); + var id = item.find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id\"]').val(); + + // Make sure id_case and id are not empty or undefined before sending the request + if (id_case && id) { + $.post(\"" . Url::to(['/register/case-update/surgical-container-delete']) . "\", { + id_case: id_case, + id: id + }).done(function(response) { + if (response.status === 'success') { + alert('ลบรายการเรียบร้อยแล้ว'); + } else { + alert('Error: ' + response.message); + } + }).fail(function() { + alert('An error occurred while trying to delete the item.'); + }); + } else { + alert('Invalid id_case or id.'); + } + }); + " + ) ?> + +
+
+ field($model, 'review_remark')->textarea(['rows' => 5, 'cols' => 50]) ?> +
+
+ + isNewRecord) { ?> +
+
+
+
+ รายการ Test Order
+
+ false, + 'tableOptions' => ['class' => 'table table-striped truncate m-0'], + 'dataProvider' => new ActiveDataProvider([ + 'query' => FinanceServiceCharge::find() + ->where(['id_case' => $model->id_case]) + ]), + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + 'charge.code', + 'charge.name', + ], + 'layout' => "
\n{items}\n
{pager}
", + ]) ?> +
+
+ + +
+
ใบส่งตรวจ + (Request File) +
+ +
+ field($model, 'files[]')->label(false)->fileInput(['multiple' => true])->label(false) ?> +
+
    + getFiles() as $file => $val) { + ?> +
  • '_blank']); ?> + ', [ + 'file-del', + 'file' => $val, + 'id' => $model->id, + 'id_case' => $model->id_case + ], [ + 'class' => 'btn btn-sm btn-danger', + 'data-confirm' => 'ต้องการลบ?' + ]); + ?> +
  • + +
+
+ +
+
บันทึกภาพ Specimen + Container +
+ +
+ field($model, 'specimen_container_img[]')->fileInput(['multiple' => true])->label(false) ?> +
+ specimen_container_img)) { ?> + +
+
Specimen Container + List
+
+
getSpecimenDelImgs() ?>
+ + + +
+
+
Outsource Data
+ + field($model, 'is_outlab')->checkbox() ?> +
isNewRecord && $model->is_outlab ? '' : 'style="display: none;"' ?>> +
+
+ field($model, 'outlab_report[]')->fileInput(['multiple' => true]) ?> +
+
+
+
+ field($model, 'remark_outlab')->textarea(['spellcheck' => true])->widget(CKEditor::class, [ + 'preset' => 'custom', + 'clientOptions' => [ + 'height' => 200, + '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']], + ], + ] + ]) ?> +
+
+
+ registerJs(" + $(\"input[name='" . Html::getInputName($model, 'is_outlab') . "']\").change(function() { + if(this.checked == true){ + $('.outlab_report').show(); + }else{ + $('.outlab_report').hide(); + } + }); + ") ?> + +
    + + getReport() as $file => $val) { + if (!empty($val)) { + ?> +
  • '_blank']); ?> + ', [ + 'report-del', + 'file' => $val, + 'id' => $model->id, + 'id_case' => $model->id_case + ], [ + 'class' => 'btn btn-sm btn-danger', + 'data-confirm' => 'ต้องการลบ?' + ]); + ?> +
  • + +
+ +
+
+ บันทึกข้อมูล', ['class' => 'btn btn-success']) ?> +
+
+ + +
+ + +
+
+ + + + + + +render('_js') ?> \ No newline at end of file diff --git a/frontend/modules/register/views/case/_form_surgical-raw.php b/frontend/modules/register/views/case/_form_surgical-raw.php new file mode 100644 index 00000000..c1e762ab --- /dev/null +++ b/frontend/modules/register/views/case/_form_surgical-raw.php @@ -0,0 +1,851 @@ + + +
+
+
title ?>
+
+
+ true, + 'enableClientValidation' => false, + 'validateOnChange' => true, + 'validateOnSubmit' => true, + 'validateOnBlur' => false, + ]) ?> + errorSummary([$model]) ?> +
+
+
+
+
+ field($model, 'id_case')->widget(MaskedInput::class, [ + 'mask' => Yii::$app->params['idCaseMask'], + 'options' => [ + 'class' => 'form-control', + 'style' => 'font-weight: bold', + 'disabled' => true, + ] + ]) ?> +
+
+
+ field($model, 'his_ln')->textInput(['readonly' => true]) ?> +
+
+
+ field($model, 'hospital_id')->widget(Select2::classname(), [ + 'data' => ArrayHelper::map(ConstHospital::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'options' => [ + 'placeholder' => 'เลือกหน่วยงาน ....', + ], + 'theme' => Select2::THEME_BOOTSTRAP, + //'initValueText' => (!$model->isNewRecord ? ConstHospital::findOne($model->hospital_id)->name : ''), + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + /*'ajax' => [ + 'url' => Url::to(['/site/hospital-list']), + 'dataType' => 'json',1 + 'data' => new JsExpression('function(params) { return {q:params.term}; }') + ],*/ + ], + ]) ?> +
+
+
+ +
+
+ isNewRecord) { ?> + + +
+
+ +
+
ข้อมูลผู้ป่วย (Patient)
+
+ isNewRecord) { ?> + field($model, 'patient_id')->label(false)->hiddenInput() ?> + +
+
+
+ field($model, 'title_id')->widget(Select2::classname(), [ + 'data' => ArrayHelper::map(PatientTitle::find()->all(), 'id', 'name'), //->where('id > 1') + 'options' => [ + 'placeholder' => 'เลือกคำนำหน้า ....', + ], + 'theme' => Select2::THEME_BOOTSTRAP, + //'initValueText' => (!$model->isNewRecord ? ConstHospital::findOne($model->hospital_id)->name : ''), + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + /*'ajax' => [ + 'url' => Url::to(['/site/hospital-list']), + 'dataType' => 'json',1 + 'data' => new JsExpression('function(params) { return {q:params.term}; }') + ],*/ + ], + ]) ?> +
+
+ field($model, 'given_name')->textInput() ?> +
+
+ field($model, 'surname')->textInput() ?> +
+
+ field($model, 'gender')->dropDownList(['U' => '', 'ช' => 'ชาย', 'ญ' => 'หญิง']) ?> +
+
+ +
+
+
+
+
+ field($model, 'id_card')->widget(MaskedInput::class, [ + 'mask' => '9-9999-99999-99-9' + ]) ?> +
+
field($model, 'birthdate')->widget(MaskedInput::class, [ + 'mask' => '99/99/9999', + 'options' => [ + 'id' => 'patient-birthdate', + ], + ]) + ?> +
+
+ field($model, 'nation')->dropDownList(ArrayHelper::map(ConstNationality::find()->all(), 'id', 'name'), ['prompt' => 'Select Nationalily...']) ?> +
+
+ field($model, 'race')->dropDownList(ArrayHelper::map(ConstRace::find()->all(), 'id', 'name'), ['prompt' => 'Select Race...']) ?> +
+
field($model, 'age')->textInput(['id' => 'patient-age']) ?> +
+
+ field($model, 'age_unit')->dropDownList(['ปี' => 'ปี', 'เดือน' => 'เดือน', 'วัน' => 'วัน'], ['id' => 'patient-age_unit']) ?> +
+
+
+
field($model, 'h_n')->textInput() ?>
+
+ field($model, 'a_n'); ?> +
+
+ field($model, 'v_n'); ?> +
+
+ field($model, 'rights_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstRights::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกสิทธิ์การรักษา....' + ], + ]) ?> +
+
+
+
+ field($model, 'ward_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstWard::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + /*'options' => [ + 'placeholder' => 'เลือกสิทธิ์การรักษา ....', + ],*/ + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกแผนก....' + ], + ]) ?> +
+ +
+ field($model, 'doctor_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + ConstDoctor::find()->orderBy(['fullname' => SORT_ASC])->all(), + 'id', + function ($model) { + return $model->fullname; + } + ), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกแพทย์เจ้าของคนไข้....' + ], + ]) ?> + + field($model, 'clinician')->textInput() + ?> +
+
+ +
+
ข้อมูลการส่งตรวจ (Case)
+
+
+
+ isNewRecord) { ?> +
+ field($model, 'pathologist_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(User::find()->where(['role' => 'pathologist', 'status' => 10])->orderBy(['realname' => SORT_ASC])->all(), 'id', 'realname'), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือก Pathologist...' + ] + ]) ?> +
+ +
+ field($model, 'note_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + User::find() + ->where(['!=', 'role', 'hospital']) + ->andWhere(['status' => User::STATUS_ACTIVE]) + ->orderBy(['realname' => SORT_DESC]) + ->all(), + 'id', + 'realname' + ), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'placeholder' => 'กรุณาเลือกผู้จด....', + 'allowClear' => true, // Optional: allows clearing of the selection + ], + ]) ?> +
+
+ field($model, 'cut_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(User::find()->where(['!=', 'role', 'hospital'])->andWhere(['status' => User::STATUS_ACTIVE])->orderBy(['realname' => SORT_DESC])->all(), 'id', 'realname'), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'placeholder' => 'กรุณาเลือกผู้ตัด....', + 'allowClear' => true, + ] + ]) ?> +
+
+ field($model, 'collected_at')->widget(DatePicker::class, [ + 'options' => ['placeholder' => 'เลือกวันที่เก็บสิ่งส่งตรวจ ...'], + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + //'todayBtn' => true, + ] + ]) + ?> +
+
+
+
+
+ field($model, 'receive_at')->widget(DatePicker::class, [ + 'options' => ['placeholder' => 'เลือกวันที่รับสิ่งส่งตรวจ ...'], + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + //'todayBtn' => true, + ] + ]) ?> +
+ + + + +
+ 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']], + ], + ] + ])*/ ?> +
+ +
+ 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(); + } + }); + ") ?> +
+ field($model, 'is_express')->checkbox() ?> +
+
isNewRecord && $model->is_express ? '' : 'style="display: none;"' ?>> + +
+ field($model, 'express_day')->dropDownList(['' => '', '3' => 'ผลด่วน 3 วัน', '5' => 'ผลด่วน 5 วัน', '7' => 'ผลด่วน 7 วัน']) ?> +
+
+ field($model, 'express_at')->widget(\kartik\date\DatePicker::class, [ + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + 'todayBtn' => true, + ] + ]) ?> +
+
+
+ + 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){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 3); + + // Display the new date + $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate)); + + //alert(formatDate(newDate)); + } + if(selectedValue == 5){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 5); + + // Display the new date + $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate)); + + //alert(formatDate(newDate)); + } + if(selectedValue == 7){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 7); + + // 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 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; new date + } + }); + "); ?> + + + + 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; + } + }); + "); + */ ?> +
+
+ field($model, 'is_molecular')->checkbox() ?> +
+
+ isNewRecord) { ?> +
+
รายการ Specimen
+
+
+
+ field($sc_surgical_container, 'items')->label(false)->widget(MultipleInput::class, [ + 'max' => 50, + 'id' => 'surgicalcontainer-items', + 'allowEmptyList' => true, + 'addButtonOptions' => ['class' => 'btn btn-primary'], + //'min' => 1, + 'addButtonPosition' => MultipleInput::POS_FOOTER, + 'attributeOptions' => [], + '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' => 'container_type', + 'title' => 'รายการ', + 'type' => MultipleInputColumn::TYPE_DROPDOWN, + 'value' => function ($data) { + return isset($data['container_type']) ? $data['container_type'] : null; + }, + 'items' => [ + 1 => 'ขวด', + 2 => 'ถุง', + 3 => 'Block', + 4 => 'Slide' + ], + 'enableError' => true, + 'options' => [ + 'class' => 'new_class', + 'prompt' => 'เลือกรายการ.....', + ] + ], + [ + 'name' => 'amount', + 'title' => 'จำนวน', + 'options' => ['class' => 'uppercase-input'], + //'enableError' => true, + 'value' => function ($data) { + return strtoupper(isset($data['amount'])) ? $data['amount'] : ''; + }, + ], + [ + 'name' => 'specimen_size', + 'title' => 'ขนาดชิ้นเนื้อ', + 'type' => MultipleInputColumn::TYPE_DROPDOWN, + 'value' => function ($data) { + return isset($data['specimen_size']) ? $data['specimen_size'] : null; + }, + 'items' => [ + 1 => 'smc(เนื้อเล็ก)', + 2 => 'smc(เนื้อกลาง)', + 3 => 'smc(เนื้อใหญ่)' + ], + 'enableError' => true, + 'options' => [ + 'class' => 'new_class', + 'prompt' => 'เลือกขนาดชิ้นเนื้อ', + ] + ], + [ + 'name' => 'remark', + 'title' => 'remark', + 'enableError' => true, + ], + ] + ]) ?> +
+
+ + + registerJs(" + $('.uppercase-input').on('keyup', function() { + var input = $(this); + var value = input.val().toUpperCase(); + input.val(value); + }); + "); ?> + + + registerJs(" + $('#surgicalcontainer-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){ + //console.log(item);#surgicalcontainer-items-0-from_id + var id_case = item.find('.list-cell__block_no').find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id_case\"]').val(); + var id = item.find('.list-cell__block_no').find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id\"]').val(); + //alert(id_case + from_id); + $.post(\"" . Url::to(['/register/case-update/surgical-container-delete']) . "\", + { + id_case: id_case, + hs_id: hs_id + }, + ); + }); + + ") ?> + + registerJs( + "$('#surgicalcontainer-items').on('afterInit', function() { + // Initialization event if needed + }).on('beforeAddRow', function(e) { + // Before adding a row event if needed + }).on('afterAddRow', function(e) { + // After adding a row event if needed + }).on('beforeDeleteRow', function(e, item) { + return confirm('คุณแน่ใจนะว่าต้องการลบ?'); // Confirm deletion + }).on('afterDeleteRow', function(e, item) { + var id_case = item.find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id_case\"]').val(); + var id = item.find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id\"]').val(); + + // Make sure id_case and id are not empty or undefined before sending the request + if (id_case && id) { + $.post(\"" . Url::to(['/register/case-update/surgical-container-delete']) . "\", { + id_case: id_case, + id: id + }).done(function(response) { + if (response.status === 'success') { + alert('ลบรายการเรียบร้อยแล้ว'); + } else { + alert('Error: ' + response.message); + } + }).fail(function() { + alert('An error occurred while trying to delete the item.'); + }); + } else { + alert('Invalid id_case or id.'); + } + }); + " + ) ?> + +
+
+ field($model, 'review_remark')->textarea(['rows' => 5, 'cols' => 50]) ?> +
+
+ + isNewRecord) { ?> +
+
+
+
+ รายการ Test Order
+
+ false, + 'tableOptions' => ['class' => 'table table-striped truncate m-0'], + 'dataProvider' => new ActiveDataProvider([ + 'query' => FinanceServiceCharge::find() + ->where(['id_case' => $model->id_case]) + ]), + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + 'charge.code', + 'charge.name', + ], + 'layout' => "
\n{items}\n
{pager}
", + ]) ?> +
+
+ + +
+
ใบส่งตรวจ + (Request File) +
+ +
+ field($model, 'files[]')->label(false)->fileInput(['multiple' => true])->label(false) ?> +
+
    + getFiles() as $file => $val) { + ?> +
  • '_blank']); ?> + ', [ + 'file-del', + 'file' => $val, + 'id' => $model->id, + 'id_case' => $model->id_case + ], [ + 'class' => 'btn btn-sm btn-danger', + 'data-confirm' => 'ต้องการลบ?' + ]); + ?> +
  • + +
+
+ +
+
บันทึกภาพ Specimen + Container +
+ +
+ field($model, 'specimen_container_img[]')->fileInput(['multiple' => true])->label(false) ?> +
+ specimen_container_img)) { ?> + +
+
Specimen Container + List
+
+
getSpecimenDelImgs() ?>
+ + + +
+
+
Outsource Data
+ + field($model, 'is_outlab')->checkbox() ?> +
isNewRecord && $model->is_outlab ? '' : 'style="display: none;"' ?>> +
+
+ field($model, 'outlab_report[]')->fileInput(['multiple' => true]) ?> +
+
+
+
+ field($model, 'remark_outlab')->textarea(['spellcheck' => true])->widget(CKEditor::class, [ + 'preset' => 'custom', + 'clientOptions' => [ + 'height' => 200, + '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']], + ], + ] + ]) ?> +
+
+
+ registerJs(" + $(\"input[name='" . Html::getInputName($model, 'is_outlab') . "']\").change(function() { + if(this.checked == true){ + $('.outlab_report').show(); + }else{ + $('.outlab_report').hide(); + } + }); + ") ?> + +
    + + getReport() as $file => $val) { + if (!empty($val)) { + ?> +
  • '_blank']); ?> + ', [ + 'report-del', + 'file' => $val, + 'id' => $model->id, + 'id_case' => $model->id_case + ], [ + 'class' => 'btn btn-sm btn-danger', + 'data-confirm' => 'ต้องการลบ?' + ]); + ?> +
  • + +
+ +
+
+ บันทึกข้อมูล', ['class' => 'btn btn-success']) ?> +
+
+ + +
+ + +
+
+ + + + + + +render('_js') ?> \ No newline at end of file diff --git a/frontend/modules/register/views/case/_form_surgical.php b/frontend/modules/register/views/case/_form_surgical.php index 66066286..3088c7f3 100755 --- a/frontend/modules/register/views/case/_form_surgical.php +++ b/frontend/modules/register/views/case/_form_surgical.php @@ -1,10 +1,14 @@ @@ -151,38 +152,39 @@ use yii\helpers\Url; field($model, 'gender')->dropDownList(['U' => '', 'ช' => 'ชาย', 'ญ' => 'หญิง']) ?>
- 'btn btn-info', 'data-toggle' => 'modal', 'data-target' => '#patientModal']) ?> + 'btn btn-info', 'data-bs-toggle' => 'modal', 'data-bs-target' => '#patientModal']) ?> - 'patientModal', - 'header' => '

ค้นหาผู้ป่วย

', - ]); - - ?> - -
- - + -
- 'btn btn-primary', 'id' => 'btn-search-patient']) ?> -
- -
- - registerJs(<<registerJs(" $('#btn-search-patient').on('click', function() { let hn = $('#hn-input').val(); - $.get('".Url::to(['controller/search-patient'])."', { hn: hn }, function(response) { + $.get('" . Url::to(['case/search-patient']) . "', { hn: hn }, function(response) { if (response.success) { $('#patient-detail').html(response.html); } else { - $('#patient-detail').html('
' + response.message + '
'); + $('#patient-detail').html('
' + response.message + '
'); } }); }); @@ -199,8 +201,7 @@ function selectPatient(data) { $('#" . Html::getInputId($model, 'h_n') . "').val(data.h_n); $('#patientModal').modal('hide'); -} -JS); ?> +}") ?>
diff --git a/frontend/modules/register/views/case/_old_form_surgical2.php b/frontend/modules/register/views/case/_old_form_surgical2.php new file mode 100644 index 00000000..fac68c37 --- /dev/null +++ b/frontend/modules/register/views/case/_old_form_surgical2.php @@ -0,0 +1,913 @@ + + +
+
+
title ?>
+
+
+ true, + 'enableClientValidation' => false, + 'validateOnChange' => true, + 'validateOnSubmit' => true, + 'validateOnBlur' => false, + ]) ?> + errorSummary([$model]) ?> +
+
+
+
+
+ field($model, 'id_case')->widget(MaskedInput::class, [ + 'mask' => Yii::$app->params['idCaseMask'], + 'options' => [ + 'class' => 'form-control', + 'style' => 'font-weight: bold', + 'disabled' => true, + ] + ]) ?> +
+
+
+ field($model, 'his_ln')->textInput(['readonly' => true]) ?> +
+
+
+ field($model, 'hospital_id')->widget(Select2::classname(), [ + 'data' => ArrayHelper::map(ConstHospital::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'options' => [ + 'placeholder' => 'เลือกหน่วยงาน ....', + ], + 'theme' => Select2::THEME_BOOTSTRAP, + //'initValueText' => (!$model->isNewRecord ? ConstHospital::findOne($model->hospital_id)->name : ''), + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + /*'ajax' => [ + 'url' => Url::to(['/site/hospital-list']), + 'dataType' => 'json',1 + 'data' => new JsExpression('function(params) { return {q:params.term}; }') + ],*/ + ], + ]) ?> +
+
+
+ field($model, 'h_n')->textInput() ?> + ', 'javascript:void(0);', ['id' => 'check-patient', 'class' => 'btn btn-sm btn-success']) ?> + +
+ + registerJs(" + $('#check-patient').click(function(){ + var hn = $('#" . Html::getInputId($model, 'h_n') . "').val(); + if (!hn) { + alert('กรุณากรอก HN ก่อน'); + return; + } + + $.ajax({ + url: '" . \yii\helpers\Url::to(['case/check-patient']) . "', + type: 'POST', + data: { h_n: hn }, + success: function(response) { + if (response.error) { + alert(response.error); + return; + } + + // เติมข้อมูลจาก API response ลงในฟอร์ม + $('#" . Html::getInputId($model, 'patient_id') . "').val(response.req_no); + $('#" . Html::getInputId($model, 'title_id') . "').val(response.title); + $('#" . Html::getInputId($model, 'given_name') . "').val(response.firstName); + $('#" . Html::getInputId($model, 'surname') . "').val(response.lastName); + $('#" . Html::getInputId($model, 'hospital_id') . "').val(response.title); + $('#" . Html::getInputId($model, 'gender') . "').val(response.sex); + $('#" . Html::getInputId($model, 'race') . "').val(response.RACE); + $('#" . Html::getInputId($model, 'id_card') . "').val(response.CardID); + + // การจัดการวันที่ birthDay + if (response.birthDay) { + var birthdate = response.birthDay; + var formattedDate = birthdate.substr(0, 4) + '-' + birthdate.substr(4, 2) + '-' + birthdate.substr(6, 2); + $('#" . Html::getInputId($model, 'birthdate') . "').val(formattedDate); + } else { + $('#" . Html::getInputId($model, 'birthdate') . "').val(''); // ถ้าไม่มีข้อมูล birthDay ให้ใส่ค่าว่าง + } + + // การคำนวณอายุ + if (response.req_date && response.birthDay) { + var birthYear = response.birthDay.substr(0, 4); + var reqYear = response.req_date.substr(0, 4); + var age = reqYear - birthYear; + $('#" . Html::getInputId($model, 'age') . "').val(age); + } else { + $('#" . Html::getInputId($model, 'age') . "').val(''); // ถ้าไม่มีข้อมูล birthDay หรือ req_date ให้ใส่ค่าว่าง + } + + // เติมข้อมูลในช่อง HN + $('#" . Html::getInputId($model, 'h_n') . "').val(response.hn); + }, + error: function(xhr, status, error) { + console.error('AJAX Error:', xhr.responseText); + } + }); + }); +"); + ?> + + +
+ +
+
+ isNewRecord) { ?> + + +
+
+ +
+
ข้อมูลผู้ป่วย (Patient)
+
+ isNewRecord) { ?> + field($model, 'patient_id')->label(false)->hiddenInput() ?> + +
+
+
+ field($model, 'title_id')->widget(Select2::classname(), [ + 'data' => ArrayHelper::map(PatientTitle::find()->all(), 'id', 'name'), //->where('id > 1') + 'options' => [ + 'placeholder' => 'เลือกคำนำหน้า ....', + ], + 'theme' => Select2::THEME_BOOTSTRAP, + //'initValueText' => (!$model->isNewRecord ? ConstHospital::findOne($model->hospital_id)->name : ''), + 'pluginOptions' => [ + 'allowClear' => true, + //'minimumInputLength' => 3, + /*'ajax' => [ + 'url' => Url::to(['/site/hospital-list']), + 'dataType' => 'json',1 + 'data' => new JsExpression('function(params) { return {q:params.term}; }') + ],*/ + ], + ]) ?> +
+
+ field($model, 'given_name')->textInput() ?> +
+
+ field($model, 'surname')->textInput() ?> +
+
+ field($model, 'gender')->dropDownList(['U' => '', 'ช' => 'ชาย', 'ญ' => 'หญิง']) ?> +
+
+
+
+
+ field($model, 'id_card')->widget(MaskedInput::class, [ + 'mask' => '9-9999-99999-99-9' + ]) ?> +
+
field($model, 'birthdate')->widget(MaskedInput::class, [ + 'mask' => '99/99/9999', + 'options' => [ + 'id' => 'patient-birthdate', + ], + ]) + ?> +
+
+ field($model, 'nation')->dropDownList(ArrayHelper::map(ConstNationality::find()->all(), 'id', 'name'), ['prompt' => 'Select Nationalily...']) ?> +
+
+ field($model, 'race')->dropDownList(ArrayHelper::map(ConstRace::find()->all(), 'id', 'name'), ['prompt' => 'Select Race...']) ?> +
+
field($model, 'age')->textInput(['id' => 'patient-age']) ?> +
+
+ field($model, 'age_unit')->dropDownList(['ปี' => 'ปี', 'เดือน' => 'เดือน', 'วัน' => 'วัน'], ['id' => 'patient-age_unit']) ?> +
+
+
+
+ field($model, 'a_n'); ?> +
+
+ field($model, 'v_n'); ?> +
+
+ field($model, 'rights_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstRights::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกสิทธิ์การรักษา....' + ], + ]) ?> +
+
+
+
+ field($model, 'ward_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstWard::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + /*'options' => [ + 'placeholder' => 'เลือกสิทธิ์การรักษา ....', + ],*/ + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกแผนก....' + ], + ]) ?> +
+ +
+ field($model, 'doctor_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + ConstDoctor::find()->orderBy(['fullname' => SORT_ASC])->all(), + 'id', + function ($model) { + return $model->fullname; + } + ), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือกแพทย์เจ้าของคนไข้....' + ], + ]) ?> + + field($model, 'clinician')->textInput() + ?> +
+
+ +
+
ข้อมูลการส่งตรวจ (Case)
+
+
+
+ isNewRecord) { ?> +
+ field($model, 'pathologist_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(User::find()->where(['role' => 'pathologist', 'status' => 10])->orderBy(['realname' => SORT_ASC])->all(), 'id', 'realname'), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือก Pathologist...' + ] + ]) ?> +
+ +
+ field($model, 'note_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map( + User::find() + ->where(['!=', 'role', 'hospital']) + ->andWhere(['status' => User::STATUS_ACTIVE]) + ->orderBy(['realname' => SORT_DESC]) + ->all(), + 'id', + 'realname' + ), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'placeholder' => 'กรุณาเลือกผู้จด....', + 'allowClear' => true, // Optional: allows clearing of the selection + ], + ]) ?> +
+
+ field($model, 'cut_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(User::find()->where(['!=', 'role', 'hospital'])->andWhere(['status' => User::STATUS_ACTIVE])->orderBy(['realname' => SORT_DESC])->all(), 'id', 'realname'), + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'placeholder' => 'กรุณาเลือกผู้ตัด....', + 'allowClear' => true, + ] + ]) ?> +
+
+ field($model, 'collected_at')->widget(DatePicker::class, [ + 'options' => ['placeholder' => 'เลือกวันที่เก็บสิ่งส่งตรวจ ...'], + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + //'todayBtn' => true, + ] + ]) + ?> +
+
+
+
+
+ field($model, 'receive_at')->widget(DatePicker::class, [ + 'options' => ['placeholder' => 'เลือกวันที่รับสิ่งส่งตรวจ ...'], + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + //'todayBtn' => true, + ] + ]) ?> +
+ + + + +
+ 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']], + ], + ] + ])*/ ?> +
+ +
+ 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(); + } + }); + ") ?> +
+ field($model, 'is_express')->checkbox() ?> +
+
isNewRecord && $model->is_express ? '' : 'style="display: none;"' ?>> + +
+ field($model, 'express_day')->dropDownList(['' => '', '3' => 'ผลด่วน 3 วัน', '5' => 'ผลด่วน 5 วัน', '7' => 'ผลด่วน 7 วัน']) ?> +
+
+ field($model, 'express_at')->widget(\kartik\date\DatePicker::class, [ + 'pluginOptions' => [ + 'format' => 'dd/mm/yyyy', + 'allowClear' => true, + 'autoclose' => true, + 'todayHighlight' => true, + 'todayBtn' => true, + ] + ]) ?> +
+
+
+ + 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){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 3); + + // Display the new date + $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate)); + + //alert(formatDate(newDate)); + } + if(selectedValue == 5){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 5); + + // Display the new date + $('#" . Html::getInputId($model, 'express_at') . "').val(formatDate(newDate)); + + //alert(formatDate(newDate)); + } + if(selectedValue == 7){ + + // Add 3 days to the current date + var newDate = new Date(currentDate); + newDate.setDate(currentDate.getDate() + 7); + + // 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 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; new date + } + }); + "); ?> + + + + 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; + } + }); + "); + */ ?> +
+
+ field($model, 'is_molecular')->checkbox() ?> +
+
+ isNewRecord) { ?> +
+
รายการ Specimen
+
+
+
+ field($sc_surgical_container, 'items')->label(false)->widget(MultipleInput::class, [ + 'max' => 50, + 'id' => 'surgicalcontainer-items', + 'allowEmptyList' => true, + 'addButtonOptions' => ['class' => 'btn btn-primary'], + //'min' => 1, + 'addButtonPosition' => MultipleInput::POS_FOOTER, + 'attributeOptions' => [], + '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' => 'container_type', + 'title' => 'รายการ', + 'type' => MultipleInputColumn::TYPE_DROPDOWN, + 'value' => function ($data) { + return isset($data['container_type']) ? $data['container_type'] : null; + }, + 'items' => [ + 1 => 'ขวด', + 2 => 'ถุง', + 3 => 'Block', + 4 => 'Slide' + ], + 'enableError' => true, + 'options' => [ + 'class' => 'new_class', + 'prompt' => 'เลือกรายการ.....', + ] + ], + [ + 'name' => 'amount', + 'title' => 'จำนวน', + 'options' => ['class' => 'uppercase-input'], + //'enableError' => true, + 'value' => function ($data) { + return strtoupper(isset($data['amount'])) ? $data['amount'] : ''; + }, + ], + [ + 'name' => 'specimen_size', + 'title' => 'ขนาดชิ้นเนื้อ', + 'type' => MultipleInputColumn::TYPE_DROPDOWN, + 'value' => function ($data) { + return isset($data['specimen_size']) ? $data['specimen_size'] : null; + }, + 'items' => [ + 1 => 'smc(เนื้อเล็ก)', + 2 => 'smc(เนื้อกลาง)', + 3 => 'smc(เนื้อใหญ่)' + ], + 'enableError' => true, + 'options' => [ + 'class' => 'new_class', + 'prompt' => 'เลือกขนาดชิ้นเนื้อ', + ] + ], + [ + 'name' => 'remark', + 'title' => 'remark', + 'enableError' => true, + ], + ] + ]) ?> +
+
+ + + registerJs(" + $('.uppercase-input').on('keyup', function() { + var input = $(this); + var value = input.val().toUpperCase(); + input.val(value); + }); + "); ?> + + + registerJs(" + $('#surgicalcontainer-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){ + //console.log(item);#surgicalcontainer-items-0-from_id + var id_case = item.find('.list-cell__block_no').find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id_case\"]').val(); + var id = item.find('.list-cell__block_no').find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id\"]').val(); + //alert(id_case + from_id); + $.post(\"" . Url::to(['/register/case-update/surgical-container-delete']) . "\", + { + id_case: id_case, + hs_id: hs_id + }, + ); + }); + + ") ?> + + registerJs( + "$('#surgicalcontainer-items').on('afterInit', function() { + // Initialization event if needed + }).on('beforeAddRow', function(e) { + // Before adding a row event if needed + }).on('afterAddRow', function(e) { + // After adding a row event if needed + }).on('beforeDeleteRow', function(e, item) { + return confirm('คุณแน่ใจนะว่าต้องการลบ?'); // Confirm deletion + }).on('afterDeleteRow', function(e, item) { + var id_case = item.find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id_case\"]').val(); + var id = item.find('input[id*=\"surgicalcontainer-items-\"][id$=\"-id\"]').val(); + + // Make sure id_case and id are not empty or undefined before sending the request + if (id_case && id) { + $.post(\"" . Url::to(['/register/case-update/surgical-container-delete']) . "\", { + id_case: id_case, + id: id + }).done(function(response) { + if (response.status === 'success') { + alert('ลบรายการเรียบร้อยแล้ว'); + } else { + alert('Error: ' + response.message); + } + }).fail(function() { + alert('An error occurred while trying to delete the item.'); + }); + } else { + alert('Invalid id_case or id.'); + } + }); + " + ) ?> + +
+
+ field($model, 'review_remark')->textarea(['rows' => 5, 'cols' => 50]) ?> +
+
+ + isNewRecord) { ?> +
+
+
+
+ รายการ Test Order
+
+ false, + 'tableOptions' => ['class' => 'table table-striped truncate m-0'], + 'dataProvider' => new ActiveDataProvider([ + 'query' => FinanceServiceCharge::find() + ->where(['id_case' => $model->id_case]) + ]), + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + 'charge.code', + 'charge.name', + ], + 'layout' => "
\n{items}\n
{pager}
", + ]) ?> +
+
+ + +
+
ใบส่งตรวจ + (Request File) +
+ +
+ field($model, 'files[]')->label(false)->fileInput(['multiple' => true])->label(false) ?> +
+
    + getFiles() as $file => $val) { + ?> +
  • '_blank']); ?> + ', [ + 'file-del', + 'file' => $val, + 'id' => $model->id, + 'id_case' => $model->id_case + ], [ + 'class' => 'btn btn-sm btn-danger', + 'data-confirm' => 'ต้องการลบ?' + ]); + ?> +
  • + +
+
+ +
+
บันทึกภาพ Specimen + Container +
+ +
+ field($model, 'specimen_container_img[]')->fileInput(['multiple' => true])->label(false) ?> +
+ specimen_container_img)) { ?> + +
+
Specimen Container + List
+
+
getSpecimenDelImgs() ?>
+ + + +
+
+
Outsource Data
+ + field($model, 'is_outlab')->checkbox() ?> +
isNewRecord && $model->is_outlab ? '' : 'style="display: none;"' ?>> +
+
+ field($model, 'outlab_report[]')->fileInput(['multiple' => true]) ?> +
+
+
+
+ field($model, 'remark_outlab')->textarea(['spellcheck' => true])->widget(CKEditor::class, [ + 'preset' => 'custom', + 'clientOptions' => [ + 'height' => 200, + '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']], + ], + ] + ]) ?> +
+
+
+ registerJs(" + $(\"input[name='" . Html::getInputName($model, 'is_outlab') . "']\").change(function() { + if(this.checked == true){ + $('.outlab_report').show(); + }else{ + $('.outlab_report').hide(); + } + }); + ") ?> + +
    + + getReport() as $file => $val) { + if (!empty($val)) { + ?> +
  • '_blank']); ?> + ', [ + 'report-del', + 'file' => $val, + 'id' => $model->id, + 'id_case' => $model->id_case + ], [ + 'class' => 'btn btn-sm btn-danger', + 'data-confirm' => 'ต้องการลบ?' + ]); + ?> +
  • + +
+ +
+
+ บันทึกข้อมูล', ['class' => 'btn btn-success']) ?> +
+
+ + +
+ + +
+
+ + + + + + +render('_js') ?> \ No newline at end of file diff --git a/frontend/modules/surgical/controllers/PrintController.php b/frontend/modules/surgical/controllers/PrintController.php index cd328293..18e0c1d9 100755 --- a/frontend/modules/surgical/controllers/PrintController.php +++ b/frontend/modules/surgical/controllers/PrintController.php @@ -192,7 +192,7 @@ class PrintController extends \yii\web\Controller //$print_arr = [1 => 'SR LIS']; $print_arr = [1 => 'HANUMAN']; //$content = $result . ',' . $surgical_slide->no_slide . ',' . 'SR. PATH' . ',Hopper' . $surgical_slide_print['items'][$value]['hopper'] . ',Outlet' . $surgical_slide_print['items'][$value]['outlet'] . ',' . $print_arr[$surgical_slide_print['items'][$value]['printer']]; - $content = $result . ',' . $surgical_slide->no_slide . ',' . 'SRTH' . ',Hopper ' . $surgical_slide_print['items'][$value]['hopper'] . ',Outlet' . $surgical_slide_print['items'][$value]['outlet'] . ',' . $print_arr[$surgical_slide_print['items'][$value]['printer']]; + $content = $result . ',' . $surgical_slide->no_slide . ',' . 'surattani hospital' . ',Hopper ' . $surgical_slide_print['items'][$value]['hopper'] . ',Outlet' . $surgical_slide_print['items'][$value]['outlet'] . ',' . $print_arr[$surgical_slide_print['items'][$value]['printer']]; // } //$content = implode("\n", $content); From b8f1fc5db63839d6bcb079deb5c4d21f891f6769 Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 09:13:06 +0700 Subject: [PATCH 09/13] cancer --- common/models/ConstCancerRegistry.php | 46 +++++++ .../views/do/_cyto_non_gyn_screener.php | 1 - .../ConstCancerRegistryController.php | 127 ++++++++++++++++++ .../models/ConstCancerRegistrySearch.php | 69 ++++++++++ .../views/const-cancer-registry/_form.php | 24 ++++ .../views/const-cancer-registry/_search.php | 33 +++++ .../views/const-cancer-registry/create.php | 24 ++++ .../views/const-cancer-registry/index.php | 70 ++++++++++ .../views/const-cancer-registry/update.php | 30 +++++ .../views/const-cancer-registry/view.php | 44 ++++++ frontend/themes/nikom/views/layouts/_menu.php | 3 +- 11 files changed, 469 insertions(+), 2 deletions(-) create mode 100644 common/models/ConstCancerRegistry.php create mode 100644 frontend/modules/register/controllers/ConstCancerRegistryController.php create mode 100644 frontend/modules/register/models/ConstCancerRegistrySearch.php create mode 100644 frontend/modules/register/views/const-cancer-registry/_form.php create mode 100644 frontend/modules/register/views/const-cancer-registry/_search.php create mode 100644 frontend/modules/register/views/const-cancer-registry/create.php create mode 100644 frontend/modules/register/views/const-cancer-registry/index.php create mode 100644 frontend/modules/register/views/const-cancer-registry/update.php create mode 100644 frontend/modules/register/views/const-cancer-registry/view.php diff --git a/common/models/ConstCancerRegistry.php b/common/models/ConstCancerRegistry.php new file mode 100644 index 00000000..1a15938b --- /dev/null +++ b/common/models/ConstCancerRegistry.php @@ -0,0 +1,46 @@ + 500], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + ]; + } +} \ No newline at end of file diff --git a/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php b/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php index 4818938e..fd1d5310 100644 --- a/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php +++ b/frontend/modules/pathologist/views/do/_cyto_non_gyn_screener.php @@ -5,7 +5,6 @@ use common\models\CytoSpecimenAdequacy1; use yii\widgets\DetailView; - $cytoNonGynDiagnosisLog = CytoNonGynDiagnosisLog::find() ->where([ 'id_case' => $case_pap->id_case, diff --git a/frontend/modules/register/controllers/ConstCancerRegistryController.php b/frontend/modules/register/controllers/ConstCancerRegistryController.php new file mode 100644 index 00000000..ae7396c4 --- /dev/null +++ b/frontend/modules/register/controllers/ConstCancerRegistryController.php @@ -0,0 +1,127 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all ConstCancerRegistr models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new ConstCancerRegistrySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single CytoFixation model. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new CytoFixation model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new ConstCancerRegistry(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + /** + * Updates an existing ConstCancerRegistry model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + /** + * Deletes an existing ConstCancerRegistry model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + * @throws NotFoundHttpException if the model cannot be found + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the ConstCancerRegistry model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return ConstCancerRegistry the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = ConstCancerRegistry::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} \ No newline at end of file diff --git a/frontend/modules/register/models/ConstCancerRegistrySearch.php b/frontend/modules/register/models/ConstCancerRegistrySearch.php new file mode 100644 index 00000000..e50ef7b8 --- /dev/null +++ b/frontend/modules/register/models/ConstCancerRegistrySearch.php @@ -0,0 +1,69 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]); + + return $dataProvider; + } +} \ No newline at end of file diff --git a/frontend/modules/register/views/const-cancer-registry/_form.php b/frontend/modules/register/views/const-cancer-registry/_form.php new file mode 100644 index 00000000..f425574d --- /dev/null +++ b/frontend/modules/register/views/const-cancer-registry/_form.php @@ -0,0 +1,24 @@ + + + + + + +field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? 'เพิ่มข้อมูล' : 'แก้ไข', ['class' => $model->isNewRecord ? 'btn btn-primary' : 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-danger']) ?> + +
+ + \ No newline at end of file diff --git a/frontend/modules/register/views/const-cancer-registry/_search.php b/frontend/modules/register/views/const-cancer-registry/_search.php new file mode 100644 index 00000000..d2ef0514 --- /dev/null +++ b/frontend/modules/register/views/const-cancer-registry/_search.php @@ -0,0 +1,33 @@ + + + diff --git a/frontend/modules/register/views/const-cancer-registry/create.php b/frontend/modules/register/views/const-cancer-registry/create.php new file mode 100644 index 00000000..adbaadb8 --- /dev/null +++ b/frontend/modules/register/views/const-cancer-registry/create.php @@ -0,0 +1,24 @@ +title = 'Create Cancer Registry'; +$this->params['breadcrumbs'][] = ['label' => 'Cancer Registry', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> + +
+
+
+ title) ?> +
+
+
+ render('_form', [ + 'model' => $model, + ]) ?> +
+
\ No newline at end of file diff --git a/frontend/modules/register/views/const-cancer-registry/index.php b/frontend/modules/register/views/const-cancer-registry/index.php new file mode 100644 index 00000000..30bcfc6f --- /dev/null +++ b/frontend/modules/register/views/const-cancer-registry/index.php @@ -0,0 +1,70 @@ +title = 'Cancer Registry'; +$this->params['breadcrumbs'][] = $this->title; +?> + + +
+
+
+
title) ?> +
+ เพิ่ม Cancer Registry', ['create'], ['class' => 'btn btn-primary']) ?> +
+
+ render('_search', ['model' => $searchModel]); + ?> +
+ ['class' => 'yii\bootstrap5\LinkPager'], + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'tableOptions' => ['class' => 'table align-middle table-hover m-0 truncate'], + 'layout' => "{summary}
\n{items}\n
{pager}
", + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + //'id', + 'name', + [ + 'class' => 'yii\grid\ActionColumn', + 'headerOptions' => ['class' => 'custom-action-column-header'], + 'contentOptions' => ['class' => 'custom-action-column'], + 'template' => '{view} {update} {delete}', // Customize buttons if needed + 'buttons' => [ + 'view' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'View'), + 'class' => 'btn btn-outline-info btn-sm' + ]); + }, + 'update' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Update'), + 'class' => 'btn btn-outline-warning btn-sm' + ]); + }, + 'delete' => function ($url, $model, $key) { + return Html::a('', $url, [ + 'title' => Yii::t('app', 'Delete'), + 'data-confirm' => Yii::t('app', 'คุณแน่ใจว่าต้องการลบรายการนี้หรือไม่ ?'), + 'data-method' => 'post', + 'class' => 'btn btn-outline-danger btn-sm' + ]); + }, + ], + ], + ], + ]); ?> +
+
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/const-cancer-registry/update.php b/frontend/modules/register/views/const-cancer-registry/update.php new file mode 100644 index 00000000..6d00e2b8 --- /dev/null +++ b/frontend/modules/register/views/const-cancer-registry/update.php @@ -0,0 +1,30 @@ +title = 'Update Cyto Source of Specimens: ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Cyto Source of Specimens', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'แก้ไข'; +?> +
+
+
+

+ +
+
    +
  • +
+
+
+
+ render('_form', [ + 'model' => $model, + ]) ?> +
+
+
\ No newline at end of file diff --git a/frontend/modules/register/views/const-cancer-registry/view.php b/frontend/modules/register/views/const-cancer-registry/view.php new file mode 100644 index 00000000..a58851cd --- /dev/null +++ b/frontend/modules/register/views/const-cancer-registry/view.php @@ -0,0 +1,44 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Cyto Specimen Types', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> + +
+
+
title) ?>
+
+ $model->id], ['class' => 'btn btn-warning']) ?> + $model->id], ['class' => 'btn btn-info']) ?> +
+
+ +
+ $model, + 'attributes' => [ + 'id', + 'name', + 'group_case', + [ + //'attribute' => 'charge_id', + 'format' => 'raw', + 'label' => 'สถานะ', + 'value' => function ($model) { + $arr = [1 => ' ใช้งาน', 0 => ' ไม่ใช้งาน']; + return isset($model->is_view) ? ($arr[$model->is_view]) : ''; + }, + ], + //'is_view', + ], + ]) ?> +
+
\ 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 e262f3c9..efbaa0b7 100755 --- a/frontend/themes/nikom/views/layouts/_menu.php +++ b/frontend/themes/nikom/views/layouts/_menu.php @@ -145,6 +145,7 @@ if (Yii::$app->user->can('center')) { ], ]; */ + $menuItems[] = [ 'label' => ' Outsource Lab', 'url' => 'javascript:void()', @@ -186,7 +187,6 @@ if (Yii::$app->user->can('center')) { ];*/ $menuItems[] = ['label' => ' พยาธิแพทย์คืน Case ' . PathologistTransfer::find()->where(['transfer_status' => 1])->count() . '', 'url' => ['/register/pathologist-transfer/index']]; - $menuItems[] = [ 'label' => ' อุบัติการณ์(ปฏิเสธ)', 'url' => 'javascript:void()', @@ -233,6 +233,7 @@ if (Yii::$app->user->can('center')) { ['label' => ' รายการ Ward', 'url' => ['/register/const-ward/index']], ['label' => ' คำนำหน้า', 'url' => ['/register/patient-title/index']], ['label' => ' ข้อมูลวันหยุด', 'url' => ['/stat/hr-day-off/index']], + ['label' => ' ข้อมูล Cancer Registry', 'url' => ['/register/const-cancer-registry/index']], ['label' => ' ข้อมูล Cyto Specimen Types', 'url' => ['/register/cyto-specimen-type/index']], ['label' => ' ข้อมูล Cyto Specimen', 'url' => ['/register/cyto-specimen/index']], ['label' => ' ข้อมูล Cyto Source of Specimen', 'url' => ['/register/cyto-source-of-specimen/index']], From 25cbe960fe7a2864728ee9701b11279b05eec4b3 Mon Sep 17 00:00:00 2001 From: mrkcp Date: Wed, 2 Apr 2025 09:14:21 +0700 Subject: [PATCH 10/13] update import --- .../controllers/HospitalImportController.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/modules/register/controllers/HospitalImportController.php b/frontend/modules/register/controllers/HospitalImportController.php index 9e2c64cb..e3b32100 100755 --- a/frontend/modules/register/controllers/HospitalImportController.php +++ b/frontend/modules/register/controllers/HospitalImportController.php @@ -193,7 +193,12 @@ class HospitalImportController extends Controller $const_charge = new ConstServiceCharge(); $const_charge->code = $his_import->lab_code; $const_charge->name = $his_import->lab_name; - $const_charge->save(); + if($const_charge->save()) { + + } else { + var_dump($const_charge->getFirstErrors()); + die(); + } } } @@ -205,7 +210,12 @@ class HospitalImportController extends Controller $his_import_service_charge->req_no = $his_import->req_no; $his_import_service_charge->test_code = $his_import->lab_code; $his_import_service_charge->test_name = $his_import->lab_name; - $his_import_service_charge->save(); + //$his_import_service_charge->save(); + if ($his_import_service_charge->save()) { + } else { + var_dump($his_import_service_charge->getFirstErrors()); + die(); + } } $case = PatientCase::findOne(['his_ln' => $his_import->req_no]); @@ -218,7 +228,12 @@ class HospitalImportController extends Controller $his_finance_service_charge->req_no = $his_import->req_no; $his_finance_service_charge->charge_id = $const_charge->id; $his_finance_service_charge->is_cash = 0; - $his_finance_service_charge->save(); + //$his_finance_service_charge->save(); + if ($his_finance_service_charge->save()) { + } else { + var_dump($his_finance_service_charge->getFirstErrors()); + die(); + } } } From dbd92a38cdd10daf4ac259aa4046def0f6dbb49b Mon Sep 17 00:00:00 2001 From: Star Indy Date: Wed, 2 Apr 2025 09:46:26 +0700 Subject: [PATCH 11/13] fix cancer --- common/models/CaseSurgical.php | 3 +- .../pathologist/views/do/surgical-final.php | 17 ++++- .../register/views/case/_form_surgical.php | 73 ++++++++++--------- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/common/models/CaseSurgical.php b/common/models/CaseSurgical.php index 2c30799e..8e7e4922 100755 --- a/common/models/CaseSurgical.php +++ b/common/models/CaseSurgical.php @@ -151,7 +151,7 @@ class CaseSurgical extends PathologyActiveRecord //[['note_id', 'cut_id'], 'required', 'on' => 'gross'], [['id_case'], 'unique'], [['autocomplete_hospital', 'autocomplete_patient', 'autocomplete_ward', /*'frozen_id_case', 'cons_pathologist',*/ 'hos_ref' /*'case_reference'*/, 'house', 'moo', 'soy', 'road', 'phone', 'email', 'review_remark'], 'string'], - [['patient_id', 'title_id', 'is_immuno_staining', 'is_histo_staining', 'register_id', 'amount', 'block_type_id', 'pathologist_id', 'is_consult', 'status_id', 'hospital_id', 'gross_id', /*'cons_pathologist_id', 'consultant_id', 'center_box_open_id',*/ 'is_critical_diagnosis', 'is_pathologist_ot', 'gross_img_update_id', 'is_no_microscopic', 'is_outlab', 'is_consult_outlab', 'charge_user_id', 'bone', 'is_kidney', 'note_id', 'cut_id', 'is_express', 'ward_id', 'rights_id', 'doctor_id', 'order_point_id', 'order_by_id', 'hospital_import_id', 'amount_in', 'const_rights_id', 'is_molecular', 'is_dish', 'is_frozen', 'is_necropsy', 'tambon', 'amphur', 'province', 'postcode', 'marriage', 'occupation', 'religious', 'race','nation', 'citizenship', 'is_flesh', 'bag', 'is_conference', 'is_smc', 'is_stat_smc', 'no_bottle', 'block_no', 'slide_no', 'clinic_id', 'is_ot', 'is_use_specimen'], 'integer'], + [['patient_id', 'title_id', 'is_immuno_staining', 'is_histo_staining', 'register_id', 'amount', 'block_type_id', 'pathologist_id', 'is_consult', 'status_id', 'hospital_id', 'gross_id', /*'cons_pathologist_id', 'consultant_id', 'center_box_open_id',*/ 'is_critical_diagnosis', 'is_pathologist_ot', 'gross_img_update_id', 'is_no_microscopic', 'is_outlab', 'is_consult_outlab', 'charge_user_id', 'bone', 'is_kidney', 'note_id', 'cut_id', 'is_express', 'ward_id', 'rights_id', 'doctor_id', 'order_point_id', 'order_by_id', 'hospital_import_id', 'amount_in', 'const_rights_id', 'is_molecular', 'is_dish', 'is_frozen', 'is_necropsy', 'tambon', 'amphur', 'province', 'postcode', 'marriage', 'occupation', 'religious', 'race','nation', 'citizenship', 'is_flesh', 'bag', 'is_conference', 'is_smc', 'is_stat_smc', 'no_bottle', 'block_no', 'slide_no', 'clinic_id', 'is_ot', 'is_use_specimen', 'cancer_registry_id'], 'integer'], [['id_case', 'hos_ref', 'given_name', 'surname', 'gender','id_card', 'age_unit', 'h_n', 'a_n', 'ward', 'clinician', 'specimen', 'section_label', 'clinical_diagnosis', 'clinical_diagnosis_his', 'gross_description', 'microscopic_description', 'patho_remark', 'diagnosis', 'additional_diagnosis', /*'cons',*/ 'patho_remark', 'bone_note', 'lab_order_number', 'remark', 'remark_outlab', 'remark_consult_outlab', 'remark_report'], 'string'], [['his_ln', 'verify_date'], 'string', 'max' => 100], [['register_at', 'birthdate', 'collected_at', 'conference_at', 'report_at', 'id_case', 'gross_at', 'decal_end_date', 'items', 'slides', 'additional_at', 'status_at', 'cut_at', 'receive_at', 'express_at', 'finance_immuno', 'finance_histo', 'outlab_report', 'decal_block', 'finance_dish'], 'safe'], @@ -289,6 +289,7 @@ class CaseSurgical extends PathologyActiveRecord 'slide_no' => 'จำนวน Slide', 'is_ot' => 'เนื้อนอกเวลา', 'is_use_specimen' => 'Specimen', + 'cancer_registry_id' => 'Cancer Registry', 'specimen_container_img' => 'Specimen Container' ]; } diff --git a/frontend/modules/pathologist/views/do/surgical-final.php b/frontend/modules/pathologist/views/do/surgical-final.php index f0458aa6..5118f30f 100755 --- a/frontend/modules/pathologist/views/do/surgical-final.php +++ b/frontend/modules/pathologist/views/do/surgical-final.php @@ -1,6 +1,6 @@ params['breadcrumbs'][] = $this->title; 'case_surgical' => $case_surgical ]) */ ?> -user->identity->username == 'pathologist') { ?> -render('_slide', ['case_surgical' => $case_surgical]) ?> -
@@ -108,6 +105,16 @@ $this->params['breadcrumbs'][] = $this->title;
getGrossImgs() ?>

+
+ field($case_surgical, 'cancer_registry_id')->widget(Select2::class, [ + 'data' => ArrayHelper::map(ConstCancerRegistry::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), //->where('id > 1') + 'theme' => Select2::THEME_BOOTSTRAP, + 'pluginOptions' => [ + 'allowClear' => true, + 'placeholder' => 'เลือก Cancer Registry...' + ], + ]) ?> +
Specimen And Clinical Information
@@ -133,6 +140,8 @@ $this->params['breadcrumbs'][] = $this->title; ] ]) ?> + +
Gross Description
field($model, 'gross_description')->label(false)->textarea(['spellcheck' => true])->widget(CKEditor::class, [ diff --git a/frontend/modules/register/views/case/_form_surgical.php b/frontend/modules/register/views/case/_form_surgical.php index 3088c7f3..d4fec2b5 100755 --- a/frontend/modules/register/views/case/_form_surgical.php +++ b/frontend/modules/register/views/case/_form_surgical.php @@ -1,6 +1,6 @@
isNewRecord) { ?> - +
@@ -119,7 +119,7 @@ use unclead\multipleinput\MultipleInputColumn;
ข้อมูลผู้ป่วย (Patient)
isNewRecord) { ?> - field($model, 'patient_id')->label(false)->hiddenInput() ?> + field($model, 'patient_id')->label(false)->hiddenInput() ?>
@@ -154,12 +154,14 @@ use unclead\multipleinput\MultipleInputColumn;
'btn btn-info', 'data-bs-toggle' => 'modal', 'data-bs-target' => '#patientModal']) ?> -