2024-11-20 16:55:21 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Controllers;
|
|
|
|
|
|
2024-12-04 11:11:02 +07:00
|
|
|
class AdminController extends BaseController {
|
2024-11-20 16:55:21 +07:00
|
|
|
|
2024-12-04 11:11:02 +07:00
|
|
|
public function index() {
|
|
|
|
|
return view('admin/dashboard');
|
2024-11-21 15:38:56 +07:00
|
|
|
}
|
|
|
|
|
|
2024-12-04 11:11:02 +07:00
|
|
|
public function viewAccess($accessnumber): string {
|
|
|
|
|
$db = \Config\Database::connect();
|
|
|
|
|
$sql = "select p.PATNUMBER, p.NAME, sr.HOSTORDERNUMBER, tu.SAMPLETYPE, ds.SHORTTEXT, tu.TUBESTATUS, ct.COLLSTATUS, ct.TUBECOMMENT from SP_TUBES tu
|
|
|
|
|
left join SP_REQUESTS sr on tu.SP_ACCESSNUMBER=sr.SP_ACCESSNUMBER
|
|
|
|
|
left join PATIENTS p on p.PATID=sr.PATID
|
|
|
|
|
left join DICT_SAMPLES_TYPES ds on ds.SAMPCODE= tu.SAMPLETYPE
|
|
|
|
|
left join cmod.dbo.CM_TUBES ct on ct.SAMPLETYPE=tu.SAMPLETYPE and ct.ACCESSNUMBER=tu.SP_ACCESSNUMBER
|
|
|
|
|
where tu.SP_ACCESSNUMBER='$accessnumber'";
|
|
|
|
|
$query = $db->query($sql);
|
|
|
|
|
$results = $query->getResultArray();
|
2024-12-09 15:05:47 +08:00
|
|
|
$hostordernumber = $results[0]['HOSTORDERNUMBER'];
|
2024-12-04 11:11:02 +07:00
|
|
|
$data['data'] = $results;
|
2024-12-09 15:05:47 +08:00
|
|
|
|
|
|
|
|
$sql = "select concat([Patient First Name],' ',[Patient Last Name]) as [Patient Full Name], [Visit Description],
|
|
|
|
|
[Treating Doctor], [Payer Name] from cmod.dbo.CM_HIS_ORDER where [Visit Number] = '$hostordernumber'";
|
|
|
|
|
$query = $db->query($sql);
|
|
|
|
|
$results = $query->getResultArray();
|
|
|
|
|
|
|
|
|
|
if($results != null) {
|
|
|
|
|
$data['patient_fullname'] = $results[0]['Patient Full Name'];
|
|
|
|
|
$data['visit_description'] = $results[0]['Visit Description'];
|
|
|
|
|
$data['treating_doctor'] = $results[0]['Treating Doctor'];
|
|
|
|
|
$data['payer_name'] = $results[0]['Payer Name'];
|
|
|
|
|
} else {
|
|
|
|
|
$data['patient_fullname'] = "";
|
|
|
|
|
$data['visit_description'] = "";
|
|
|
|
|
$data['treating_doctor'] = "";
|
|
|
|
|
$data['payer_name'] = "";
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-04 11:11:02 +07:00
|
|
|
$data['accessnumber'] = $accessnumber;
|
2024-12-09 15:05:47 +08:00
|
|
|
|
2024-12-04 11:11:02 +07:00
|
|
|
return view('admin/dashboard_viewAccess', $data);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-20 16:55:21 +07:00
|
|
|
public function userroles_index(): string {
|
2024-12-04 11:11:02 +07:00
|
|
|
return view('admin/userroles_index');
|
2024-11-20 16:55:21 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function users_index(): string {
|
|
|
|
|
$db = \Config\Database::connect();
|
|
|
|
|
$sql = "select * from cmod.dbo.CM_USERROLES";
|
|
|
|
|
$query = $db->query($sql);
|
|
|
|
|
$results = $query->getResultArray();
|
|
|
|
|
$data['userroles'] = $results;
|
2024-12-04 11:11:02 +07:00
|
|
|
return view('admin/users_index', $data);
|
2024-11-20 16:55:21 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function changePass() {
|
|
|
|
|
if ($this->request->getMethod() === 'POST') {
|
|
|
|
|
$password1 = $this->request->getVar('password1');
|
|
|
|
|
$password2 = $this->request->getVar('password2');
|
|
|
|
|
$data['password1'] = $password1;
|
|
|
|
|
$data['password2'] = $password2;
|
|
|
|
|
if($password1 == $password2) {
|
|
|
|
|
$password = password_hash($password1,PASSWORD_DEFAULT);
|
|
|
|
|
$db = \Config\Database::connect();
|
|
|
|
|
$sql = "update cmod.dbo.CM_USERS set PASSWORD='$password' where USERID='$userid'";
|
|
|
|
|
$db->query($sql);
|
|
|
|
|
return redirect()->to("/");
|
|
|
|
|
} else {
|
|
|
|
|
return redirect()->to("/auth/setpass/$userid")->with('flash_error', 'password is not the same.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return view('changePass');
|
|
|
|
|
}
|
2024-11-25 16:52:52 +07:00
|
|
|
|
|
|
|
|
public function dictTests_index() {
|
2024-12-04 11:11:02 +07:00
|
|
|
return view('admin/dictTests_index');
|
2024-11-25 16:52:52 +07:00
|
|
|
}
|
2024-12-05 14:49:27 +07:00
|
|
|
|
2024-12-07 13:35:34 +07:00
|
|
|
public function dictChapters_index() {
|
|
|
|
|
return view('admin/dictChapters_index');
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-05 14:49:27 +07:00
|
|
|
public function dictMappings_index() {
|
2024-12-06 08:51:48 +07:00
|
|
|
$db = \Config\Database::connect();
|
|
|
|
|
$sql = "select TESTCODE from DICT_TESTS where ENDVALIDDATE is null";
|
|
|
|
|
$query = $db->query($sql);
|
|
|
|
|
$results = $query->getResultArray();
|
|
|
|
|
$data['tests'] = $results;
|
|
|
|
|
return view('admin/dictMappings_index', $data);
|
2024-12-05 14:49:27 +07:00
|
|
|
}
|
2024-12-13 14:20:14 +07:00
|
|
|
|
|
|
|
|
public function orders_index() {
|
|
|
|
|
return view('orders_index');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function orders_update($orderid) {
|
|
|
|
|
$db = \Config\Database::connect();
|
|
|
|
|
$sql = "select * from cmod.dbo.CM_DICT_MAPPINGS";
|
|
|
|
|
$query = $db->query($sql);
|
|
|
|
|
$results = $query->getResultArray();
|
|
|
|
|
$data['tests'] = $results;
|
|
|
|
|
$data['orderid'] = $orderid;
|
|
|
|
|
return view('orders_update', $data);
|
|
|
|
|
}
|
2024-12-14 10:00:45 +07:00
|
|
|
|
|
|
|
|
public function patients_index() {
|
|
|
|
|
return view('patients_index');
|
|
|
|
|
}
|
2024-11-20 16:55:21 +07:00
|
|
|
}
|