refactor remove id from url when update an delete
This commit is contained in:
parent
82b22b63b0
commit
8ff71a27fc
@ -33,8 +33,8 @@ $routes->post('/api/auth/logout', 'Auth::logout');
|
|||||||
$routes->get('/api/patient', 'Patient::index');
|
$routes->get('/api/patient', 'Patient::index');
|
||||||
$routes->post('/api/patient', 'Patient::create');
|
$routes->post('/api/patient', 'Patient::create');
|
||||||
$routes->get('/api/patient/(:num)', 'Patient::show/$1');
|
$routes->get('/api/patient/(:num)', 'Patient::show/$1');
|
||||||
$routes->delete('/api/patient/(:num)', 'Patient::delete/$1');
|
$routes->delete('/api/patient', 'Patient::delete');
|
||||||
$routes->patch('/api/patient/(:num)', 'Patient::update/$1');
|
$routes->patch('/api/patient', 'Patient::update');
|
||||||
$routes->get('/api/patient/check', 'Patient::patientCheck');
|
$routes->get('/api/patient/check', 'Patient::patientCheck');
|
||||||
|
|
||||||
$routes->get('/api/race', 'Race::index');
|
$routes->get('/api/race', 'Race::index');
|
||||||
@ -52,17 +52,17 @@ $routes->get('/api/ethnic/(:num)', 'Ethnic::show/$1');
|
|||||||
$routes->get('/api/location', 'Location::index');
|
$routes->get('/api/location', 'Location::index');
|
||||||
$routes->get('/api/location/(:num)', 'Location::show/$1');
|
$routes->get('/api/location/(:num)', 'Location::show/$1');
|
||||||
$routes->post('/api/location', 'Location::create');
|
$routes->post('/api/location', 'Location::create');
|
||||||
$routes->patch('/api/location/(:num)', 'Location::update/$1');
|
$routes->patch('/api/location', 'Location::update');
|
||||||
$routes->delete('/api/location/(:num)', 'Patient::delete/$1');
|
$routes->delete('/api/location', 'Patient::delete');
|
||||||
|
|
||||||
$routes->get('/api/valueset', 'ValueSet::index');
|
$routes->get('/api/valueset', 'ValueSet::index');
|
||||||
$routes->get('/api/valueset/(:num)', 'ValueSet::show/$1');
|
$routes->get('/api/valueset/(:num)', 'ValueSet::show/$1');
|
||||||
$routes->post('/api/valueset', 'ValueSet::create');
|
$routes->post('/api/valueset', 'ValueSet::create');
|
||||||
$routes->patch('/api/valueset/(:num)', 'ValueSet::update/$1');
|
$routes->patch('/api/valueset', 'ValueSet::update');
|
||||||
$routes->delete('/api/valueset/(:num)', 'ValueSet::delete/$1');
|
$routes->delete('/api/valueset', 'ValueSet::delete');
|
||||||
|
|
||||||
$routes->get('/api/valuesetfield/', 'ValueSetField::index');
|
$routes->get('/api/valuesetfield/', 'ValueSetField::index');
|
||||||
$routes->get('/api/valuesetfield/(:num)', 'ValueSetField::show/$1');
|
$routes->get('/api/valuesetfield/(:num)', 'ValueSetField::show/$1');
|
||||||
$routes->post('/api/valuesetfield', 'ValueSetField::create');
|
$routes->post('/api/valuesetfield', 'ValueSetField::create');
|
||||||
$routes->patch('/api/valuesetfield/(:num)', 'ValueSetField::update/$1');
|
$routes->patch('/api/valuesetfield', 'ValueSetField::update');
|
||||||
$routes->delete('/api/valuesetfield/(:num)', 'ValueSetField::delete/$1');
|
$routes->delete('/api/valuesetfield', 'ValueSetField::delete');
|
||||||
@ -10,7 +10,10 @@ class Location extends Controller {
|
|||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
$this->now = date('Y-m-d H:i:s');
|
$this->rules = [
|
||||||
|
'LocCode' => 'required|max_length[6]',
|
||||||
|
'LocFull' => 'required',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
@ -59,19 +62,12 @@ class Location extends Controller {
|
|||||||
public function create() {
|
public function create() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
|
|
||||||
// Prepare data
|
// Prepare data
|
||||||
$dataLocation = $this->prepareLocationData($input, $now, 'create');
|
$dataLocation = $this->prepareLocationData($input);
|
||||||
$dataLocationAddress = $this->prepareLocationAddressData($input, $now, 'create');
|
$dataLocationAddress = $this->prepareLocationAddressData($input);
|
||||||
|
|
||||||
// Validation rules
|
if (!$this->validateData($dataLocation, $this->rules)) {
|
||||||
$rulesLocation = [
|
|
||||||
'LocCode' => 'required|is_unique[location.LocCode]|max_length[6]',
|
|
||||||
'LocFull' => 'required',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!$this->validateData($dataLocation, $rulesLocation)) {
|
|
||||||
return $this->failValidationErrors($this->validator->getErrors());
|
return $this->failValidationErrors($this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +97,7 @@ class Location extends Controller {
|
|||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Location created successfully',
|
'message' => 'Location created successfully',
|
||||||
'data' => $newLocationID,
|
'data' => $dataLocation,
|
||||||
], 201);
|
], 201);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -113,22 +109,15 @@ class Location extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($LocationID = null) {
|
public function update() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$now = $this->now;
|
|
||||||
|
|
||||||
// Prepare data
|
// Prepare data
|
||||||
$dataLocation = $this->prepareLocationData($input, $now, 'update');
|
$dataLocation = $this->prepareLocationData($input);
|
||||||
$dataLocationAddress = $this->prepareLocationAddressData($input, $now, 'update');
|
$dataLocationAddress = $this->prepareLocationAddressData($input);
|
||||||
|
|
||||||
// Validation rules
|
if (!$this->validateData($dataLocation, $this->rules)) {
|
||||||
$rulesLocation = [
|
|
||||||
'LocCode' => 'required|is_unique[location.LocCode]|max_length[6]',
|
|
||||||
'LocFull' => 'required',
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!$this->validateData($dataLocation, $rulesLocation)) {
|
|
||||||
return $this->failValidationErrors( $this->validator->getErrors());
|
return $this->failValidationErrors( $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,11 +125,11 @@ class Location extends Controller {
|
|||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
|
||||||
// Insert location
|
// Insert location
|
||||||
$this->db->table('location')->where('LocationID', $LocationID)->update($dataLocation);
|
$this->db->table('location')->where('LocationID', $dataLocation["LocationID"])->update($dataLocation);
|
||||||
|
|
||||||
// Insert address if available
|
// Insert address if available
|
||||||
if (!empty($dataLocationAddress)) {
|
if (!empty($dataLocationAddress)) {
|
||||||
$dataLocationAddress['LocationID'] = $LocationID;
|
$dataLocationAddress['LocationID'] = $input["LocationID"];
|
||||||
$this->db->table('locationaddress')->upsert($dataLocationAddress);
|
$this->db->table('locationaddress')->upsert($dataLocationAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +146,7 @@ class Location extends Controller {
|
|||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Location updated successfully',
|
'message' => 'Location updated successfully',
|
||||||
'data' => $LocationID,
|
'data' => $dataLocation,
|
||||||
], 201);
|
], 201);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -169,8 +158,10 @@ class Location extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($LocationID = null) {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
$LocationID = $input["LocationID"];
|
||||||
if (!$LocationID) {
|
if (!$LocationID) {
|
||||||
return $this->failValidationError('LocationID is required.');
|
return $this->failValidationError('LocationID is required.');
|
||||||
}
|
}
|
||||||
@ -181,7 +172,7 @@ class Location extends Controller {
|
|||||||
return $this->failNotFound("LocationID with {$LocationID} not found.");
|
return $this->failNotFound("LocationID with {$LocationID} not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->table('location')->where('LocationID', $LocationID)->update(['DelDate' => $this->now()]);
|
$this->db->table('location')->where('LocationID', $LocationID)->update(['DelDate' => NOW()]);
|
||||||
|
|
||||||
return $this->respondDeleted([
|
return $this->respondDeleted([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
@ -197,7 +188,7 @@ class Location extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prepareLocationData(array $input, string $now, string $mode = 'create'): array {
|
private function prepareLocationData(array $input): array {
|
||||||
$LinkTo = null;
|
$LinkTo = null;
|
||||||
if (!empty($input['LinkTo'])) {
|
if (!empty($input['LinkTo'])) {
|
||||||
$ids = array_column($input['LinkTo'], 'InternalPID');
|
$ids = array_column($input['LinkTo'], 'InternalPID');
|
||||||
@ -211,14 +202,12 @@ class Location extends Controller {
|
|||||||
"Description" => $input['Description'] ?? null,
|
"Description" => $input['Description'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($mode === 'create') {
|
if(!empty($input["LocationID"])) { $data["LocationID"] = $input["LocationID"]; }
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prepareLocationAddressData(array $input, string $now, string $mode = 'create'): array {
|
private function prepareLocationAddressData(array $input): array {
|
||||||
$data = [
|
$data = [
|
||||||
"LocationID" => $input['LocationID'] ?? null,
|
"LocationID" => $input['LocationID'] ?? null,
|
||||||
"Street1" => $input['Street1'] ?? null,
|
"Street1" => $input['Street1'] ?? null,
|
||||||
@ -230,10 +219,6 @@ class Location extends Controller {
|
|||||||
"GeoLocationData" => $input['GeoLocationData'] ?? null,
|
"GeoLocationData" => $input['GeoLocationData'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($mode === 'create') {
|
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,7 +10,14 @@ class Patient extends Controller {
|
|||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
$this->now = date('Y-m-d H:i:s');
|
$this->rulesPatient = [
|
||||||
|
'PatientID' => 'required|is_unique[patient.PatientID]|max_length[50]',
|
||||||
|
'AlternatePID' => 'permit_empty|max_length[50]',
|
||||||
|
'NameFirst' => 'required|min_length[1]|max_length[255]',
|
||||||
|
'EmailAddress1' => 'required|is_unique[patient.EmailAddress1]',
|
||||||
|
'Gender' => 'required'
|
||||||
|
];
|
||||||
|
$this->rulesPatIdt = ['Identifier' => 'required|is_unique[patidt.Identifier]'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK - Done
|
// OK - Done
|
||||||
@ -172,28 +179,21 @@ class Patient extends Controller {
|
|||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
// Prepare data
|
// Prepare data
|
||||||
$dataPatient = $this->preparePatientData($input, $now, 'create');
|
$dataPatient = $this->preparePatientData($input);
|
||||||
$dataPatidt = $this->preparePatidtData($input, $now, 'create');
|
$dataPatidt = $this->preparePatidtData($input);
|
||||||
$dataPatatt = $this->preparePatattData($input, $now, 'create');
|
$dataPatatt = $this->preparePatattData($input);
|
||||||
$dataPatcom = $this->preparePatcomData($input, $now, 'create');
|
$dataPatcom = $this->preparePatcomData($input);
|
||||||
|
|
||||||
// Validation rules
|
// Validation rules
|
||||||
$rulesPatient = [
|
//$rulesPatidt = ['Identifier' => 'required|is_unique[patidt.Identifier]'];
|
||||||
'PatientID' => 'required|is_unique[patient.PatientID]|max_length[50]',
|
|
||||||
'AlternatePID' => 'permit_empty|max_length[50]',
|
|
||||||
'NameFirst' => 'required|min_length[1]|max_length[255]',
|
|
||||||
'EmailAddress1' => 'required|is_unique[patient.EmailAddress1]',
|
|
||||||
'Gender' => 'required'
|
|
||||||
];
|
|
||||||
$rulesPatidt = ['Identifier' => 'required|is_unique[patidt.Identifier]'];
|
|
||||||
//$rulesPatatt = ['Address' => 'required|is_unique[patatt.Address]'];
|
//$rulesPatatt = ['Address' => 'required|is_unique[patatt.Address]'];
|
||||||
|
|
||||||
// Validate patient
|
// Validate patient
|
||||||
if (!$this->validateData($dataPatient, $rulesPatient)) {
|
if (!$this->validateData($dataPatient, $this->rulesPatient)) {
|
||||||
return $this->validationError('patient', $this->validator->getErrors());
|
return $this->validationError('patient', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
// Validate patidt
|
// Validate patidt
|
||||||
if (!$this->validateData($dataPatidt, $rulesPatidt)) {
|
if (!$this->validateData($dataPatidt, $this->rulesPatIdt)) {
|
||||||
return $this->validationError('patidt', $this->validator->getErrors());
|
return $this->validationError('patidt', $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
/* Validate patatt (if exists, validate only the first row)
|
/* Validate patatt (if exists, validate only the first row)
|
||||||
@ -205,7 +205,6 @@ class Patient extends Controller {
|
|||||||
|
|
||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
|
||||||
|
|
||||||
$this->db->table('patient')->insert($dataPatient);
|
$this->db->table('patient')->insert($dataPatient);
|
||||||
$newInternalPatientId = $this->db->insertID();
|
$newInternalPatientId = $this->db->insertID();
|
||||||
|
|
||||||
@ -213,7 +212,6 @@ class Patient extends Controller {
|
|||||||
$dataPatidt['InternalPID'] = $newInternalPatientId;
|
$dataPatidt['InternalPID'] = $newInternalPatientId;
|
||||||
$this->db->table('patidt')->insert($dataPatidt);
|
$this->db->table('patidt')->insert($dataPatidt);
|
||||||
|
|
||||||
|
|
||||||
if (!empty($dataPatatt)) {
|
if (!empty($dataPatatt)) {
|
||||||
foreach ($dataPatatt as &$row) {
|
foreach ($dataPatatt as &$row) {
|
||||||
$row['InternalPID'] = $newInternalPatientId;
|
$row['InternalPID'] = $newInternalPatientId;
|
||||||
@ -297,58 +295,43 @@ class Patient extends Controller {
|
|||||||
"LinkTo" => $LinkTo
|
"LinkTo" => $LinkTo
|
||||||
];
|
];
|
||||||
|
|
||||||
// Only set CreateDate when creating
|
if(!empty($input['InternalPID'])) { $data["InternalPID"] = $input["InternalPID"]; }
|
||||||
if ($mode === 'create') {
|
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function preparePatidtData(array $input, string $now, string $mode = 'create'): array {
|
private function preparePatidtData(array $input ): array {
|
||||||
$data = [
|
$data = [
|
||||||
"IdentifierType" => $input['Identity']['IdentifierType'] ?? null,
|
"IdentifierType" => $input['Identity']['IdentifierType'] ?? null,
|
||||||
"Identifier" => $input['Identity']['Identifier'] ?? null,
|
"Identifier" => $input['Identity']['Identifier'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($mode === 'create') {
|
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function preparePatattData(array $input, string $now, string $mode = 'create'): array {
|
private function preparePatattData(array $input): array {
|
||||||
if (empty($input['Attachments'])) {
|
if (empty($input['Attachments'])) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_map(function ($attachment) use ($now, $mode) {
|
return array_map(function ($attachment) {
|
||||||
$row = [
|
$row = [
|
||||||
"Address" => $attachment['Address'] ?? null,
|
"Address" => $attachment['Address'] ?? null,
|
||||||
];
|
];
|
||||||
if ($mode === 'create') {
|
|
||||||
$row["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
return $row;
|
return $row;
|
||||||
}, $input['Attachments']);
|
}, $input['Attachments']);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function preparePatcomData(array $input, string $now, string $mode = 'create'): array {
|
private function preparePatcomData(array $input): array {
|
||||||
$data = [
|
$data = [
|
||||||
"Comment" => $input['Comment'] ?? null,
|
"Comment" => $input['Comment'] ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($mode === 'create') {
|
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function validationError(string $context, array $errors)
|
private function validationError(string $context, array $errors) {
|
||||||
{
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
'message' => "Validation failed ({$context})",
|
'message' => "Validation failed ({$context})",
|
||||||
@ -356,39 +339,23 @@ class Patient extends Controller {
|
|||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function update() {
|
||||||
// OK - Done
|
|
||||||
public function update($InternalPID = null) {
|
|
||||||
try {
|
try {
|
||||||
$now = $this->now;
|
|
||||||
if (!$InternalPID || !is_numeric($InternalPID)) { return $this->respond(['status' => 'error', 'message' => 'Invalid or missing InternalPID'], 400); }
|
|
||||||
|
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
if (!$input) { return $this->respond(['status' => 'error', 'message' => 'Invalid JSON input'], 400); }
|
if (!$input) { return $this->respond(['status' => 'error', 'message' => 'Invalid JSON input'], 400); }
|
||||||
|
if (!$input["InternalPID"] || !is_numeric($input["InternalPID"])) { return $this->respond(['status' => 'error', 'message' => 'Invalid or missing InternalPID'], 400); }
|
||||||
|
|
||||||
|
$InternalPID = $input["InternalPID"];
|
||||||
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRowArray();
|
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRowArray();
|
||||||
if (!$patient) { return $this->respond(['status' => 'error', 'message' => 'Patient not found'], 404); }
|
if (!$patient) { return $this->respond(['status' => 'error', 'message' => 'Patient not found'], 404); }
|
||||||
|
|
||||||
$dataPatient = $this->preparePatientData($input, $now, 'update');
|
$dataPatient = $this->preparePatientData($input);
|
||||||
$dataPatidt = $this->preparePatidtData($input, $now, 'update');
|
$dataPatIdt = $this->preparePatidtData($input);
|
||||||
$dataPatcom = $this->preparePatcomData($input, $now, 'update');
|
$dataPatCom = $this->preparePatcomData($input);
|
||||||
$dataPatatt = $this->preparePatattData($input, $now, 'update');
|
$dataPatAtt = $this->preparePatattData($input);
|
||||||
|
|
||||||
// Atur aturan validasi dengan pengecualian is_unique untuk InternalPID ini
|
|
||||||
$rulesDataPatient = [
|
|
||||||
'PatientID' => "required|max_length[50]|is_unique[patient.PatientID,InternalPID,{$InternalPID}]",
|
|
||||||
'AlternatePID' => 'permit_empty|max_length[50]',
|
|
||||||
'NameFirst' => 'required|min_length[1]|max_length[255]',
|
|
||||||
'EmailAddress1' => "required|is_unique[patient.EmailAddress1,InternalPID,{$InternalPID}]",
|
|
||||||
'Gender' => 'required'
|
|
||||||
];
|
|
||||||
|
|
||||||
$rulesDataPatidt = [
|
|
||||||
'Identifier' => "required|is_unique[patidt.Identifier,InternalPID,{$InternalPID}]"
|
|
||||||
];
|
|
||||||
|
|
||||||
// Validasi
|
// Validasi
|
||||||
if (!$this->validateData($dataPatient, $rulesDataPatient)) {
|
if (!$this->validateData($dataPatient, $this->rulesPatient)) {
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
'message' => 'Validation failed (patient)',
|
'message' => 'Validation failed (patient)',
|
||||||
@ -396,7 +363,7 @@ class Patient extends Controller {
|
|||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->validateData($dataPatidt, $rulesDataPatidt)) {
|
if (!$this->validateData($dataPatIdt, $this->rulesPatIdt)) {
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'error',
|
'status' => 'error',
|
||||||
'message' => 'Validation failed (patidt)',
|
'message' => 'Validation failed (patidt)',
|
||||||
@ -413,19 +380,19 @@ class Patient extends Controller {
|
|||||||
return $this->failServerError('Update patient failed: ' . $dbError['message']);
|
return $this->failServerError('Update patient failed: ' . $dbError['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->table('patidt')->where('InternalPID', $InternalPID)->update($dataPatidt);
|
$this->db->table('patidt')->where('InternalPID', $InternalPID)->update($dataPatIdt);
|
||||||
$dbError = $this->db->error();
|
$dbError = $this->db->error();
|
||||||
if (!empty($dbError['message'])) {
|
if (!empty($dbError['message'])) {
|
||||||
$this->db->transRollback();
|
$this->db->transRollback();
|
||||||
return $this->failServerError('Update patidt failed: ' . $dbError['message']);
|
return $this->failServerError('Update patidt failed: ' . $dbError['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($dataPatatt)) {
|
if (!empty($dataPatAtt)) {
|
||||||
foreach ($dataPatatt as &$row) {
|
foreach ($dataPatAtt as &$row) {
|
||||||
$row['InternalPID'] = $InternalPID;
|
$row['InternalPID'] = $InternalPID;
|
||||||
}
|
}
|
||||||
$this->db->table('patatt')->upsertBatch($dataPatatt);
|
$this->db->table('patatt')->upsertBatch($dataPatAtt);
|
||||||
$addresses = array_column($dataPatatt, 'Address');
|
$addresses = array_column($dataPatAtt, 'Address');
|
||||||
$this->db->table('patatt')->where('InternalPID', $InternalPID)->WhereNotIn('Address', $addresses)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
$this->db->table('patatt')->where('InternalPID', $InternalPID)->WhereNotIn('Address', $addresses)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
||||||
} else {
|
} else {
|
||||||
$this->db->table('patatt')->where('InternalPID', $InternalPID)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
$this->db->table('patatt')->where('InternalPID', $InternalPID)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
||||||
@ -433,8 +400,7 @@ class Patient extends Controller {
|
|||||||
|
|
||||||
if(!empty($dataPatcom['Comment'])) {
|
if(!empty($dataPatcom['Comment'])) {
|
||||||
$dataPatcom['InternalPID'] = $InternalPID;
|
$dataPatcom['InternalPID'] = $InternalPID;
|
||||||
$dataPatcom['CreateDate'] = $this->now;
|
$this->db->table('patcom')->upsert($dataPatCom);
|
||||||
$this->db->table('patcom')->upsert($dataPatcom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
@ -447,7 +413,7 @@ class Patient extends Controller {
|
|||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Patient updated successfully',
|
'message' => 'Patient updated successfully',
|
||||||
'data' => $InternalPID
|
'data' => $dataPatient
|
||||||
], 200);
|
], 200);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -456,28 +422,23 @@ class Patient extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// OK - Done
|
public function delete() {
|
||||||
public function delete($InternalPID = null) {
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
$InternalPID = (int) $InternalPID;
|
$InternalPID = $input["InternalPID"];
|
||||||
|
|
||||||
if (!$InternalPID) {
|
if (!$InternalPID) {
|
||||||
return $this->failValidationError('Patient ID is required.');
|
return $this->failValidationError('Patient ID is required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cari data pasien
|
|
||||||
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRow();
|
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRow();
|
||||||
|
|
||||||
if (!$patient) {
|
if (!$patient) {
|
||||||
return $this->failNotFound("Patient ID with {$InternalPID} not found.");
|
return $this->failNotFound("Patient ID with {$InternalPID} not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update kolom DelDate sebagai soft delete
|
|
||||||
$this->db->table('patient')->where('InternalPID', $InternalPID)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
$this->db->table('patient')->where('InternalPID', $InternalPID)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
||||||
|
|
||||||
// Mengembalikan 200
|
|
||||||
return $this->respondDeleted([
|
return $this->respondDeleted([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => "Patient ID with {$InternalPID} deleted successfully."
|
'message' => "Patient ID with {$InternalPID} deleted successfully."
|
||||||
@ -490,9 +451,7 @@ class Patient extends Controller {
|
|||||||
|
|
||||||
// OK - Done
|
// OK - Done
|
||||||
public function patientCheck() {
|
public function patientCheck() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$PatientID = $this->request->getVar('PatientID');
|
$PatientID = $this->request->getVar('PatientID');
|
||||||
$EmailAddress1 = $this->request->getVar('EmailAddress1');
|
$EmailAddress1 = $this->request->getVar('EmailAddress1');
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,7 @@ class ValueSet extends Controller {
|
|||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
$this->now = date('Y-m-d H:i:s');
|
$this->rulesValueSet = [
|
||||||
$this->rules = [
|
|
||||||
'VSet' => 'required',
|
'VSet' => 'required',
|
||||||
'VValue' => 'required',
|
'VValue' => 'required',
|
||||||
];
|
];
|
||||||
@ -61,12 +60,10 @@ class ValueSet extends Controller {
|
|||||||
public function create() {
|
public function create() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
|
|
||||||
// Prepare data
|
$dataValueSet = $this->prepareDataValueSet($input);
|
||||||
$data = $this->prepareData($input, $now, 'create');
|
|
||||||
|
|
||||||
if (!$this->validateData($data, $this->rules)) {
|
if (!$this->validateData($data, $this->rulesValueSet)) {
|
||||||
return $this->failValidationErrors($this->validator->getErrors());
|
return $this->failValidationErrors($this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +86,7 @@ class ValueSet extends Controller {
|
|||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Data created successfully',
|
'message' => 'Data created successfully',
|
||||||
'data' => $data,
|
'data' => $dataValueSet,
|
||||||
], 201);
|
], 201);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -101,14 +98,17 @@ class ValueSet extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($VID = null) {
|
public function update() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$now = $this->now;
|
$VID = $input["VID"];
|
||||||
|
if (!$VID) {
|
||||||
|
return $this->failValidationErrors('VID is required.');
|
||||||
|
}
|
||||||
|
|
||||||
$data = $this->prepareData($input, $now, 'update');
|
$dataValueSet = $this->prepareValueSetData($input);
|
||||||
|
|
||||||
if (!$this->validateData($data, $this->rules)) {
|
if (!$this->validateData($dataValueSet, $this->rulesValueSet)) {
|
||||||
return $this->failValidationErrors( $this->validator->getErrors() );
|
return $this->failValidationErrors( $this->validator->getErrors() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class ValueSet extends Controller {
|
|||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
|
||||||
// Insert location
|
// Insert location
|
||||||
$this->db->table('valueset')->where('VID', $VID)->update($data);
|
$this->db->table('valueset')->where('VID', $VID)->update($dataValueSet);
|
||||||
|
|
||||||
// Complete transaction
|
// Complete transaction
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
@ -131,7 +131,7 @@ class ValueSet extends Controller {
|
|||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Data updated successfully',
|
'message' => 'Data updated successfully',
|
||||||
'data' => $data,
|
'data' => $dataValueSet,
|
||||||
], 201);
|
], 201);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -143,8 +143,10 @@ class ValueSet extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($VID = null) {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
$VID = $input["VID"];
|
||||||
if (!$VID) {
|
if (!$VID) {
|
||||||
return $this->failValidationErrors('VID is required.');
|
return $this->failValidationErrors('VID is required.');
|
||||||
}
|
}
|
||||||
@ -170,7 +172,7 @@ class ValueSet extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function prepareData(array $input, string $now, string $mode = 'create'): array {
|
private function prepareValueSetData(array $input): array {
|
||||||
$data = [
|
$data = [
|
||||||
"VSet" => $input['VSet'] ?? null,
|
"VSet" => $input['VSet'] ?? null,
|
||||||
"VOrder" => $input['VOrder'] ?? null,
|
"VOrder" => $input['VOrder'] ?? null,
|
||||||
@ -179,9 +181,7 @@ class ValueSet extends Controller {
|
|||||||
"VCategory" => $input['VCategory'] ?? null
|
"VCategory" => $input['VCategory'] ?? null
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($mode === 'create') {
|
if(!empty($input["VID"])) { $data["VID"]=$input["VID"]; }
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,7 @@ class ValueSetField extends Controller {
|
|||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
$this->now = date('Y-m-d H:i:s');
|
$this->rulesValueSetFld = [
|
||||||
$this->rules = [
|
|
||||||
'VSet' => 'required',
|
'VSet' => 'required',
|
||||||
'VSName' => 'required',
|
'VSName' => 'required',
|
||||||
'VSDesc' => 'required'
|
'VSDesc' => 'required'
|
||||||
@ -62,21 +61,14 @@ class ValueSetField extends Controller {
|
|||||||
public function create() {
|
public function create() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$now = date('Y-m-d H:i:s');
|
$dataValueSetFld = $this->prepareData($input);
|
||||||
|
|
||||||
$data = $this->prepareData($input, $now, 'create');
|
if (!$this->validateData($dataValueSetFld, $this->rulesValueSetFld)) {
|
||||||
|
|
||||||
if (!$this->validateData($data, $this->rules)) {
|
|
||||||
return $this->failValidationErrors($this->validator->getErrors());
|
return $this->failValidationErrors($this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start transaction
|
|
||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
$this->db->table('valuesetfld')->insert($dataValueSetFld);
|
||||||
// Insert
|
|
||||||
$this->db->table('valuesetfld')->insert($data);
|
|
||||||
|
|
||||||
// Complete transaction
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
|
|
||||||
if ($this->db->transStatus() === false) {
|
if ($this->db->transStatus() === false) {
|
||||||
@ -89,7 +81,7 @@ class ValueSetField extends Controller {
|
|||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Data created successfully',
|
'message' => 'Data created successfully',
|
||||||
'data' => $data,
|
'data' => $dataValueSetFld,
|
||||||
], 201);
|
], 201);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -101,24 +93,21 @@ class ValueSetField extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($VSFldID = null) {
|
public function update() {
|
||||||
try {
|
try {
|
||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$now = $this->now;
|
$VSFldID = $input["VSFldID"];
|
||||||
|
if (!$VSFldID) {
|
||||||
|
return $this->failValidationErrors('VSFldID is required.');
|
||||||
|
}
|
||||||
|
$dataValueSetFld = $this->prepareData($input);
|
||||||
|
|
||||||
$data = $this->prepareData($input, $now, 'update');
|
if (!$this->validateData($data, $this->rulesValueSetFld)) {
|
||||||
|
|
||||||
if (!$this->validateData($data, $this->rules)) {
|
|
||||||
return $this->failValidationErrors( $this->validator->getErrors());
|
return $this->failValidationErrors( $this->validator->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start transaction
|
|
||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
|
||||||
// Insert location
|
|
||||||
$this->db->table('valuesetfld')->where('VSFldID', $VSFldID)->update($data);
|
$this->db->table('valuesetfld')->where('VSFldID', $VSFldID)->update($data);
|
||||||
|
|
||||||
// Complete transaction
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
|
|
||||||
if ($this->db->transStatus() === false) {
|
if ($this->db->transStatus() === false) {
|
||||||
@ -131,7 +120,7 @@ class ValueSetField extends Controller {
|
|||||||
return $this->respondCreated([
|
return $this->respondCreated([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Data updated successfully',
|
'message' => 'Data updated successfully',
|
||||||
'data' => $data,
|
'data' => $dataValueSetFld,
|
||||||
], 201);
|
], 201);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -143,8 +132,10 @@ class ValueSetField extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($VSFldID = null) {
|
public function delete() {
|
||||||
try {
|
try {
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
$VSFldID = $input["VSFldID"];
|
||||||
if (!$VSFldID) {
|
if (!$VSFldID) {
|
||||||
return $this->failValidationErrors('VSFldID is required.');
|
return $this->failValidationErrors('VSFldID is required.');
|
||||||
}
|
}
|
||||||
@ -177,10 +168,6 @@ class ValueSetField extends Controller {
|
|||||||
"VSDesc" => $input['VSDesc'] ?? null
|
"VSDesc" => $input['VSDesc'] ?? null
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($mode === 'create') {
|
|
||||||
$data["CreateDate"] = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,9 +13,9 @@ class CreatePatMasterTables extends Migration {
|
|||||||
'IntCountryID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
'IntCountryID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||||
'CountryID' => ['type' => 'VARCHAR', 'constraint' => 10],
|
'CountryID' => ['type' => 'VARCHAR', 'constraint' => 10],
|
||||||
'Country' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Country' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('IntCountryID', true);
|
$this->forge->addKey('IntCountryID', true);
|
||||||
$this->forge->addUniqueKey('CountryID');
|
$this->forge->addUniqueKey('CountryID');
|
||||||
$this->forge->createTable('country');
|
$this->forge->createTable('country');
|
||||||
@ -26,9 +26,9 @@ class CreatePatMasterTables extends Migration {
|
|||||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'EthnicID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
'EthnicID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||||
'Ethnic' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Ethnic' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('EthnicID', true);
|
$this->forge->addKey('EthnicID', true);
|
||||||
$this->forge->createTable('ethnic');
|
$this->forge->createTable('ethnic');
|
||||||
|
|
||||||
@ -38,9 +38,9 @@ class CreatePatMasterTables extends Migration {
|
|||||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'RaceID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
'RaceID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||||
'Race' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Race' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('RaceID', true);
|
$this->forge->addKey('RaceID', true);
|
||||||
$this->forge->createTable('race');
|
$this->forge->createTable('race');
|
||||||
|
|
||||||
@ -50,9 +50,9 @@ class CreatePatMasterTables extends Migration {
|
|||||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'ReligionID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
'ReligionID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||||
'Religion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Religion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('ReligionID', true);
|
$this->forge->addKey('ReligionID', true);
|
||||||
$this->forge->createTable('religion');
|
$this->forge->createTable('religion');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,9 @@ class CreatePatientRegTables extends Migration {
|
|||||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'Address' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Address' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PatAttID', true);
|
$this->forge->addKey('PatAttID', true);
|
||||||
$this->forge->addUniqueKey('Address');
|
$this->forge->addUniqueKey('Address');
|
||||||
$this->forge->createTable('patatt');
|
$this->forge->createTable('patatt');
|
||||||
@ -24,9 +24,9 @@ class CreatePatientRegTables extends Migration {
|
|||||||
'PatComID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
'PatComID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'Comment' => ['type' => 'TEXT', 'null' => true],
|
'Comment' => ['type' => 'TEXT', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PatComID', true);
|
$this->forge->addKey('PatComID', true);
|
||||||
$this->forge->addUniqueKey('InternalPID');
|
$this->forge->addUniqueKey('InternalPID');
|
||||||
$this->forge->createTable('patcom');
|
$this->forge->createTable('patcom');
|
||||||
@ -39,9 +39,9 @@ class CreatePatientRegTables extends Migration {
|
|||||||
'Identifier' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Identifier' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'EffectiveDate' => ['type' => 'DATETIME', 'null' => true],
|
'EffectiveDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ExpirationDate'=> ['type' => 'DATETIME', 'null' => true],
|
'ExpirationDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PatIdtID', true);
|
$this->forge->addKey('PatIdtID', true);
|
||||||
$this->forge->createTable('patidt');
|
$this->forge->createTable('patidt');
|
||||||
|
|
||||||
@ -81,9 +81,9 @@ class CreatePatientRegTables extends Migration {
|
|||||||
'DeathIndicator'=> ['type' => 'BIT', 'constraint' => 1, 'null' => true],
|
'DeathIndicator'=> ['type' => 'BIT', 'constraint' => 1, 'null' => true],
|
||||||
'DeathDateTime' => ['type' => 'DATETIME', 'null' => true],
|
'DeathDateTime' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('InternalPID', true);
|
$this->forge->addKey('InternalPID', true);
|
||||||
$this->forge->addUniqueKey('PatientID');
|
$this->forge->addUniqueKey('PatientID');
|
||||||
$this->forge->addUniqueKey('AlternatePID');
|
$this->forge->addUniqueKey('AlternatePID');
|
||||||
@ -109,8 +109,8 @@ class CreatePatientRegTables extends Migration {
|
|||||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('LogDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PatRegLogID', true);
|
$this->forge->addKey('PatRegLogID', true);
|
||||||
$this->forge->createTable('patreglog');
|
$this->forge->createTable('patreglog');
|
||||||
|
|
||||||
@ -118,9 +118,9 @@ class CreatePatientRegTables extends Migration {
|
|||||||
$this->forge->addField([
|
$this->forge->addField([
|
||||||
'PatRelID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
'PatRelID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PatRelID', true);
|
$this->forge->addKey('PatRelID', true);
|
||||||
$this->forge->createTable('patrelation');
|
$this->forge->createTable('patrelation');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,11 +13,11 @@ class CreatePVTables extends Migration {
|
|||||||
'PVID' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true],
|
'PVID' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true],
|
||||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'Episode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Episode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('InternalPVID', true);
|
$this->forge->addKey('InternalPVID', true);
|
||||||
$this->forge->createTable('patvisit');
|
$this->forge->createTable('patvisit');
|
||||||
|
|
||||||
@ -27,11 +27,11 @@ class CreatePVTables extends Migration {
|
|||||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'Diagnosis' => ['type' => 'TEXT', 'null' => true],
|
'Diagnosis' => ['type' => 'TEXT', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ArchivedDate' => ['type' => 'DATETIME', 'null' => true],
|
'ArchivedDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('InternalPVID', true);
|
$this->forge->addKey('InternalPVID', true);
|
||||||
$this->forge->createTable('patdiag');
|
$this->forge->createTable('patdiag');
|
||||||
|
|
||||||
@ -45,11 +45,11 @@ class CreatePVTables extends Migration {
|
|||||||
'ReffDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'ReffDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PVADTID', true);
|
$this->forge->addKey('PVADTID', true);
|
||||||
$this->forge->createTable('patvisitadt');
|
$this->forge->createTable('patvisitadt');
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ class CreatePVTables extends Migration {
|
|||||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('LogDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('PatVisLogID', true);
|
$this->forge->addKey('PatVisLogID', true);
|
||||||
$this->forge->createTable('patvisitlog');
|
$this->forge->createTable('patvisitlog');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,9 +14,9 @@ class CreateLocationTable extends Migration {
|
|||||||
'Parent' => ['type' => 'INT', 'null' => true],
|
'Parent' => ['type' => 'INT', 'null' => true],
|
||||||
'LocFull' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
'LocFull' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||||
'Description' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
'Description' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('LocationID', true);
|
$this->forge->addKey('LocationID', true);
|
||||||
$this->forge->createTable('location');
|
$this->forge->createTable('location');
|
||||||
|
|
||||||
@ -29,9 +29,9 @@ class CreateLocationTable extends Migration {
|
|||||||
'PostCode' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
'PostCode' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||||
'GeoLocationSystem' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
'GeoLocationSystem' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||||
'GeoLocationData' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
'GeoLocationData' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('LocationID', true);
|
$this->forge->addKey('LocationID', true);
|
||||||
$this->forge->createTable('locationaddress');
|
$this->forge->createTable('locationaddress');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,8 @@ class DoctorMaster extends Migration
|
|||||||
'AbbTex' => [ 'type' => 'VARCHAR', 'constraint' => 5, 'null' => true ],
|
'AbbTex' => [ 'type' => 'VARCHAR', 'constraint' => 5, 'null' => true ],
|
||||||
'FullText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
'FullText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
||||||
'Description' => [ 'type' => 'TEXT', 'null' => true ],
|
'Description' => [ 'type' => 'TEXT', 'null' => true ],
|
||||||
'CreateDate' => [ 'type' => 'DATETIME'],
|
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('OccupationID', true);
|
$this->forge->addKey('OccupationID', true);
|
||||||
$this->forge->createTable('Occupation');
|
$this->forge->createTable('Occupation');
|
||||||
|
|
||||||
@ -34,9 +34,9 @@ class DoctorMaster extends Migration
|
|||||||
'MobilePhone2' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
'MobilePhone2' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
||||||
'Specialty' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
'Specialty' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
||||||
'SubSpecialty' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
'SubSpecialty' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
||||||
'CreateDate' => [ 'type' => 'DATETIME'],
|
|
||||||
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('ContactID', true);
|
$this->forge->addKey('ContactID', true);
|
||||||
$this->forge->createTable('Contact');
|
$this->forge->createTable('Contact');
|
||||||
|
|
||||||
@ -64,8 +64,8 @@ class DoctorMaster extends Migration
|
|||||||
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
||||||
'Facilitator' => [ 'type' => 'VARCHAR', 'constraint' => 150, 'null' => true ],
|
'Facilitator' => [ 'type' => 'VARCHAR', 'constraint' => 150, 'null' => true ],
|
||||||
'CertificateLocation'=> [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
'CertificateLocation'=> [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
||||||
'CreateDate' => [ 'type' => 'DATETIME'],
|
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
// $this->forge->addKey('ContactID', true);
|
// $this->forge->addKey('ContactID', true);
|
||||||
$this->forge->createTable('ContactTraining');
|
$this->forge->createTable('ContactTraining');
|
||||||
|
|
||||||
@ -75,9 +75,9 @@ class DoctorMaster extends Migration
|
|||||||
'SpecialtyText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
'SpecialtyText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
||||||
'Parent' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
'Parent' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
||||||
'Title' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
'Title' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
||||||
'CreateDate' => [ 'type' => 'DATETIME'],
|
|
||||||
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
'EndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('SpecialtyID', true);
|
$this->forge->addKey('SpecialtyID', true);
|
||||||
$this->forge->createTable('MedicalSpecialty');
|
$this->forge->createTable('MedicalSpecialty');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,11 +18,11 @@ class CreateOrdersTable extends Migration {
|
|||||||
'Priority' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true],
|
'Priority' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true],
|
||||||
'TrnDate' => ['type' => 'Datetime', 'null' => true],
|
'TrnDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'EffDate' => ['type' => 'Datetime', 'null' => true],
|
'EffDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('InternalOID', true);
|
$this->forge->addKey('InternalOID', true);
|
||||||
$this->forge->addUniqueKey('OrderID');
|
$this->forge->addUniqueKey('OrderID');
|
||||||
$this->forge->createTable('ordertest');
|
$this->forge->createTable('ordertest');
|
||||||
@ -32,11 +32,11 @@ class CreateOrdersTable extends Migration {
|
|||||||
'OrderComID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
'OrderComID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||||
'Comment' => ['type' => 'text', 'null' => true],
|
'Comment' => ['type' => 'text', 'null' => true],
|
||||||
'UserID' => ['type' => 'INT', 'null' => false],
|
'UserID' => ['type' => 'INT', 'null' => false],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('OrderComID', true);
|
$this->forge->addKey('OrderComID', true);
|
||||||
$this->forge->createTable('ordercom');
|
$this->forge->createTable('ordercom');
|
||||||
|
|
||||||
@ -45,11 +45,11 @@ class CreateOrdersTable extends Migration {
|
|||||||
'OrderAttID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
'OrderAttID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||||
'Address' => ['type' => 'varchar', 'constraint'=>255, 'null' => true],
|
'Address' => ['type' => 'varchar', 'constraint'=>255, 'null' => true],
|
||||||
'UserID' => ['type' => 'INT', 'null' => false],
|
'UserID' => ['type' => 'INT', 'null' => false],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('OrderAttID', true);
|
$this->forge->addKey('OrderAttID', true);
|
||||||
$this->forge->createTable('orderatt');
|
$this->forge->createTable('orderatt');
|
||||||
|
|
||||||
@ -57,11 +57,11 @@ class CreateOrdersTable extends Migration {
|
|||||||
'InternalOID' => ['type' => 'INT', 'null' => false],
|
'InternalOID' => ['type' => 'INT', 'null' => false],
|
||||||
'OrderStatID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
'OrderStatID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||||
'OrderStatus' => ['type' => 'varchar', 'constraint'=>2, 'null' => false],
|
'OrderStatus' => ['type' => 'varchar', 'constraint'=>2, 'null' => false],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
'ArchiveDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
'DelDate' => ['type' => 'Datetime', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('OrderStatID', true);
|
$this->forge->addKey('OrderStatID', true);
|
||||||
$this->forge->createTable('orderstatus');
|
$this->forge->createTable('orderstatus');
|
||||||
|
|
||||||
|
|||||||
@ -15,9 +15,9 @@ class CreateValueSetTable extends Migration {
|
|||||||
'VValue' => ['type' => 'varchar', 'constraint' => 10],
|
'VValue' => ['type' => 'varchar', 'constraint' => 10],
|
||||||
'VDesc' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
'VDesc' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
||||||
'VCategory' => ['type' => 'int', 'null' => true],
|
'VCategory' => ['type' => 'int', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('VID', true);
|
$this->forge->addKey('VID', true);
|
||||||
$this->forge->createTable('valueset');
|
$this->forge->createTable('valueset');
|
||||||
|
|
||||||
@ -27,9 +27,9 @@ class CreateValueSetTable extends Migration {
|
|||||||
'VSet' => ['type' => 'INT', 'null' => false],
|
'VSet' => ['type' => 'INT', 'null' => false],
|
||||||
'VSName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
'VSName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
||||||
'VSDesc' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
'VSDesc' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
||||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
||||||
]);
|
]);
|
||||||
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
||||||
$this->forge->addKey('VSFldID', true);
|
$this->forge->addKey('VSFldID', true);
|
||||||
$this->forge->createTable('valuesetfld');
|
$this->forge->createTable('valuesetfld');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user