From 08bdea979b1bc1ac8c7ffdfbabd7bd5c71e0499d Mon Sep 17 00:00:00 2001 From: ivan-sim Date: Thu, 25 Jan 2024 09:25:28 +0700 Subject: [PATCH 1/3] Update get final LOG --- .../Http/Controllers/Api/RequestLogController.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php index a5a2a6e8..70b2fc4d 100644 --- a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php +++ b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php @@ -297,11 +297,7 @@ class RequestLogController extends Controller '), 'request_logs.submission_date', DB::raw(' - CASE - WHEN service_code = "OP" THEN "Outpatient" - WHEN service_code = "IP" THEN "Inpatient" - ELSE "" - END AS service_type + (SELECT services.name FROM services WHERE services.code = request_logs.service_code LIMIT 1) AS service_type '), DB::raw(' (SELECT organizations.name FROM organizations WHERE organizations.id = request_logs.organization_id LIMIT 1) AS provider From d76865f336168ef017f022fe12ffd0a5ebe9bfdd Mon Sep 17 00:00:00 2001 From: ivan-sim Date: Thu, 25 Jan 2024 09:42:31 +0700 Subject: [PATCH 2/3] Update query --- .../Http/Controllers/Api/RequestLogController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php index 70b2fc4d..9042c215 100644 --- a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php +++ b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php @@ -240,8 +240,7 @@ class RequestLogController extends Controller $query->orWhere('request_logs.code', 'like', "%" . $search . "%") ->orWhere('members.name', 'like', "%" . $search . "%") ->orWhere('request_logs.submission_date', 'like', "%" . $search . "%") - ->orWhere('request_logs.service_code', 'like', "%" . ($search == 'outpatient' || $search == 'Outpatient' ? 'OP' : $search) . "%") - ->orWhere('request_logs.service_code', 'like', "%" . ($search == 'inpatient' || $search == 'Inpatient' ? 'IP' : $search) . "%"); + ->orWhereRaw('(SELECT services.name FROM services WHERE services.code = request_logs.service_code LIMIT 1) LIKE ?', ["%" . $search . "%"]); }); }) ->when($request->has('orderBy'), function ($query) use ($request) { From f3b69c4540f964042cdb4d493d1ef6b1f54da17d Mon Sep 17 00:00:00 2001 From: ivan-sim Date: Thu, 25 Jan 2024 10:47:03 +0700 Subject: [PATCH 3/3] Update data --- .../Controllers/Api/RequestLogController.php | 2 ++ .../src/sections/dashboard/DialogFinalLog.tsx | 2 +- .../src/sections/dashboard/FormRequestLog.tsx | 2 +- .../sections/dashboard/TableListFinalLog.tsx | 17 +++++++++++++++-- .../src/sections/dashboard/TableListReqLog.tsx | 4 ++-- .../hospital-portal/src/utils/formatTime.ts | 2 +- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php index 9042c215..760103ed 100644 --- a/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php +++ b/Modules/HospitalPortal/Http/Controllers/Api/RequestLogController.php @@ -240,6 +240,7 @@ class RequestLogController extends Controller $query->orWhere('request_logs.code', 'like', "%" . $search . "%") ->orWhere('members.name', 'like', "%" . $search . "%") ->orWhere('request_logs.submission_date', 'like', "%" . $search . "%") + ->orWhere('request_logs.discharge_date', 'like', "%" . $search . "%") ->orWhereRaw('(SELECT services.name FROM services WHERE services.code = request_logs.service_code LIMIT 1) LIKE ?', ["%" . $search . "%"]); }); }) @@ -295,6 +296,7 @@ class RequestLogController extends Controller END AS status '), 'request_logs.submission_date', + 'request_logs.discharge_date', DB::raw(' (SELECT services.name FROM services WHERE services.code = request_logs.service_code LIMIT 1) AS service_type '), diff --git a/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx b/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx index 7bebba3f..703a6f71 100644 --- a/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/DialogFinalLog.tsx @@ -334,7 +334,7 @@ export default function DialogFinalLog({ member, getData, onClose, handleSubmitS onChange={(newValue:any) => { setDischargeDate( (newValue)); }} - inputFormat="dd-MM-yyyy" + inputFormat="dd-MM-yyyy HH:mm" renderInput={(params) => } /> diff --git a/frontend/hospital-portal/src/sections/dashboard/FormRequestLog.tsx b/frontend/hospital-portal/src/sections/dashboard/FormRequestLog.tsx index 3bb40829..19d5d8c2 100644 --- a/frontend/hospital-portal/src/sections/dashboard/FormRequestLog.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/FormRequestLog.tsx @@ -198,7 +198,7 @@ export default function FormRequestClaim({ member, handleSubmitSuccess }: FormRe onChange={(newValue:any) => { setSubmissionDate( (newValue)); }} - inputFormat="dd-MM-yyyy" + inputFormat="dd-MM-yyyy HH:mm" renderInput={(params) => } /> diff --git a/frontend/hospital-portal/src/sections/dashboard/TableListFinalLog.tsx b/frontend/hospital-portal/src/sections/dashboard/TableListFinalLog.tsx index 87264886..c79ff891 100644 --- a/frontend/hospital-portal/src/sections/dashboard/TableListFinalLog.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/TableListFinalLog.tsx @@ -15,7 +15,7 @@ import palette from '../../theme/palette'; //import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate'; import { HeadCell, Order, PaginationTableProps } from '../../@types/table'; import { useSearchParams, useNavigate } from 'react-router-dom'; -import { fDate, fDateSuffix } from '../../utils/formatTime'; +import { fDate, fDateSuffix, fDateTime } from '../../utils/formatTime'; import Typography from '@mui/material/Typography'; import { format } from 'date-fns'; import TableMoreMenu from '../../components/table/TableMoreMenu'; @@ -264,6 +264,12 @@ export default function TableListFinalLog() { label: localeData.txtServiceType, isSort: true, }, + { + id: 'discharge_date', + align: 'center', + label: localeData.txtDischargeDate, + isSort: true, + }, { id: 'status', align: 'center', @@ -358,9 +364,16 @@ export default function TableListFinalLog() { ), submission_date: , + discharge_date: + obj.discharge_date ? ( + + ) : '' + , action: diff --git a/frontend/hospital-portal/src/sections/dashboard/TableListReqLog.tsx b/frontend/hospital-portal/src/sections/dashboard/TableListReqLog.tsx index f3d949cf..248ac202 100644 --- a/frontend/hospital-portal/src/sections/dashboard/TableListReqLog.tsx +++ b/frontend/hospital-portal/src/sections/dashboard/TableListReqLog.tsx @@ -15,7 +15,7 @@ import palette from '../../theme/palette'; //import { UserCurrentCorporateContext } from '../../contexts/UserCurrentCorporate'; import { HeadCell, Order, PaginationTableProps } from '../../@types/table'; import { useSearchParams, useNavigate } from 'react-router-dom'; -import { fDate, fDateSuffix } from '../../utils/formatTime'; +import { fDate, fDateSuffix, fDateTime } from '../../utils/formatTime'; import Typography from '@mui/material/Typography'; import { format } from 'date-fns'; import TableMoreMenu from '../../components/table/TableMoreMenu'; @@ -356,7 +356,7 @@ export default function TableList() { ), submission_date: , action: diff --git a/frontend/hospital-portal/src/utils/formatTime.ts b/frontend/hospital-portal/src/utils/formatTime.ts index ed88dcae..a9fc9250 100644 --- a/frontend/hospital-portal/src/utils/formatTime.ts +++ b/frontend/hospital-portal/src/utils/formatTime.ts @@ -8,7 +8,7 @@ export function fDate(date: Date | string | number) { } export function fDateTime(date: Date | string | number) { - return format(new Date(date), 'dd MMM yyyy hh:mm'); + return format(new Date(date), 'dd MMM yyyy HH:mm'); } export function fTimestamp(date: Date | string | number) {