prework
This commit is contained in:
parent
bc8653d89f
commit
d5c8cac5ec
69
app/Controllers/Test/ValueSetDef.php
Normal file
69
app/Controllers/Test/ValueSetDef.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace App\Controllers\ValueSet;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\Test\TestDefModel;
|
||||
|
||||
class TestDef extends BaseController {
|
||||
use ResponseTrait;
|
||||
|
||||
protected $db;
|
||||
protected $rules;
|
||||
protected $model;
|
||||
|
||||
public function __construct() {
|
||||
$this->db = \Config\Database::connect();
|
||||
$this->model = new TestDefModel;
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$param = $this->request->getVar('param');
|
||||
$rows = $this->model->getValueSetDefs($param);
|
||||
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "no Data.", 'data' => [] ], 200); }
|
||||
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
|
||||
}
|
||||
|
||||
public function show($VSetID = null) {
|
||||
$rows = $this->model->find($VSetID);
|
||||
if (empty($rows)) { return $this->respond([ 'status' => 'success', 'message' => "no Data.", 'data' => [] ], 200); }
|
||||
return $this->respond([ 'status' => 'success', 'message'=> "Data fetched successfully", 'data' => $rows ], 200);
|
||||
}
|
||||
|
||||
public function create() {
|
||||
$input = $this->request->getJSON(true);
|
||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||
try {
|
||||
$VSetID = $this->model->insert($input);
|
||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $VSetID created successfully" ]);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function update() {
|
||||
$input = $this->request->getJSON(true);
|
||||
$VSetID = $input["VID"];
|
||||
if (!$VSetID) { return $this->failValidationErrors('VSetID is required.'); }
|
||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||
try {
|
||||
$this->model->update($VSetID,$input);
|
||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $VSetID updated successfully" ]);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$input = $this->request->getJSON(true);
|
||||
$VSetID = $input['VSetID'];
|
||||
if (!$VSetID) { return $this->failValidationErrors('VSetID is required.'); }
|
||||
try {
|
||||
$this->model->delete($VSetID);
|
||||
return $this->respondDeleted(['status' => 'success', 'message' => "Data $VSetID deleted successfully."]);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
20
app/Models/RefRange/RefNumModel.php
Normal file
20
app/Models/RefRange/RefNumModel.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\RefRange;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class RefNumModel extends BaseModel {
|
||||
protected $table = 'refnum';
|
||||
protected $primaryKey = 'RefNumID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteID', 'SpcType', 'Sex', 'AgeStart', 'AgeEnd',
|
||||
'CriticalLow', 'Low', 'High', 'CriticalHigh',
|
||||
'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
20
app/Models/RefRange/RefTHoldModel.php
Normal file
20
app/Models/RefRange/RefTHoldModel.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\RefRange;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class RefTHoldModel extends BaseModel {
|
||||
protected $table = 'refthold';
|
||||
protected $primaryKey = 'RefTHoldID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteID', 'SpcType', 'Sex', 'AgeStart', 'AgeEnd',
|
||||
'Threshold', 'BelowTxt', 'AboveTxt', 'GrayzoneLow', 'GrayzoneHigh', 'GrayzoneTxt',
|
||||
'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
19
app/Models/RefRange/RefVSetModel.php
Normal file
19
app/Models/RefRange/RefVSetModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\RefRange;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class RefVSetModel extends BaseModel {
|
||||
protected $table = 'refvset';
|
||||
protected $primaryKey = 'RefVSetID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteID', 'SpcType', 'Sex', 'AgeStart', 'AgeEnd',
|
||||
'RefTxt', 'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
19
app/Models/Test/TestDefCalModel.php
Normal file
19
app/Models/Test/TestDefCalModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Test;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class TestDefCalModel extends BaseModel {
|
||||
protected $table = 'testdefcal';
|
||||
protected $primaryKey = 'TestCalID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteID', 'FormulaCode', 'FormulaLang', 'FormulaInput',
|
||||
'Unit1', 'Factor', 'Unit2', 'Decimal' ,'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
19
app/Models/Test/TestDefModel.php
Normal file
19
app/Models/Test/TestDefModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Test;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class TestDefModel extends BaseModel {
|
||||
protected $table = 'testdef';
|
||||
protected $primaryKey = 'TestID';
|
||||
protected $allowedFields = ['ParentTest', 'TestCode', 'TestName', 'Description', 'DisciplineID',
|
||||
'Method', 'Seq', 'CountStat', 'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
19
app/Models/Test/TestDefSiteModel.php
Normal file
19
app/Models/Test/TestDefSiteModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Test;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class TestDefSiteModel extends BaseModel {
|
||||
protected $table = 'testdefsite';
|
||||
protected $primaryKey = 'TestSiteID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteCode', 'TestSiteName', 'Type', 'Description', 'SeqScr', 'SeqRpt', 'IndentLeft',
|
||||
'VisibleScr', 'VisibleRpt', 'CountStat', 'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
20
app/Models/Test/TestDefTechModel.php
Normal file
20
app/Models/Test/TestDefTechModel.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Test;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class TestDefTechModel extends BaseModel {
|
||||
protected $table = 'testdeftech';
|
||||
protected $primaryKey = 'TestTechID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteID', 'DisciplineID', 'DepartmentID', 'WorkstationID', 'EquipmentID', 'VSet', 'SpcType',
|
||||
'ReqQty', 'ReqQtyUnit', 'Unit1', 'Factor', 'Unit2', 'Decimal', 'CollReq', 'ConDefID', 'TestTechCode', 'TestTechAbb', 'TestTechName',
|
||||
'Method', 'ExpectedTAT', 'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
18
app/Models/Test/TestGrpModel.php
Normal file
18
app/Models/Test/TestGrpModel.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Test;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class TestGrpModel extends BaseModel {
|
||||
protected $table = 'testgrp';
|
||||
protected $primaryKey = 'TestGrpID';
|
||||
protected $allowedFields = ['SiteID', 'TestSiteID', 'Member', 'CreateDate', 'EndDate'];
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'CreateDate';
|
||||
protected $updatedField = '';
|
||||
protected $useSoftDeletes = true;
|
||||
protected $deletedField = "EndDate";
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user