Merge remote-tracking branch 'refs/remotes/origin/staging' into staging
This commit is contained in:
29
Modules/Internal/Http/Controllers/Api/Linksehat/PrescriptionController.php
Normal file → Executable file
29
Modules/Internal/Http/Controllers/Api/Linksehat/PrescriptionController.php
Normal file → Executable file
@@ -32,8 +32,11 @@ class PrescriptionController extends Controller
|
|||||||
'tx_prescriptions.*',
|
'tx_prescriptions.*',
|
||||||
'tx_prescription_orders.sStatus as status_prescription',
|
'tx_prescription_orders.sStatus as status_prescription',
|
||||||
'tx_prescription_orders.sAddress as kirim_ke',
|
'tx_prescription_orders.sAddress as kirim_ke',
|
||||||
|
'tx_prescription_orders.sDeliveryPrice as ongkir',
|
||||||
'tx_prescription_orders.sDeliveryMethod as delivery',
|
'tx_prescription_orders.sDeliveryMethod as delivery',
|
||||||
);
|
'tx_prescription_orders.nIDApotek',
|
||||||
|
)
|
||||||
|
->whereNotNull('nIDUser');
|
||||||
if ($request->has('search')) {
|
if ($request->has('search')) {
|
||||||
$search = $request->search;
|
$search = $request->search;
|
||||||
$prescription->where(function ($query) use ($search) {
|
$prescription->where(function ($query) use ($search) {
|
||||||
@@ -164,6 +167,8 @@ class PrescriptionController extends Controller
|
|||||||
'Patient',
|
'Patient',
|
||||||
'Doctor',
|
'Doctor',
|
||||||
'Status',
|
'Status',
|
||||||
|
'Nama Apotek',
|
||||||
|
'Harga Ongkir',
|
||||||
'Jenis Obat (Drugs)',
|
'Jenis Obat (Drugs)',
|
||||||
'Jumlah Obat (QTY)',
|
'Jumlah Obat (QTY)',
|
||||||
'Cara Minum Obat',
|
'Cara Minum Obat',
|
||||||
@@ -176,7 +181,17 @@ class PrescriptionController extends Controller
|
|||||||
|
|
||||||
// Query prescription data
|
// Query prescription data
|
||||||
$prescriptionQuery = Prescription::query()
|
$prescriptionQuery = Prescription::query()
|
||||||
->with(['livechat', 'user', 'items']);
|
->with(['livechat', 'user', 'items'])
|
||||||
|
->join('tx_prescription_orders', 'tx_prescriptions.nID', '=', 'tx_prescription_orders.nIDPrescription')
|
||||||
|
->select(
|
||||||
|
'tx_prescriptions.*',
|
||||||
|
'tx_prescription_orders.sStatus as status_prescription',
|
||||||
|
'tx_prescription_orders.sAddress as kirim_ke',
|
||||||
|
'tx_prescription_orders.sDeliveryPrice as ongkir',
|
||||||
|
'tx_prescription_orders.sDeliveryMethod as delivery',
|
||||||
|
'tx_prescription_orders.nIDApotek',
|
||||||
|
)
|
||||||
|
->whereNotNull('nIDUser');
|
||||||
|
|
||||||
if ($request->has('search')) {
|
if ($request->has('search')) {
|
||||||
$search = $request->search;
|
$search = $request->search;
|
||||||
@@ -196,13 +211,18 @@ class PrescriptionController extends Controller
|
|||||||
if ($prescriptions->isNotEmpty()) {
|
if ($prescriptions->isNotEmpty()) {
|
||||||
$no = 1;
|
$no = 1;
|
||||||
foreach ($prescriptions as $index => $row) {
|
foreach ($prescriptions as $index => $row) {
|
||||||
|
$patientName = $row->user ? $row->user->sFirstName .' '. $row->user->sLastName : '-';
|
||||||
if ($row->items->isNotEmpty()) {
|
if ($row->items->isNotEmpty()) {
|
||||||
$rowData = [
|
$rowData = [
|
||||||
$no++,
|
$no++,
|
||||||
$row->sKodeResep ?? '-',
|
$row->sKodeResep ?? '-',
|
||||||
$row->dTanggalResep ? Carbon::parse($row->dTanggalResep)->format('Y-m-d') : '-',
|
$row->dTanggalResep ? Carbon::parse($row->dTanggalResep)->format('Y-m-d') : '-',
|
||||||
$row->user->name ?? '-',
|
$row->user->fullName ?? '-',
|
||||||
$row->sDokterName ?? '-',
|
$row->sDokterName ?? '-',
|
||||||
|
$row->status_prescription ?? '-',
|
||||||
|
$row->nIDApotek ? Helper::getOrganization($row->nIDApotek) : '-',
|
||||||
|
$row->ongkir ?? '-',
|
||||||
|
$row->sDeliveryPrice ?? '-',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Create a row from the array and add it to the writer
|
// Create a row from the array and add it to the writer
|
||||||
@@ -215,6 +235,9 @@ class PrescriptionController extends Controller
|
|||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
$item->sItemName ?? '-',
|
$item->sItemName ?? '-',
|
||||||
$item->nQty ?? '-',
|
$item->nQty ?? '-',
|
||||||
$item->sSigna ?? '-'
|
$item->sSigna ?? '-'
|
||||||
|
|||||||
7
Modules/Internal/Transformers/ReportPrescriptionResource.php
Normal file → Executable file
7
Modules/Internal/Transformers/ReportPrescriptionResource.php
Normal file → Executable file
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Modules\Internal\Transformers;
|
namespace Modules\Internal\Transformers;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
@@ -25,7 +26,9 @@ class ReportPrescriptionResource extends JsonResource
|
|||||||
'date_consultation' => $this->dTanggalResep ? Carbon::parse($this->dTanggalResep)->format('Y-m-d H:i:s') : null,
|
'date_consultation' => $this->dTanggalResep ? Carbon::parse($this->dTanggalResep)->format('Y-m-d H:i:s') : null,
|
||||||
'doctor_name' => $this->sDokterName ? $this->sDokterName : '-',
|
'doctor_name' => $this->sDokterName ? $this->sDokterName : '-',
|
||||||
'items' => $this->items ? $this->items : [],
|
'items' => $this->items ? $this->items : [],
|
||||||
'status_prescription' => $this->status_prescription
|
'status_prescription' => $this->status_prescription,
|
||||||
|
'price_delivery' => $this->ongkir,
|
||||||
|
'apotek_name' => $this->nIDApotek ? Helper::getOrganization($this->nIDApotek) : '-',
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use App\Models\User;
|
|||||||
use App\Models\CorporatePolicy;
|
use App\Models\CorporatePolicy;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use App\Models\Icd;
|
use App\Models\Icd;
|
||||||
|
use App\Models\Organization;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
@@ -669,5 +670,9 @@ class Helper
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getOrganization($organizationId){
|
||||||
|
$organization = Organization::where('id', $organizationId)->first();
|
||||||
|
return $organization->name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,11 @@ class NavigationSeeder extends Seeder
|
|||||||
'path' => '/report/linksehat-payments',
|
'path' => '/report/linksehat-payments',
|
||||||
'permission' => 'report-livechat-payment'
|
'permission' => 'report-livechat-payment'
|
||||||
],
|
],
|
||||||
// ['title' => 'Prescription', 'path' => '/report/prescription'],
|
[
|
||||||
|
'title' => 'Prescription',
|
||||||
|
'path' => '/report/prescription',
|
||||||
|
'permission' => 'report-prescription'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'title' => 'Doctor Rating',
|
'title' => 'Doctor Rating',
|
||||||
'path' => '/report/doctor-rating',
|
'path' => '/report/doctor-rating',
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ class PermissionTableSeeder extends Seeder
|
|||||||
'report-livechat-payment',
|
'report-livechat-payment',
|
||||||
'report-doctor-rating',
|
'report-doctor-rating',
|
||||||
'report-doctor-online',
|
'report-doctor-online',
|
||||||
|
'report-prescription',
|
||||||
'user-role-list',
|
'user-role-list',
|
||||||
'user-access-list',
|
'user-access-list',
|
||||||
'report-katalog-dokter',
|
'report-katalog-dokter',
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ const transaksiDataDefault = [
|
|||||||
const [transaksiData, setTransaksiData] = useState(transaksiDataDefault);
|
const [transaksiData, setTransaksiData] = useState(transaksiDataDefault);
|
||||||
const [transaksiDataBar, setTransaksiDataBar] = useState([]);
|
const [transaksiDataBar, setTransaksiDataBar] = useState([]);
|
||||||
const [type, setType] = useState(0);
|
const [type, setType] = useState(0);
|
||||||
|
const [typeDokter, setTypeDokter] = useState(0);
|
||||||
const [status, setStatus] = useState(0);
|
const [status, setStatus] = useState(0);
|
||||||
const [statusDokter, setStatusDokter] = useState(0);
|
const [statusDokter, setStatusDokter] = useState(0);
|
||||||
const [view, setView] = useState(["day", "month", "year"]);
|
const [view, setView] = useState(["day", "month", "year"]);
|
||||||
@@ -173,7 +174,7 @@ const transaksiDataDefault = [
|
|||||||
params: {
|
params: {
|
||||||
start_date: startDateDokter,
|
start_date: startDateDokter,
|
||||||
end_date: endDateDokter,
|
end_date: endDateDokter,
|
||||||
type,
|
typeDokter,
|
||||||
statusDokter,
|
statusDokter,
|
||||||
nIDDokter: selectedDoctors
|
nIDDokter: selectedDoctors
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ const transaksiDataDefault = [
|
|||||||
// Fetch
|
// Fetch
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchListPerfomaDokter();
|
fetchListPerfomaDokter();
|
||||||
}, [selectedDoctors, startDateDokter, endDateDokter])
|
}, [selectedDoctors, startDateDokter, typeDokter, endDateDokter])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchListDokter();
|
fetchListDokter();
|
||||||
@@ -298,11 +299,11 @@ const transaksiDataDefault = [
|
|||||||
<TableCell>
|
<TableCell>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
color: doctor.online === 1 ? green[500] : red[500],
|
color: doctor.online == 1 ? green[500] : red[500],
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{doctor.online === 1 ? "🟢 Online" : "🔴 Offline"}
|
{doctor.online == 1 ? "🟢 Online" : "🔴 Offline"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
@@ -464,8 +465,8 @@ const transaksiDataDefault = [
|
|||||||
<FormControl fullWidth>
|
<FormControl fullWidth>
|
||||||
<InputLabel>Tipe</InputLabel>
|
<InputLabel>Tipe</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
value={type}
|
value={typeDokter}
|
||||||
onChange={(e) => setType(e.target.value)}
|
onChange={(e) => setTypeDokter(e.target.value)}
|
||||||
>
|
>
|
||||||
<MenuItem value="0">Harian</MenuItem>
|
<MenuItem value="0">Harian</MenuItem>
|
||||||
<MenuItem value="1">Mingguan</MenuItem>
|
<MenuItem value="1">Mingguan</MenuItem>
|
||||||
@@ -482,7 +483,7 @@ const transaksiDataDefault = [
|
|||||||
inputFormat="dd/MM/yyyy"
|
inputFormat="dd/MM/yyyy"
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
if (!value) return; // Hindari error jika value null atau undefined
|
if (!value) return; // Hindari error jika value null atau undefined
|
||||||
if (type == 0) {
|
if (typeDokter == 0) {
|
||||||
setStartDateDokter(value);
|
setStartDateDokter(value);
|
||||||
} else {
|
} else {
|
||||||
setStartDateDokter(new Date(value.getFullYear(), value.getMonth(), 1));
|
setStartDateDokter(new Date(value.getFullYear(), value.getMonth(), 1));
|
||||||
@@ -501,7 +502,7 @@ const transaksiDataDefault = [
|
|||||||
value={endDateDokter}
|
value={endDateDokter}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
if (!value) return; // Hindari error jika value null atau undefined
|
if (!value) return; // Hindari error jika value null atau undefined
|
||||||
if (type == 0) {
|
if (typeDokter == 0) {
|
||||||
setEndDateDokter(value);
|
setEndDateDokter(value);
|
||||||
} else {
|
} else {
|
||||||
setEndDateDokter(new Date(value.getFullYear(), value.getMonth(), 1));
|
setEndDateDokter(new Date(value.getFullYear(), value.getMonth(), 1));
|
||||||
|
|||||||
@@ -337,6 +337,8 @@ export default function List() {
|
|||||||
<TableCell align="left">{row.date_consultation ? fDateTime(row.date_consultation) : '-'}</TableCell>
|
<TableCell align="left">{row.date_consultation ? fDateTime(row.date_consultation) : '-'}</TableCell>
|
||||||
<TableCell align="left">{row.patient_name ?? '-'}</TableCell>
|
<TableCell align="left">{row.patient_name ?? '-'}</TableCell>
|
||||||
<TableCell align="left">{row.doctor_name ?? '-'}</TableCell>
|
<TableCell align="left">{row.doctor_name ?? '-'}</TableCell>
|
||||||
|
<TableCell align="left">{row.apotek_name ?? '-'}</TableCell>
|
||||||
|
<TableCell align="left">{row.price_delivery ?? '-'}</TableCell>
|
||||||
<TableCell align="left">{row.status_prescription ?? '-'}</TableCell>
|
<TableCell align="left">{row.status_prescription ?? '-'}</TableCell>
|
||||||
{/* <TableCell align="center">
|
{/* <TableCell align="center">
|
||||||
<ButtonGroup variant="text" aria-label="text button group">
|
<ButtonGroup variant="text" aria-label="text button group">
|
||||||
@@ -543,6 +545,12 @@ export default function List() {
|
|||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Doctor
|
Doctor
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell style={headStyle} align="left">
|
||||||
|
Nama Apotek
|
||||||
|
</TableCell>
|
||||||
|
<TableCell style={headStyle} align="left">
|
||||||
|
Harga Ongkos Kirim
|
||||||
|
</TableCell>
|
||||||
<TableCell style={headStyle} align="left">
|
<TableCell style={headStyle} align="left">
|
||||||
Status
|
Status
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
Reference in New Issue
Block a user