Merge branch 'main' of https://github.com/mahdahar/clqms-be
This commit is contained in:
commit
de3c1d28ea
@ -183,7 +183,6 @@ class Patient extends Controller {
|
||||
'AlternatePID' => 'permit_empty|max_length[50]',
|
||||
'NameFirst' => 'required|min_length[1]|max_length[255]',
|
||||
'EmailAddress1' => 'required|is_unique[patient.EmailAddress1]',
|
||||
'DeathIndicator' => 'required',
|
||||
'Gender' => 'required'
|
||||
];
|
||||
$rulesPatidt = ['Identifier' => 'required|is_unique[patidt.Identifier]'];
|
||||
|
||||
586
app/Controllers/Patient_Admission.php
Normal file
586
app/Controllers/Patient_Admission.php
Normal file
@ -0,0 +1,586 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class Patient_Admission extends Controller {
|
||||
use ResponseTrait;
|
||||
|
||||
public function __construct() {
|
||||
$this->db = \Config\Database::connect();
|
||||
$this->now = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
// OK - Done
|
||||
public function index() {
|
||||
try {
|
||||
$InternalPID = $this->request->getVar('InternalPID');
|
||||
$PatientID = $this->request->getVar('PatientID');
|
||||
$Name = $this->request->getVar('Name');
|
||||
$Birthdate = $this->request->getVar('Birthdate');
|
||||
$qname = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))";
|
||||
$builder = $this->db->table('patient');
|
||||
$builder->select("InternalPID, PatientID, $qname as FullName, Gender, Birthdate, EmailAddress1 as Email, MobilePhone");
|
||||
if ($Name !== null) {
|
||||
$sql = $qname;
|
||||
$rawSql = new RawSql($sql);
|
||||
$builder->like($rawSql, $Name, 'both');
|
||||
}
|
||||
if ($InternalPID !== null) { $builder->where('InternalPID', $InternalPID); }
|
||||
if ($PatientID !== null) { $builder->like('PatientID', $PatientID, 'both'); }
|
||||
if ($Birthdate !== null) { $builder->where('Birthdate', $Birthdate); }
|
||||
|
||||
$filteredPatients = $builder->get()->getResultArray();
|
||||
|
||||
// Data pasien tidak ada mengembalikan - success 200
|
||||
if (empty($filteredPatients)) {
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => 'No patient records found matching the criteria.',
|
||||
'data' => []
|
||||
], 200);
|
||||
}
|
||||
|
||||
// Data pasien ditemukan dan mengembalikan - success 200
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Patients fetched successfully",
|
||||
'data' => $filteredPatients,
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// Error Server Mengembalikan 500
|
||||
return $this->failServerError('Something went wrong.'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function show($InternalPID = null) {
|
||||
try {
|
||||
$rows = $this->db->table('patient')
|
||||
->select("
|
||||
patient.*,
|
||||
country.Country as CountryName,
|
||||
race.Race as RaceName,
|
||||
religion.Religion as ReligionName,
|
||||
ethnic.Ethnic as EthnicName,
|
||||
patcom.Comment as Comment,
|
||||
patidt.IdentifierType,
|
||||
patidt.Identifier,
|
||||
patatt.Address
|
||||
")
|
||||
->join('country', 'country.IntCountryID = patient.IntCountryID', 'left')
|
||||
->join('race', 'race.RaceID = patient.RaceID', 'left')
|
||||
->join('religion', 'religion.ReligionID = patient.ReligionID', 'left')
|
||||
->join('ethnic', 'ethnic.EthnicID = patient.EthnicID', 'left')
|
||||
->join('patcom', 'patcom.InternalPID = patient.InternalPID', 'left')
|
||||
->join('patidt', 'patidt.InternalPID = patient.InternalPID', 'left')
|
||||
->join('patatt', 'patatt.InternalPID = patient.InternalPID and patatt.DelDate is null', 'left')
|
||||
->where('patient.InternalPID', (int) $InternalPID)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (empty($rows)) {
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => "Patient with ID {$InternalPID} not found.",
|
||||
'data' => [],
|
||||
], 200);
|
||||
}
|
||||
|
||||
// Use first row as base patient data
|
||||
$patient = $rows[0];
|
||||
|
||||
$patient = $this->transformPatientData($patient);
|
||||
|
||||
$patient['Identity'] = null;
|
||||
$patient['Attachments'] = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if ($row['IdentifierType'] && $row['Identifier'] && !$patient['Identity']) {
|
||||
$patient['Identity'] = [
|
||||
'IdentifierType' => $row['IdentifierType'],
|
||||
'Identifier' => $row['Identifier'],
|
||||
];
|
||||
}
|
||||
if ($row['Address']) {
|
||||
$patient['Attachments'][] = ['Address' => $row['Address']];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($patient['Identity'])) { $patient['Identity'] = null; }
|
||||
if (empty($patient['Attachments'])) { $patient['Attachments'] = null; }
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => "Patient Show Successfully",
|
||||
'data' => $patient,
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function transformPatientData(array $patient): array {
|
||||
$patient["Age"] = $this->calculateAgeFromBirthdate($patient["Birthdate"]);
|
||||
$patient["Birthdate"] = $this->formatedDate($patient["Birthdate"]);
|
||||
$patient["CreateDate"] = $this->formatedDate($patient["CreateDate"]);
|
||||
$patient["DelDate"] = $this->formatedDate($patient["DelDate"]);
|
||||
$patient["DeathDateTime"] = $this->formatedDate($patient["DeathDateTime"]);
|
||||
$patient["BirthdateConversion"] = $this->formatedDateForDisplay($patient["Birthdate"]);
|
||||
|
||||
$patient["LinkTo"] = $this->getLinkedPatients($patient['LinkTo']);
|
||||
$patient["Custodian"] = $this->getCustodian($patient['Custodian']);
|
||||
|
||||
return $patient;
|
||||
}
|
||||
|
||||
private function getLinkedPatients(?string $linkTo): ?array {
|
||||
if (empty($linkTo)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$ids = array_filter(explode(',', $linkTo));
|
||||
|
||||
return $this->db->table('patient')
|
||||
->select('InternalPID, PatientID')
|
||||
->whereIn('InternalPID', $ids)
|
||||
->get()
|
||||
->getResultArray() ?: null;
|
||||
}
|
||||
|
||||
private function getCustodian($custodianId): ?array {
|
||||
if (empty($custodianId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->db->table('patient')
|
||||
->select('InternalPID, PatientID')
|
||||
->where('InternalPID', (int) $custodianId)
|
||||
->get()
|
||||
->getRowArray() ?: null;
|
||||
}
|
||||
|
||||
|
||||
public function create() {
|
||||
try {
|
||||
$input = $this->request->getJSON(true);
|
||||
$now = date('Y-m-d H:i:s');
|
||||
|
||||
// Prepare data
|
||||
$dataPatient = $this->preparePatientData($input, $now, 'create');
|
||||
$dataPatidt = $this->preparePatidtData($input, $now, 'create');
|
||||
$dataPatatt = $this->preparePatattData($input, $now, 'create');
|
||||
$dataPatcom = $this->preparePatcomData($input, $now, 'create');
|
||||
|
||||
// Validation rules
|
||||
$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'
|
||||
];
|
||||
$rulesPatidt = ['Identifier' => 'required|is_unique[patidt.Identifier]'];
|
||||
//$rulesPatatt = ['Address' => 'required|is_unique[patatt.Address]'];
|
||||
|
||||
// Validate patient
|
||||
if (!$this->validateData($dataPatient, $rulesPatient)) {
|
||||
return $this->validationError('patient', $this->validator->getErrors());
|
||||
}
|
||||
// Validate patidt
|
||||
if (!$this->validateData($dataPatidt, $rulesPatidt)) {
|
||||
return $this->validationError('patidt', $this->validator->getErrors());
|
||||
}
|
||||
/* Validate patatt (if exists, validate only the first row)
|
||||
if (!empty($dataPatatt) && !$this->validateData($dataPatatt[0], $rulesPatatt)) {
|
||||
return $this->validationError('patatt', $this->validator->getErrors());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
|
||||
$this->db->table('patient')->insert($dataPatient);
|
||||
$newInternalPatientId = $this->db->insertID();
|
||||
|
||||
|
||||
$dataPatidt['InternalPID'] = $newInternalPatientId;
|
||||
$this->db->table('patidt')->insert($dataPatidt);
|
||||
|
||||
|
||||
if (!empty($dataPatatt)) {
|
||||
foreach ($dataPatatt as &$row) {
|
||||
$row['InternalPID'] = $newInternalPatientId;
|
||||
}
|
||||
$this->db->table('patatt')->upsertBatch($dataPatatt);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($dataPatcom['Comment'])) {
|
||||
$dataPatcom['InternalPID'] = $newInternalPatientId;
|
||||
$this->db->table('patcom')->insert($dataPatcom);
|
||||
}
|
||||
|
||||
$dbError = $this->db->error();
|
||||
if (!empty($dbError['message'])) {
|
||||
$this->db->transRollback();
|
||||
return $this->failServerError('Insert patient failed: ' . $dbError['message']);
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
if ($this->db->transStatus() === false) {
|
||||
$dbError = $this->db->error();
|
||||
return $this->failServerError(
|
||||
'Failed to create patient data (transaction rolled back): ' . ($dbError['message'] ?? 'Unknown database error')
|
||||
);
|
||||
}
|
||||
|
||||
return $this->respondCreated([
|
||||
'status' => 'success',
|
||||
'message' => 'Patient created successfully',
|
||||
'data' => $newInternalPatientId
|
||||
], 201);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->db->transRollback();
|
||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private function preparePatientData(array $input, string $now, string $mode = 'create'): array {
|
||||
$LinkTo = null;
|
||||
if (!empty($input['LinkTo'])) {
|
||||
$ids = array_column($input['LinkTo'], 'InternalPID');
|
||||
$LinkTo = implode(',', $ids);
|
||||
}
|
||||
|
||||
$data = [
|
||||
"PatientID" => $input['PatientID'] ?? null,
|
||||
"AlternatePID" => $input['AlternatePID'] ?? null,
|
||||
"Prefix" => $input['Prefix'] ?? null,
|
||||
"NameFirst" => $input['NameFirst'] ?? null,
|
||||
"NameMiddle" => $input['NameMiddle'] ?? null,
|
||||
"NameMaiden" => $input['NameMaiden'] ?? null,
|
||||
"NameLast" => $input['NameLast'] ?? null,
|
||||
"Suffix" => $input['Suffix'] ?? null,
|
||||
"NameAlias" => $input['NameAlias'] ?? null,
|
||||
"Gender" => !empty($input['Gender']) ? (int)$input['Gender'] : null,
|
||||
"PlaceOfBirth" => $input['PlaceOfBirth'] ?? null,
|
||||
"Birthdate" => $input['Birthdate'] ?? null,
|
||||
"Street_1" => $input['Street_1'] ?? null,
|
||||
"Street_2" => $input['Street_2'] ?? null,
|
||||
"Street_3" => $input['Street_3'] ?? null,
|
||||
"City" => $input['City'] ?? null,
|
||||
"Province" => $input['Province'] ?? null,
|
||||
"ZIP" => $input['ZIP'] ?? null,
|
||||
"EmailAddress1" => $input['EmailAddress1'] ?? null,
|
||||
"EmailAddress2" => $input['EmailAddress2'] ?? null,
|
||||
"Phone" => $input['Phone'] ?? null,
|
||||
"MobilePhone" => $input['MobilePhone'] ?? null,
|
||||
"RaceID" => isset($input['RaceID']) ? (int)$input['RaceID'] : null,
|
||||
"IntCountryID" => isset($input['IntCountryID']) ? (int)$input['IntCountryID'] : null,
|
||||
"MaritalStatus" => $input['MaritalStatus'] ?? null,
|
||||
"ReligionID" => isset($input['ReligionID']) ? (int)$input['ReligionID'] : null,
|
||||
"EthnicID" => isset($input['EthnicID']) ? (int)$input['EthnicID'] : null,
|
||||
"Citizenship" => $input['Citizenship'] ?? null,
|
||||
"DeathIndicator" => isset($input['DeathIndicator']) ? (int)$input['DeathIndicator'] : null,
|
||||
"DeathDateTime" => $input['DeathDateTime'] ?? null,
|
||||
"Custodian" => isset($input['Custodian']) ? (int)$input['Custodian'] : null,
|
||||
"DelDate" => null,
|
||||
"LinkTo" => $LinkTo
|
||||
];
|
||||
|
||||
// Only set CreateDate when creating
|
||||
if ($mode === 'create') {
|
||||
$data["CreateDate"] = $now;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function preparePatidtData(array $input, string $now, string $mode = 'create'): array {
|
||||
$data = [
|
||||
"IdentifierType" => $input['Identity']['IdentifierType'] ?? null,
|
||||
"Identifier" => $input['Identity']['Identifier'] ?? null,
|
||||
];
|
||||
|
||||
if ($mode === 'create') {
|
||||
$data["CreateDate"] = $now;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function preparePatattData(array $input, string $now, string $mode = 'create'): array {
|
||||
if (empty($input['Attachments'])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(function ($attachment) use ($now, $mode) {
|
||||
$row = [
|
||||
"Address" => $attachment['Address'] ?? null,
|
||||
];
|
||||
if ($mode === 'create') {
|
||||
$row["CreateDate"] = $now;
|
||||
}
|
||||
return $row;
|
||||
}, $input['Attachments']);
|
||||
}
|
||||
|
||||
private function preparePatcomData(array $input, string $now, string $mode = 'create'): array {
|
||||
$data = [
|
||||
"Comment" => $input['Comment'] ?? null,
|
||||
];
|
||||
|
||||
if ($mode === 'create') {
|
||||
$data["CreateDate"] = $now;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function validationError(string $context, array $errors)
|
||||
{
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'message' => "Validation failed ({$context})",
|
||||
'errors' => $errors
|
||||
], 400);
|
||||
}
|
||||
|
||||
|
||||
// OK - Done
|
||||
public function update($InternalPID = null) {
|
||||
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);
|
||||
if (!$input) { return $this->respond(['status' => 'error', 'message' => 'Invalid JSON input'], 400); }
|
||||
|
||||
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRowArray();
|
||||
if (!$patient) { return $this->respond(['status' => 'error', 'message' => 'Patient not found'], 404); }
|
||||
|
||||
$dataPatient = $this->preparePatientData($input, $now, 'update');
|
||||
$dataPatidt = $this->preparePatidtData($input, $now, 'update');
|
||||
$dataPatcom = $this->preparePatcomData($input, $now, 'update');
|
||||
$dataPatatt = $this->preparePatattData($input, $now, 'update');
|
||||
|
||||
// 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
|
||||
if (!$this->validateData($dataPatient, $rulesDataPatient)) {
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'message' => 'Validation failed (patient)',
|
||||
'errors' => $this->validator->getErrors()
|
||||
], 400);
|
||||
}
|
||||
|
||||
if (!$this->validateData($dataPatidt, $rulesDataPatidt)) {
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'message' => 'Validation failed (patidt)',
|
||||
'errors' => $this->validator->getErrors()
|
||||
], 400);
|
||||
}
|
||||
|
||||
$this->db->transStart();
|
||||
|
||||
$this->db->table('patient')->where('InternalPID', $InternalPID)->update($dataPatient);
|
||||
$dbError = $this->db->error();
|
||||
if (!empty($dbError['message'])) {
|
||||
$this->db->transRollback();
|
||||
return $this->failServerError('Update patient failed: ' . $dbError['message']);
|
||||
}
|
||||
|
||||
$this->db->table('patidt')->where('InternalPID', $InternalPID)->update($dataPatidt);
|
||||
$dbError = $this->db->error();
|
||||
if (!empty($dbError['message'])) {
|
||||
$this->db->transRollback();
|
||||
return $this->failServerError('Update patidt failed: ' . $dbError['message']);
|
||||
}
|
||||
|
||||
if (!empty($dataPatatt)) {
|
||||
foreach ($dataPatatt as &$row) {
|
||||
$row['InternalPID'] = $InternalPID;
|
||||
}
|
||||
$this->db->table('patatt')->upsertBatch($dataPatatt);
|
||||
$addresses = array_column($dataPatatt, 'Address');
|
||||
$this->db->table('patatt')->where('InternalPID', $InternalPID)->WhereNotIn('Address', $addresses)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
||||
} else {
|
||||
$this->db->table('patatt')->where('InternalPID', $InternalPID)->update(['DelDate' => date('Y-m-d H:i:s')]);
|
||||
}
|
||||
|
||||
if(!empty($dataPatcom['Comment'])) {
|
||||
$dataPatcom['InternalPID'] = $InternalPID;
|
||||
$dataPatcom['CreateDate'] = $this->now;
|
||||
$this->db->table('patcom')->upsert($dataPatcom);
|
||||
}
|
||||
|
||||
$this->db->transComplete();
|
||||
|
||||
if ($this->db->transStatus() === false) {
|
||||
$dbError = $this->db->error();
|
||||
return $this->failServerError('Failed to update patient data (transaction rolled back): ' . ($dbError['message'] ?? 'Unknown error'));
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => 'Patient updated successfully',
|
||||
'data' => $InternalPID
|
||||
], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->db->transRollback();
|
||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// OK - Done
|
||||
public function delete($InternalPID = null) {
|
||||
|
||||
try {
|
||||
|
||||
$InternalPID = (int) $InternalPID;
|
||||
|
||||
if (!$InternalPID) {
|
||||
return $this->failValidationError('Patient ID is required.');
|
||||
}
|
||||
|
||||
// Cari data pasien
|
||||
$patient = $this->db->table('patient')->where('InternalPID', $InternalPID)->get()->getRow();
|
||||
|
||||
if (!$patient) {
|
||||
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')]);
|
||||
|
||||
// Mengembalikan 200
|
||||
return $this->respondDeleted([
|
||||
'status' => 'success',
|
||||
'message' => "Patient ID with {$InternalPID} deleted successfully."
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError("Internal server error: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// OK - Done
|
||||
public function patientCheck() {
|
||||
|
||||
try {
|
||||
|
||||
$PatientID = $this->request->getVar('PatientID');
|
||||
$EmailAddress1 = $this->request->getVar('EmailAddress1');
|
||||
|
||||
if ($PatientID!=null){
|
||||
$tableName = 'PatientID';
|
||||
$searchName = $PatientID;
|
||||
}
|
||||
|
||||
if ($EmailAddress1!=null){
|
||||
$tableName = 'EmailAddress1';
|
||||
$searchName = $EmailAddress1;
|
||||
}
|
||||
|
||||
$patient = $this->db->table('patient')
|
||||
->where($tableName, $searchName)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if (!$patient) {
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => "$tableName not found.",
|
||||
'data' => true,
|
||||
], 200);
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message' => "$tableName already exists.",
|
||||
'data' => false,
|
||||
], 200);
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Error Server Mengembalikan 500
|
||||
return $this->failServerError('Something went wrong.'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ubah ke format Years Months Days
|
||||
private function calculateAgeFromBirthdate($birthdate) {
|
||||
$dob = new \DateTime($birthdate);
|
||||
$today = new \DateTime();
|
||||
$diff = $today->diff($dob);
|
||||
|
||||
$formattedAge = "";
|
||||
if ($diff->y > 0){
|
||||
$formattedAge .= "{$diff->y} Years ";
|
||||
}
|
||||
if ($diff->m > 0){
|
||||
$formattedAge .= "{$diff->m} Months ";
|
||||
}
|
||||
if ($diff->d > 0){
|
||||
$formattedAge .= "{$diff->d} Days";
|
||||
}
|
||||
|
||||
return $formattedAge;
|
||||
}
|
||||
|
||||
// Ubah ke format Y-m-d H:i
|
||||
private function formatedDate($dateString) {
|
||||
$date = \DateTime::createFromFormat('Y-m-d H:i', $dateString);
|
||||
|
||||
if (!$date) {
|
||||
$timestamp = strtotime($dateString);
|
||||
if ($timestamp) {
|
||||
return date('Y-m-d H:i', $timestamp);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return $date->format('Y-m-d H:i');
|
||||
}
|
||||
|
||||
// Ubah ke format j M Y
|
||||
private function formatedDateForDisplay($dateString) {
|
||||
$date = \DateTime::createFromFormat('Y-m-d H:i', $dateString);
|
||||
|
||||
if (!$date) {
|
||||
$timestamp = strtotime($dateString);
|
||||
if ($timestamp) {
|
||||
return date('j M Y', $timestamp);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return $date->format('j M Y');
|
||||
}
|
||||
|
||||
}
|
||||
66
app/Database/Migrations/2025-09-02-070522_Patient_master.php
Normal file
66
app/Database/Migrations/2025-09-02-070522_Patient_master.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreatePatMasterTables extends Migration {
|
||||
public function up() {
|
||||
// country
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'IntCountryID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'CountryID' => ['type' => 'VARCHAR', 'constraint' => 10],
|
||||
'Country' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('IntCountryID', true);
|
||||
$this->forge->addUniqueKey('CountryID');
|
||||
$this->forge->createTable('country');
|
||||
|
||||
// ethnic
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'EthnicID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'Ethnic' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('EthnicID', true);
|
||||
$this->forge->createTable('ethnic');
|
||||
|
||||
// race
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'RaceID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'Race' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('RaceID', true);
|
||||
$this->forge->createTable('race');
|
||||
|
||||
// religion
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'ReligionID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'Religion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('ReligionID', true);
|
||||
$this->forge->createTable('religion');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->forge->dropTable('race', true);
|
||||
$this->forge->dropTable('religion', true);
|
||||
$this->forge->dropTable('country', true);
|
||||
$this->forge->dropTable('ethnic', true);
|
||||
}
|
||||
}
|
||||
@ -1,269 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateInitialTables extends Migration {
|
||||
public function up() {
|
||||
|
||||
// country
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'IntCountryID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'CountryID' => ['type' => 'VARCHAR', 'constraint' => 10],
|
||||
'Country' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('IntCountryID', true);
|
||||
$this->forge->addUniqueKey('CountryID');
|
||||
$this->forge->createTable('country');
|
||||
|
||||
// ethnic
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'EthnicID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'Ethnic' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('EthnicID', true);
|
||||
$this->forge->createTable('ethnic');
|
||||
|
||||
// patatt
|
||||
$this->forge->addField([
|
||||
'PatAttID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Address' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatAttID', true);
|
||||
$this->forge->createTable('patatt');
|
||||
|
||||
// patcom
|
||||
$this->forge->addField([
|
||||
'PatComID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Comment' => ['type' => 'TEXT', 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatComID', true);
|
||||
$this->forge->addUniqueKey('InternalPID', true);
|
||||
$this->forge->createTable('patcom');
|
||||
|
||||
// patdiag
|
||||
$this->forge->addField([
|
||||
'PatDiagID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPVID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Comment' => ['type' => 'TEXT', 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchivedDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatDiagID', true);
|
||||
$this->forge->createTable('patdiag');
|
||||
|
||||
// patidt
|
||||
$this->forge->addField([
|
||||
'PatIdtID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'IdentifierType'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Identifier' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EffectiveDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ExpirationDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatIdtID', true);
|
||||
$this->forge->createTable('patidt');
|
||||
|
||||
// patient
|
||||
$this->forge->addField([
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'PatientID' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'AlternatePID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Prefix' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameFirst' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameMiddle' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameMaiden' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameLast' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Suffix' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameAlias' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Gender' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'PlaceOfBirth' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Birthdate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'Street_1' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Street_2' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Street_3' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'City' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Province' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ZIP' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'IntCountryID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'EmailAddress1' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EmailAddress2' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Phone' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MobilePhone' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Custodian' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'AccountNumber' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'RaceID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'MaritalStatus' => ['type' => 'VARCHAR', 'constraint' => 1, 'null' => true],
|
||||
'ReligionID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'EthnicID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Citizenship' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DeathIndicator'=> ['type' => 'BIT', 'constraint' => 1, 'null' => true],
|
||||
'DeathDateTime' => ['type' => 'DATETIME', 'null' => true],
|
||||
'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('InternalPID', true);
|
||||
$this->forge->addUniqueKey('PatientID');
|
||||
$this->forge->addUniqueKey('AlternatePID');
|
||||
$this->forge->addUniqueKey('EmailAddress1');
|
||||
$this->forge->createTable('patient');
|
||||
|
||||
// patreglog
|
||||
$this->forge->addField([
|
||||
'PatRegLogID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'TblName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'RecID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'FldName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'FldValuePrev'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DIDType' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MachineID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'SessionID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'AppID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ProcessID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'WebPageID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatRegLogID', true);
|
||||
$this->forge->createTable('patreglog');
|
||||
|
||||
// patrelation
|
||||
$this->forge->addField([
|
||||
'PatRelID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatRelID', true);
|
||||
$this->forge->createTable('patrelation');
|
||||
|
||||
// patvisit
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'InternalPVID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'PVID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Episode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'VisitClass' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'BillAcc' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'BillStatus' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('InternalPVID', true);
|
||||
$this->forge->createTable('patvisit');
|
||||
|
||||
// patvisitadt
|
||||
$this->forge->addField([
|
||||
'PVADTID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPVID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Code' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LocationID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'AttDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'ReffDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PVADTID', true);
|
||||
$this->forge->createTable('patvisitadt');
|
||||
|
||||
// patvisitlog
|
||||
$this->forge->addField([
|
||||
'PatVisLogID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'TblName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'RecID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'FldName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'FldValuePrev'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DIDType' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MachineID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'SessionID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'AppID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ProcessID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'WebPageID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatVisLogID', true);
|
||||
$this->forge->createTable('patvisitlog');
|
||||
|
||||
// race
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'RaceID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'Race' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('RaceID', true);
|
||||
$this->forge->createTable('race');
|
||||
|
||||
// religion
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CodingSysID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'ReligionID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'Religion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('ReligionID', true);
|
||||
$this->forge->createTable('religion');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->forge->dropTable('country', true);
|
||||
$this->forge->dropTable('ethnic', true);
|
||||
$this->forge->dropTable('patatt', true);
|
||||
$this->forge->dropTable('patcom', true);
|
||||
$this->forge->dropTable('patdiag', true);
|
||||
$this->forge->dropTable('patidt', true);
|
||||
$this->forge->dropTable('patient', true);
|
||||
$this->forge->dropTable('patreglog', true);
|
||||
$this->forge->dropTable('patrelation', true);
|
||||
$this->forge->dropTable('patvisit', true);
|
||||
$this->forge->dropTable('patvisitadt', true);
|
||||
$this->forge->dropTable('patvisitlog', true);
|
||||
$this->forge->dropTable('race', true);
|
||||
$this->forge->dropTable('religion', true);
|
||||
}
|
||||
}
|
||||
136
app/Database/Migrations/2025-09-02-070826_Patient_Reg.php
Normal file
136
app/Database/Migrations/2025-09-02-070826_Patient_Reg.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreatePatientRegTables extends Migration {
|
||||
public function up() {
|
||||
// patatt
|
||||
$this->forge->addField([
|
||||
'PatAttID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Address' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatAttID', true);
|
||||
$this->forge->addUniqueKey('Address');
|
||||
$this->forge->createTable('patatt');
|
||||
|
||||
// patcom
|
||||
$this->forge->addField([
|
||||
'PatComID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Comment' => ['type' => 'TEXT', 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatComID', true);
|
||||
$this->forge->addUniqueKey('InternalPID');
|
||||
$this->forge->createTable('patcom');
|
||||
|
||||
// patidt
|
||||
$this->forge->addField([
|
||||
'PatIdtID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'IdentifierType'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Identifier' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EffectiveDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ExpirationDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatIdtID', true);
|
||||
$this->forge->createTable('patidt');
|
||||
|
||||
// patient
|
||||
$this->forge->addField([
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'PatientID' => ['type' => 'VARCHAR', 'constraint' => 255],
|
||||
'AlternatePID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Prefix' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameFirst' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameMiddle' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameMaiden' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameLast' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Suffix' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'NameAlias' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Gender' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'PlaceOfBirth' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Birthdate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'Street_1' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Street_2' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Street_3' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'City' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Province' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ZIP' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'IntCountryID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'EmailAddress1' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EmailAddress2' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Phone' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MobilePhone' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Custodian' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'AccountNumber' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'RaceID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'MaritalStatus' => ['type' => 'VARCHAR', 'constraint' => 1, 'null' => true],
|
||||
'ReligionID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'EthnicID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Citizenship' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DeathIndicator'=> ['type' => 'BIT', 'constraint' => 1, 'null' => true],
|
||||
'DeathDateTime' => ['type' => 'DATETIME', 'null' => true],
|
||||
'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('InternalPID', true);
|
||||
$this->forge->addUniqueKey('PatientID');
|
||||
$this->forge->addUniqueKey('AlternatePID');
|
||||
$this->forge->addUniqueKey('EmailAddress1');
|
||||
$this->forge->createTable('patient');
|
||||
|
||||
// patreglog
|
||||
$this->forge->addField([
|
||||
'PatRegLogID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'TblName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'RecID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'FldName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'FldValuePrev'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DIDType' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MachineID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'SessionID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'AppID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ProcessID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'WebPageID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatRegLogID', true);
|
||||
$this->forge->createTable('patreglog');
|
||||
|
||||
// patrelation
|
||||
$this->forge->addField([
|
||||
'PatRelID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatRelID', true);
|
||||
$this->forge->createTable('patrelation');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->forge->dropTable('patatt', true);
|
||||
$this->forge->dropTable('patcom', true);
|
||||
$this->forge->dropTable('patidt', true);
|
||||
$this->forge->dropTable('patient', true);
|
||||
$this->forge->dropTable('patreglog', true);
|
||||
$this->forge->dropTable('patrelation', true);
|
||||
}
|
||||
}
|
||||
88
app/Database/Migrations/2025-09-09-155526_Patient_Vst.php
Normal file
88
app/Database/Migrations/2025-09-09-155526_Patient_Vst.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreatePVTables extends Migration {
|
||||
public function up() {
|
||||
// patvisit
|
||||
$this->forge->addField([
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'InternalPVID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'PVID' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true],
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'Episode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('InternalPVID', true);
|
||||
$this->forge->createTable('patvisit');
|
||||
|
||||
// patdiag
|
||||
$this->forge->addField([
|
||||
'InternalPVID' => ['type' => 'INT', 'constraint' => 11],
|
||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Diagnosis' => ['type' => 'TEXT', 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchivedDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('InternalPVID', true);
|
||||
$this->forge->createTable('patdiag');
|
||||
|
||||
// patvisitadt
|
||||
$this->forge->addField([
|
||||
'PVADTID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'InternalPVID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'ADTCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LocationID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'AttDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'ReffDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PVADTID', true);
|
||||
$this->forge->createTable('patvisitadt');
|
||||
|
||||
// patvisitlog
|
||||
$this->forge->addField([
|
||||
'PatVisLogID'=> ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'TblName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'RecID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'FldName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'FldValuePrev'=> ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Origin' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'UserID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'SiteID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'DIDType' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'DID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'MachineID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'SessionID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'AppID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ProcessID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'WebPageID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('PatVisLogID', true);
|
||||
$this->forge->createTable('patvisitlog');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->forge->dropTable('patdiag', true);
|
||||
$this->forge->dropTable('patvisit', true);
|
||||
$this->forge->dropTable('patvisitadt', true);
|
||||
$this->forge->dropTable('patvisitlog', true);
|
||||
}
|
||||
}
|
||||
22
app/Database/Migrations/2025-09-10-141522_Users.php
Normal file
22
app/Database/Migrations/2025-09-10-141522_Users.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration {
|
||||
public function up() {
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||
'role_id' => ['type' => 'TINYINT', 'null' => false],
|
||||
'username' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true],
|
||||
'password' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||
]);
|
||||
$this->forge->addKey('id', true);
|
||||
$this->forge->createTable('users');
|
||||
}
|
||||
|
||||
public function down() {
|
||||
$this->forge->dropTable('users');
|
||||
}
|
||||
}
|
||||
263
app/Database/Seeds/CountrySeeder.php
Normal file
263
app/Database/Seeds/CountrySeeder.php
Normal file
@ -0,0 +1,263 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class CountrySeeder extends Seeder {
|
||||
public function run() {
|
||||
$data = [
|
||||
['IntCountryID'=>1, 'CountryID'=>'AFG', 'Country'=>'Afghanistan'],
|
||||
['IntCountryID'=>2, 'CountryID'=>'ALA', 'Country'=>'Åland Islands'],
|
||||
['IntCountryID'=>3, 'CountryID'=>'ALB', 'Country'=>'Albania'],
|
||||
['IntCountryID'=>4, 'CountryID'=>'DZA', 'Country'=>'Algeria'],
|
||||
['IntCountryID'=>5, 'CountryID'=>'ASM', 'Country'=>'American Samoa'],
|
||||
['IntCountryID'=>6, 'CountryID'=>'AND', 'Country'=>'Andorra'],
|
||||
['IntCountryID'=>7, 'CountryID'=>'AGO', 'Country'=>'Angola'],
|
||||
['IntCountryID'=>8, 'CountryID'=>'AIA', 'Country'=>'Anguilla'],
|
||||
['IntCountryID'=>9, 'CountryID'=>'ATA', 'Country'=>'Antarctica'],
|
||||
['IntCountryID'=>10, 'CountryID'=>'ATG', 'Country'=>'Antigua and Barbuda'],
|
||||
['IntCountryID'=>11, 'CountryID'=>'ARG', 'Country'=>'Argentina'],
|
||||
['IntCountryID'=>12, 'CountryID'=>'ARM', 'Country'=>'Armenia'],
|
||||
['IntCountryID'=>13, 'CountryID'=>'ABW', 'Country'=>'Aruba'],
|
||||
['IntCountryID'=>14, 'CountryID'=>'AUS', 'Country'=>'Australia'],
|
||||
['IntCountryID'=>15, 'CountryID'=>'AUT', 'Country'=>'Austria'],
|
||||
['IntCountryID'=>16, 'CountryID'=>'AZE', 'Country'=>'Azerbaijan'],
|
||||
['IntCountryID'=>17, 'CountryID'=>'BHS', 'Country'=>'Bahamas'],
|
||||
['IntCountryID'=>18, 'CountryID'=>'BHR', 'Country'=>'Bahrain'],
|
||||
['IntCountryID'=>19, 'CountryID'=>'BGD', 'Country'=>'Bangladesh'],
|
||||
['IntCountryID'=>20, 'CountryID'=>'BRB', 'Country'=>'Barbados'],
|
||||
['IntCountryID'=>21, 'CountryID'=>'BLR', 'Country'=>'Belarus'],
|
||||
['IntCountryID'=>22, 'CountryID'=>'BEL', 'Country'=>'Belgium'],
|
||||
['IntCountryID'=>23, 'CountryID'=>'BLZ', 'Country'=>'Belize'],
|
||||
['IntCountryID'=>24, 'CountryID'=>'BEN', 'Country'=>'Benin'],
|
||||
['IntCountryID'=>25, 'CountryID'=>'BMU', 'Country'=>'Bermuda'],
|
||||
['IntCountryID'=>26, 'CountryID'=>'BTN', 'Country'=>'Bhutan'],
|
||||
['IntCountryID'=>27, 'CountryID'=>'BOL', 'Country'=>'Bolivia, Plurinational State of'],
|
||||
['IntCountryID'=>28, 'CountryID'=>'BES', 'Country'=>'Bonaire, Sint Eustatius and Saba[d]'],
|
||||
['IntCountryID'=>29, 'CountryID'=>'BIH', 'Country'=>'Bosnia and Herzegovina'],
|
||||
['IntCountryID'=>30, 'CountryID'=>'BWA', 'Country'=>'Botswana'],
|
||||
['IntCountryID'=>31, 'CountryID'=>'BVT', 'Country'=>'Bouvet Island'],
|
||||
['IntCountryID'=>32, 'CountryID'=>'BRA', 'Country'=>'Brazil'],
|
||||
['IntCountryID'=>33, 'CountryID'=>'IOT', 'Country'=>'British Indian Ocean Territory'],
|
||||
['IntCountryID'=>34, 'CountryID'=>'BRN', 'Country'=>'Brunei Darussalam'],
|
||||
['IntCountryID'=>35, 'CountryID'=>'BGR', 'Country'=>'Bulgaria'],
|
||||
['IntCountryID'=>36, 'CountryID'=>'BFA', 'Country'=>'Burkina Faso'],
|
||||
['IntCountryID'=>37, 'CountryID'=>'BDI', 'Country'=>'Burundi'],
|
||||
['IntCountryID'=>38, 'CountryID'=>'CPV', 'Country'=>'Cabo Verde'],
|
||||
['IntCountryID'=>39, 'CountryID'=>'KHM', 'Country'=>'Cambodia'],
|
||||
['IntCountryID'=>40, 'CountryID'=>'CMR', 'Country'=>'Cameroon'],
|
||||
['IntCountryID'=>41, 'CountryID'=>'CAN', 'Country'=>'Canada'],
|
||||
['IntCountryID'=>42, 'CountryID'=>'CYM', 'Country'=>'Cayman Islands'],
|
||||
['IntCountryID'=>43, 'CountryID'=>'CAF', 'Country'=>'Central African Republic'],
|
||||
['IntCountryID'=>44, 'CountryID'=>'TCD', 'Country'=>'Chad'],
|
||||
['IntCountryID'=>45, 'CountryID'=>'CHL', 'Country'=>'Chile'],
|
||||
['IntCountryID'=>46, 'CountryID'=>'CHN', 'Country'=>'China[c]'],
|
||||
['IntCountryID'=>47, 'CountryID'=>'CXR', 'Country'=>'Christmas Island'],
|
||||
['IntCountryID'=>48, 'CountryID'=>'CCK', 'Country'=>'Cocos (Keeling) Islands'],
|
||||
['IntCountryID'=>49, 'CountryID'=>'COL', 'Country'=>'Colombia'],
|
||||
['IntCountryID'=>50, 'CountryID'=>'COM', 'Country'=>'Comoros'],
|
||||
['IntCountryID'=>51, 'CountryID'=>'COG', 'Country'=>'Congo'],
|
||||
['IntCountryID'=>52, 'CountryID'=>'COD', 'Country'=>'Congo, Democratic Republic of the'],
|
||||
['IntCountryID'=>53, 'CountryID'=>'COK', 'Country'=>'Cook Islands'],
|
||||
['IntCountryID'=>54, 'CountryID'=>'CRI', 'Country'=>'Costa Rica'],
|
||||
['IntCountryID'=>55, 'CountryID'=>'CIV', 'Country'=>"Côte d'Ivoire"],
|
||||
['IntCountryID'=>56, 'CountryID'=>'HRV', 'Country'=>'Croatia'],
|
||||
['IntCountryID'=>57, 'CountryID'=>'CUB', 'Country'=>'Cuba'],
|
||||
['IntCountryID'=>58, 'CountryID'=>'CUW', 'Country'=>'Curaçao'],
|
||||
['IntCountryID'=>59, 'CountryID'=>'CYP', 'Country'=>'Cyprus[c]'],
|
||||
['IntCountryID'=>60, 'CountryID'=>'CZE', 'Country'=>'Czechia'],
|
||||
['IntCountryID'=>61, 'CountryID'=>'DNK', 'Country'=>'Denmark'],
|
||||
['IntCountryID'=>62, 'CountryID'=>'DJI', 'Country'=>'Djibouti'],
|
||||
['IntCountryID'=>63, 'CountryID'=>'DMA', 'Country'=>'Dominica'],
|
||||
['IntCountryID'=>64, 'CountryID'=>'DOM', 'Country'=>'Dominican Republic'],
|
||||
['IntCountryID'=>65, 'CountryID'=>'ECU', 'Country'=>'Ecuador'],
|
||||
['IntCountryID'=>66, 'CountryID'=>'EGY', 'Country'=>'Egypt'],
|
||||
['IntCountryID'=>67, 'CountryID'=>'SLV', 'Country'=>'El Salvador'],
|
||||
['IntCountryID'=>68, 'CountryID'=>'GNQ', 'Country'=>'Equatorial Guinea'],
|
||||
['IntCountryID'=>69, 'CountryID'=>'ERI', 'Country'=>'Eritrea'],
|
||||
['IntCountryID'=>70, 'CountryID'=>'EST', 'Country'=>'Estonia'],
|
||||
['IntCountryID'=>71, 'CountryID'=>'SWZ', 'Country'=>'Eswatini'],
|
||||
['IntCountryID'=>72, 'CountryID'=>'ETH', 'Country'=>'Ethiopia'],
|
||||
['IntCountryID'=>73, 'CountryID'=>'FLK', 'Country'=>'Falkland Islands (Malvinas)[c]'],
|
||||
['IntCountryID'=>74, 'CountryID'=>'FRO', 'Country'=>'Faroe Islands'],
|
||||
['IntCountryID'=>75, 'CountryID'=>'FJI', 'Country'=>'Fiji'],
|
||||
['IntCountryID'=>76, 'CountryID'=>'FIN', 'Country'=>'Finland'],
|
||||
['IntCountryID'=>77, 'CountryID'=>'FRA', 'Country'=>'France'],
|
||||
['IntCountryID'=>78, 'CountryID'=>'GUF', 'Country'=>'French Guiana'],
|
||||
['IntCountryID'=>79, 'CountryID'=>'PYF', 'Country'=>'French Polynesia'],
|
||||
['IntCountryID'=>80, 'CountryID'=>'ATF', 'Country'=>'French Southern Territories'],
|
||||
['IntCountryID'=>81, 'CountryID'=>'GAB', 'Country'=>'Gabon'],
|
||||
['IntCountryID'=>82, 'CountryID'=>'GMB', 'Country'=>'Gambia'],
|
||||
['IntCountryID'=>83, 'CountryID'=>'GEO', 'Country'=>'Georgia'],
|
||||
['IntCountryID'=>84, 'CountryID'=>'DEU', 'Country'=>'Germany'],
|
||||
['IntCountryID'=>85, 'CountryID'=>'GHA', 'Country'=>'Ghana'],
|
||||
['IntCountryID'=>86, 'CountryID'=>'GIB', 'Country'=>'Gibraltar'],
|
||||
['IntCountryID'=>87, 'CountryID'=>'GRC', 'Country'=>'Greece'],
|
||||
['IntCountryID'=>88, 'CountryID'=>'GRL', 'Country'=>'Greenland'],
|
||||
['IntCountryID'=>89, 'CountryID'=>'GRD', 'Country'=>'Grenada'],
|
||||
['IntCountryID'=>90, 'CountryID'=>'GLP', 'Country'=>'Guadeloupe'],
|
||||
['IntCountryID'=>91, 'CountryID'=>'GUM', 'Country'=>'Guam'],
|
||||
['IntCountryID'=>92, 'CountryID'=>'GTM', 'Country'=>'Guatemala'],
|
||||
['IntCountryID'=>93, 'CountryID'=>'GGY', 'Country'=>'Guernsey'],
|
||||
['IntCountryID'=>94, 'CountryID'=>'GIN', 'Country'=>'Guinea'],
|
||||
['IntCountryID'=>95, 'CountryID'=>'GNB', 'Country'=>'Guinea-Bissau'],
|
||||
['IntCountryID'=>96, 'CountryID'=>'GUY', 'Country'=>'Guyana'],
|
||||
['IntCountryID'=>97, 'CountryID'=>'HTI', 'Country'=>'Haiti'],
|
||||
['IntCountryID'=>98, 'CountryID'=>'HMD', 'Country'=>'Heard Island and McDonald Islands'],
|
||||
['IntCountryID'=>99, 'CountryID'=>'VAT', 'Country'=>'Holy See'],
|
||||
['IntCountryID'=>100, 'CountryID'=>'HND', 'Country'=>'Honduras'],
|
||||
['IntCountryID'=>101, 'CountryID'=>'HKG', 'Country'=>'Hong Kong'],
|
||||
['IntCountryID'=>102, 'CountryID'=>'HUN', 'Country'=>'Hungary'],
|
||||
['IntCountryID'=>103, 'CountryID'=>'ISL', 'Country'=>'Iceland'],
|
||||
['IntCountryID'=>104, 'CountryID'=>'IND', 'Country'=>'India'],
|
||||
['IntCountryID'=>105, 'CountryID'=>'IDN', 'Country'=>'Indonesia'],
|
||||
['IntCountryID'=>106, 'CountryID'=>'IRN', 'Country'=>'Iran, Islamic Republic of'],
|
||||
['IntCountryID'=>107, 'CountryID'=>'IRQ', 'Country'=>'Iraq'],
|
||||
['IntCountryID'=>108, 'CountryID'=>'IRL', 'Country'=>'Ireland'],
|
||||
['IntCountryID'=>109, 'CountryID'=>'IMN', 'Country'=>'Isle of Man'],
|
||||
['IntCountryID'=>110, 'CountryID'=>'ISR', 'Country'=>'Israel'],
|
||||
['IntCountryID'=>111, 'CountryID'=>'ITA', 'Country'=>'Italy'],
|
||||
['IntCountryID'=>112, 'CountryID'=>'JAM', 'Country'=>'Jamaica'],
|
||||
['IntCountryID'=>113, 'CountryID'=>'JPN', 'Country'=>'Japan'],
|
||||
['IntCountryID'=>114, 'CountryID'=>'JEY', 'Country'=>'Jersey'],
|
||||
['IntCountryID'=>115, 'CountryID'=>'JOR', 'Country'=>'Jordan'],
|
||||
['IntCountryID'=>116, 'CountryID'=>'KAZ', 'Country'=>'Kazakhstan'],
|
||||
['IntCountryID'=>117, 'CountryID'=>'KEN', 'Country'=>'Kenya'],
|
||||
['IntCountryID'=>118, 'CountryID'=>'KIR', 'Country'=>'Kiribati'],
|
||||
['IntCountryID'=>119, 'CountryID'=>'PRK', 'Country'=>'Korea, Democratic People\'s Republic of'],
|
||||
['IntCountryID'=>120, 'CountryID'=>'KOR', 'Country'=>'Korea, Republic of'],
|
||||
['IntCountryID'=>121, 'CountryID'=>'KWT', 'Country'=>'Kuwait'],
|
||||
['IntCountryID'=>122, 'CountryID'=>'KGZ', 'Country'=>'Kyrgyzstan'],
|
||||
['IntCountryID'=>123, 'CountryID'=>'LAO', 'Country'=>'Lao People\'s Democratic Republic'],
|
||||
['IntCountryID'=>124, 'CountryID'=>'LVA', 'Country'=>'Latvia'],
|
||||
['IntCountryID'=>125, 'CountryID'=>'LBN', 'Country'=>'Lebanon'],
|
||||
['IntCountryID'=>126, 'CountryID'=>'LSO', 'Country'=>'Lesotho'],
|
||||
['IntCountryID'=>127, 'CountryID'=>'LBR', 'Country'=>'Liberia'],
|
||||
['IntCountryID'=>128, 'CountryID'=>'LBY', 'Country'=>'Libya'],
|
||||
['IntCountryID'=>129, 'CountryID'=>'LIE', 'Country'=>'Liechtenstein'],
|
||||
['IntCountryID'=>130, 'CountryID'=>'LTU', 'Country'=>'Lithuania'],
|
||||
['IntCountryID'=>131, 'CountryID'=>'LUX', 'Country'=>'Luxembourg'],
|
||||
['IntCountryID'=>132, 'CountryID'=>'MAC', 'Country'=>'Macao'],
|
||||
['IntCountryID'=>133, 'CountryID'=>'MDG', 'Country'=>'Madagascar'],
|
||||
['IntCountryID'=>134, 'CountryID'=>'MWI', 'Country'=>'Malawi'],
|
||||
['IntCountryID'=>135, 'CountryID'=>'MYS', 'Country'=>'Malaysia'],
|
||||
['IntCountryID'=>136, 'CountryID'=>'MDV', 'Country'=>'Maldives'],
|
||||
['IntCountryID'=>137, 'CountryID'=>'MLI', 'Country'=>'Mali'],
|
||||
['IntCountryID'=>138, 'CountryID'=>'MLT', 'Country'=>'Malta'],
|
||||
['IntCountryID'=>139, 'CountryID'=>'MHL', 'Country'=>'Marshall Islands'],
|
||||
['IntCountryID'=>140, 'CountryID'=>'MTQ', 'Country'=>'Martinique'],
|
||||
['IntCountryID'=>141, 'CountryID'=>'MRT', 'Country'=>'Mauritania'],
|
||||
['IntCountryID'=>142, 'CountryID'=>'MUS', 'Country'=>'Mauritius'],
|
||||
['IntCountryID'=>143, 'CountryID'=>'MYT', 'Country'=>'Mayotte'],
|
||||
['IntCountryID'=>144, 'CountryID'=>'MEX', 'Country'=>'Mexico'],
|
||||
['IntCountryID'=>145, 'CountryID'=>'FSM', 'Country'=>'Micronesia, Federated States of'],
|
||||
['IntCountryID'=>146, 'CountryID'=>'MDA', 'Country'=>'Moldova, Republic of'],
|
||||
['IntCountryID'=>147, 'CountryID'=>'MCO', 'Country'=>'Monaco'],
|
||||
['IntCountryID'=>148, 'CountryID'=>'MNG', 'Country'=>'Mongolia'],
|
||||
['IntCountryID'=>149, 'CountryID'=>'MNE', 'Country'=>'Montenegro'],
|
||||
['IntCountryID'=>150, 'CountryID'=>'MSR', 'Country'=>'Montserrat'],
|
||||
['IntCountryID'=>151, 'CountryID'=>'MAR', 'Country'=>'Morocco'],
|
||||
['IntCountryID'=>152, 'CountryID'=>'MOZ', 'Country'=>'Mozambique'],
|
||||
['IntCountryID'=>153, 'CountryID'=>'MMR', 'Country'=>'Myanmar'],
|
||||
['IntCountryID'=>154, 'CountryID'=>'NAM', 'Country'=>'Namibia'],
|
||||
['IntCountryID'=>155, 'CountryID'=>'NRU', 'Country'=>'Nauru'],
|
||||
['IntCountryID'=>156, 'CountryID'=>'NPL', 'Country'=>'Nepal'],
|
||||
['IntCountryID'=>157, 'CountryID'=>'NLD', 'Country'=>'Netherlands, Kingdom of the'],
|
||||
['IntCountryID'=>158, 'CountryID'=>'NCL', 'Country'=>'New Caledonia'],
|
||||
['IntCountryID'=>159, 'CountryID'=>'NZL', 'Country'=>'New Zealand'],
|
||||
['IntCountryID'=>160, 'CountryID'=>'NIC', 'Country'=>'Nicaragua'],
|
||||
['IntCountryID'=>161, 'CountryID'=>'NER', 'Country'=>'Niger'],
|
||||
['IntCountryID'=>162, 'CountryID'=>'NGA', 'Country'=>'Nigeria'],
|
||||
['IntCountryID'=>163, 'CountryID'=>'NIU', 'Country'=>'Niue'],
|
||||
['IntCountryID'=>164, 'CountryID'=>'NFK', 'Country'=>'Norfolk Island'],
|
||||
['IntCountryID'=>165, 'CountryID'=>'MKD', 'Country'=>'North Macedonia'],
|
||||
['IntCountryID'=>166, 'CountryID'=>'MNP', 'Country'=>'Northern Mariana Islands'],
|
||||
['IntCountryID'=>167, 'CountryID'=>'NOR', 'Country'=>'Norway'],
|
||||
['IntCountryID'=>168, 'CountryID'=>'OMN', 'Country'=>'Oman'],
|
||||
['IntCountryID'=>169, 'CountryID'=>'PAK', 'Country'=>'Pakistan'],
|
||||
['IntCountryID'=>170, 'CountryID'=>'PLW', 'Country'=>'Palau'],
|
||||
['IntCountryID'=>171, 'CountryID'=>'PSE', 'Country'=>'Palestine, State of[c]'],
|
||||
['IntCountryID'=>172, 'CountryID'=>'PAN', 'Country'=>'Panama'],
|
||||
['IntCountryID'=>173, 'CountryID'=>'PNG', 'Country'=>'Papua New Guinea'],
|
||||
['IntCountryID'=>174, 'CountryID'=>'PRY', 'Country'=>'Paraguay'],
|
||||
['IntCountryID'=>175, 'CountryID'=>'PER', 'Country'=>'Peru'],
|
||||
['IntCountryID'=>176, 'CountryID'=>'PHL', 'Country'=>'Philippines'],
|
||||
['IntCountryID'=>177, 'CountryID'=>'PCN', 'Country'=>'Pitcairn'],
|
||||
['IntCountryID'=>178, 'CountryID'=>'POL', 'Country'=>'Poland'],
|
||||
['IntCountryID'=>179, 'CountryID'=>'PRT', 'Country'=>'Portugal'],
|
||||
['IntCountryID'=>180, 'CountryID'=>'PRI', 'Country'=>'Puerto Rico'],
|
||||
['IntCountryID'=>181, 'CountryID'=>'QAT', 'Country'=>'Qatar'],
|
||||
['IntCountryID'=>182, 'CountryID'=>'REU', 'Country'=>'Réunion'],
|
||||
['IntCountryID'=>183, 'CountryID'=>'ROU', 'Country'=>'Romania'],
|
||||
['IntCountryID'=>184, 'CountryID'=>'RUS', 'Country'=>'Russian Federation'],
|
||||
['IntCountryID'=>185, 'CountryID'=>'RWA', 'Country'=>'Rwanda'],
|
||||
['IntCountryID'=>186, 'CountryID'=>'BLM', 'Country'=>'Saint Barthélemy'],
|
||||
['IntCountryID'=>187, 'CountryID'=>'SHN', 'Country'=>'Saint Helena, Ascension and Tristan da Cunha[e]'],
|
||||
['IntCountryID'=>188, 'CountryID'=>'KNA', 'Country'=>'Saint Kitts and Nevis'],
|
||||
['IntCountryID'=>189, 'CountryID'=>'LCA', 'Country'=>'Saint Lucia'],
|
||||
['IntCountryID'=>190, 'CountryID'=>'MAF', 'Country'=>'Saint Martin (French part)'],
|
||||
['IntCountryID'=>191, 'CountryID'=>'SPM', 'Country'=>'Saint Pierre and Miquelon'],
|
||||
['IntCountryID'=>192, 'CountryID'=>'VCT', 'Country'=>'Saint Vincent and the Grenadines'],
|
||||
['IntCountryID'=>193, 'CountryID'=>'WSM', 'Country'=>'Samoa'],
|
||||
['IntCountryID'=>194, 'CountryID'=>'SMR', 'Country'=>'San Marino'],
|
||||
['IntCountryID'=>195, 'CountryID'=>'STP', 'Country'=>'Sao Tome and Principe'],
|
||||
['IntCountryID'=>196, 'CountryID'=>'SAU', 'Country'=>'Saudi Arabia'],
|
||||
['IntCountryID'=>197, 'CountryID'=>'SEN', 'Country'=>'Senegal'],
|
||||
['IntCountryID'=>198, 'CountryID'=>'SRB', 'Country'=>'Serbia'],
|
||||
['IntCountryID'=>199, 'CountryID'=>'SYC', 'Country'=>'Seychelles'],
|
||||
['IntCountryID'=>200, 'CountryID'=>'SLE', 'Country'=>'Sierra Leone'],
|
||||
['IntCountryID'=>201, 'CountryID'=>'SGP', 'Country'=>'Singapore'],
|
||||
['IntCountryID'=>202, 'CountryID'=>'SXM', 'Country'=>'Sint Maarten (Dutch part)'],
|
||||
['IntCountryID'=>203, 'CountryID'=>'SVK', 'Country'=>'Slovakia'],
|
||||
['IntCountryID'=>204, 'CountryID'=>'SVN', 'Country'=>'Slovenia'],
|
||||
['IntCountryID'=>205, 'CountryID'=>'SLB', 'Country'=>'Solomon Islands'],
|
||||
['IntCountryID'=>206, 'CountryID'=>'SOM', 'Country'=>'Somalia'],
|
||||
['IntCountryID'=>207, 'CountryID'=>'ZAF', 'Country'=>'South Africa'],
|
||||
['IntCountryID'=>208, 'CountryID'=>'SGS', 'Country'=>'South Georgia and the South Sandwich Islands'],
|
||||
['IntCountryID'=>209, 'CountryID'=>'SSD', 'Country'=>'South Sudan'],
|
||||
['IntCountryID'=>210, 'CountryID'=>'ESP', 'Country'=>'Spain'],
|
||||
['IntCountryID'=>211, 'CountryID'=>'LKA', 'Country'=>'Sri Lanka'],
|
||||
['IntCountryID'=>212, 'CountryID'=>'SDN', 'Country'=>'Sudan'],
|
||||
['IntCountryID'=>213, 'CountryID'=>'SUR', 'Country'=>'Suriname'],
|
||||
['IntCountryID'=>214, 'CountryID'=>'SJM', 'Country'=>'Svalbard and Jan Mayen[f]'],
|
||||
['IntCountryID'=>215, 'CountryID'=>'SWE', 'Country'=>'Sweden'],
|
||||
['IntCountryID'=>216, 'CountryID'=>'CHE', 'Country'=>'Switzerland'],
|
||||
['IntCountryID'=>217, 'CountryID'=>'SYR', 'Country'=>'Syrian Arab Republic'],
|
||||
['IntCountryID'=>218, 'CountryID'=>'TWN', 'Country'=>'Taiwan, Province of China[c]'],
|
||||
['IntCountryID'=>219, 'CountryID'=>'TJK', 'Country'=>'Tajikistan'],
|
||||
['IntCountryID'=>220, 'CountryID'=>'TZA', 'Country'=>'Tanzania, United Republic of'],
|
||||
['IntCountryID'=>221, 'CountryID'=>'THA', 'Country'=>'Thailand'],
|
||||
['IntCountryID'=>222, 'CountryID'=>'TLS', 'Country'=>'Timor-Leste'],
|
||||
['IntCountryID'=>223, 'CountryID'=>'TGO', 'Country'=>'Togo'],
|
||||
['IntCountryID'=>224, 'CountryID'=>'TKL', 'Country'=>'Tokelau'],
|
||||
['IntCountryID'=>225, 'CountryID'=>'TON', 'Country'=>'Tonga'],
|
||||
['IntCountryID'=>226, 'CountryID'=>'TTO', 'Country'=>'Trinidad and Tobago'],
|
||||
['IntCountryID'=>227, 'CountryID'=>'TUN', 'Country'=>'Tunisia'],
|
||||
['IntCountryID'=>228, 'CountryID'=>'TUR', 'Country'=>'Türkiye'],
|
||||
['IntCountryID'=>229, 'CountryID'=>'TKM', 'Country'=>'Turkmenistan'],
|
||||
['IntCountryID'=>230, 'CountryID'=>'TCA', 'Country'=>'Turks and Caicos Islands'],
|
||||
['IntCountryID'=>231, 'CountryID'=>'TUV', 'Country'=>'Tuvalu'],
|
||||
['IntCountryID'=>232, 'CountryID'=>'UGA', 'Country'=>'Uganda'],
|
||||
['IntCountryID'=>233, 'CountryID'=>'UKR', 'Country'=>'Ukraine'],
|
||||
['IntCountryID'=>234, 'CountryID'=>'ARE', 'Country'=>'United Arab Emirates'],
|
||||
['IntCountryID'=>235, 'CountryID'=>'GBR', 'Country'=>'United Kingdom of Great Britain and Northern Ireland'],
|
||||
['IntCountryID'=>236, 'CountryID'=>'USA', 'Country'=>'United States of America'],
|
||||
['IntCountryID'=>237, 'CountryID'=>'UMI', 'Country'=>'United States Minor Outlying Islands[g]'],
|
||||
['IntCountryID'=>238, 'CountryID'=>'URY', 'Country'=>'Uruguay'],
|
||||
['IntCountryID'=>239, 'CountryID'=>'UZB', 'Country'=>'Uzbekistan'],
|
||||
['IntCountryID'=>240, 'CountryID'=>'VUT', 'Country'=>'Vanuatu'],
|
||||
['IntCountryID'=>241, 'CountryID'=>'VEN', 'Country'=>'Venezuela, Bolivarian Republic of'],
|
||||
['IntCountryID'=>242, 'CountryID'=>'VNM', 'Country'=>'Viet Nam'],
|
||||
['IntCountryID'=>243, 'CountryID'=>'VGB', 'Country'=>'Virgin Islands (British)'],
|
||||
['IntCountryID'=>244, 'CountryID'=>'VIR', 'Country'=>'Virgin Islands (U.S.)'],
|
||||
['IntCountryID'=>245, 'CountryID'=>'WLF', 'Country'=>'Wallis and Futuna'],
|
||||
['IntCountryID'=>246, 'CountryID'=>'ESH', 'Country'=>'Western Sahara[c]'],
|
||||
['IntCountryID'=>247, 'CountryID'=>'YEM', 'Country'=>'Yemen'],
|
||||
['IntCountryID'=>248, 'CountryID'=>'ZMB', 'Country'=>'Zambia'],
|
||||
['IntCountryID'=>249, 'CountryID'=>'ZWE', 'Country'=>'Zimbabwe']
|
||||
];
|
||||
|
||||
$this->db->table('country')->insertBatch($data);
|
||||
}
|
||||
}
|
||||
14
app/Database/Seeds/DBSeeder.php
Normal file
14
app/Database/Seeds/DBSeeder.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class DBSeeder extends Seeder {
|
||||
public function run() {
|
||||
$this->call('CountrySeeder');
|
||||
$this->call('EthnicSeeder');
|
||||
$this->call('RaceSeeder');
|
||||
$this->call('ReligionSeeder');
|
||||
}
|
||||
}
|
||||
23
app/Database/Seeds/EthnicSeeder.php
Normal file
23
app/Database/Seeds/EthnicSeeder.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class EthnicSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$data = [
|
||||
['EthnicID'=>1, 'Ethnic'=>'Papua Melanezoid'],
|
||||
['EthnicID'=>2, 'Ethnic'=>'Negroid'],
|
||||
['EthnicID'=>3, 'Ethnic'=>'Weddoid'],
|
||||
['EthnicID'=>4, 'Ethnic'=>'Melayu Mongoloid_Proto Melayu'],
|
||||
['EthnicID'=>5, 'Ethnic'=>'Melayu Mongoloid_Deutro Melayu'],
|
||||
['EthnicID'=>6, 'Ethnic'=>'Tionghoa'],
|
||||
['EthnicID'=>7, 'Ethnic'=>'India'],
|
||||
['EthnicID'=>8, 'Ethnic'=>'Arab'],
|
||||
];
|
||||
$this->db->table('ethnic')->insertBatch($data);
|
||||
}
|
||||
}
|
||||
44
app/Database/Seeds/RaceSeeder.php
Normal file
44
app/Database/Seeds/RaceSeeder.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class RaceSeeder extends Seeder {
|
||||
public function run() {
|
||||
$data = [
|
||||
['RaceID'=>1, 'Race'=>'Jawa'],
|
||||
['RaceID'=>2, 'Race'=>'Sunda'],
|
||||
['RaceID'=>3, 'Race'=>'Batak'],
|
||||
['RaceID'=>4, 'Race'=>'Suku asal Sulawesi lainnya'],
|
||||
['RaceID'=>5, 'Race'=>'Madura'],
|
||||
['RaceID'=>6, 'Race'=>'Betawi'],
|
||||
['RaceID'=>7, 'Race'=>'Minangkabau'],
|
||||
['RaceID'=>8, 'Race'=>'Bugis'],
|
||||
['RaceID'=>9, 'Race'=>'Melayu'],
|
||||
['RaceID'=>10, 'Race'=>'Suku asal Sumatera Selatan'],
|
||||
['RaceID'=>11, 'Race'=>'Suku asal Banten'],
|
||||
['RaceID'=>12, 'Race'=>'Suku asal Nusa Tenggara Timur'],
|
||||
['RaceID'=>13, 'Race'=>'Banjar'],
|
||||
['RaceID'=>14, 'Race'=>'Aceh'],
|
||||
['RaceID'=>15, 'Race'=>'Bali'],
|
||||
['RaceID'=>16, 'Race'=>'Sasak'],
|
||||
['RaceID'=>17, 'Race'=>'Dayak'],
|
||||
['RaceID'=>18, 'Race'=>'Tionghoa'],
|
||||
['RaceID'=>19, 'Race'=>'Suku asal Papua'],
|
||||
['RaceID'=>20, 'Race'=>'Makassar'],
|
||||
['RaceID'=>21, 'Race'=>'Suku asal Sumatera lainnya'],
|
||||
['RaceID'=>22, 'Race'=>'Suku asal Maluku'],
|
||||
['RaceID'=>23, 'Race'=>'Suku asal Kalimantan lainnya'],
|
||||
['RaceID'=>24, 'Race'=>'Cirebon'],
|
||||
['RaceID'=>25, 'Race'=>'Suku asal Jambi'],
|
||||
['RaceID'=>26, 'Race'=>'Suku Lampung'],
|
||||
['RaceID'=>27, 'Race'=>'Suku asal Nusa Tenggara Barat lainnya'],
|
||||
['RaceID'=>28, 'Race'=>'Gorontalo'],
|
||||
['RaceID'=>29, 'Race'=>'Minahasa'],
|
||||
['RaceID'=>30, 'Race'=>'Nias'],
|
||||
['RaceID'=>31, 'Race'=>'Asing/luar negeri']
|
||||
];
|
||||
$this->db->table('race')->insertBatch($data);
|
||||
}
|
||||
}
|
||||
22
app/Database/Seeds/ReligionSeeder.php
Normal file
22
app/Database/Seeds/ReligionSeeder.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
class ReligionSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$data = [
|
||||
['ReligionID'=>1, 'Religion'=>'Islam'],
|
||||
['ReligionID'=>2, 'Religion'=>'Kristen'],
|
||||
['ReligionID'=>3, 'Religion'=>'Katolik'],
|
||||
['ReligionID'=>4, 'Religion'=>'Hindu'],
|
||||
['ReligionID'=>5, 'Religion'=>'Buddha'],
|
||||
['ReligionID'=>6, 'Religion'=>'Konghucu'],
|
||||
['ReligionID'=>7, 'Religion'=>'Lainnya'],
|
||||
];
|
||||
$this->db->table('religion')->insertBatch($data);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user