update
This commit is contained in:
@@ -786,8 +786,7 @@ class DokterController extends Controller
|
|||||||
return response()->json(['icon' => 'success', 'status' => 'Success', 'message' => 'Expertise Saved']);
|
return response()->json(['icon' => 'success', 'status' => 'Success', 'message' => 'Expertise Saved']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function resolvePeriksaHierarchyStatus($currentStatus, $proposedStatus): string
|
protected function resolvePeriksaHierarchyStatus($currentStatus, $proposedStatus): string {
|
||||||
{
|
|
||||||
$currentStatus = trim((string) $currentStatus);
|
$currentStatus = trim((string) $currentStatus);
|
||||||
$proposedStatus = trim((string) $proposedStatus);
|
$proposedStatus = trim((string) $proposedStatus);
|
||||||
|
|
||||||
@@ -812,27 +811,26 @@ class DokterController extends Controller
|
|||||||
|
|
||||||
return $currentStatus;
|
return $currentStatus;
|
||||||
}
|
}
|
||||||
protected function periksaHierarchyStatusRank($status): ?int
|
protected function periksaHierarchyStatusRank($status): ?int {
|
||||||
{
|
|
||||||
$normalized = $this->normalizePeriksaStatus($status);
|
$normalized = $this->normalizePeriksaStatus($status);
|
||||||
|
|
||||||
if ($normalized === '') {
|
if ($normalized === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($normalized === 'penerimaan sampel') {
|
if ($normalized === 'Penerimaan Sampel') {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($normalized, ['pemeriksaan awal', 'pemeriksaan sampel', 'proses analisis sampel'], true)) {
|
if (in_array($normalized, ['Pemeriksaan awal', 'Pemeriksaan Sampel', 'Proses Analisis Sampel'], true)) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_starts_with($normalized, 'data bd di terima') || str_starts_with($normalized, 'data bd diterima')) {
|
if (str_starts_with($normalized, 'Data BD di Terima')) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($normalized === 'pewarnaan langsung') {
|
if ($normalized === 'Pewarnaan Langsung') {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,38 +838,36 @@ class DokterController extends Controller
|
|||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_starts_with($normalized, 'otor maldi')) {
|
if (str_starts_with($normalized, 'Otor Maldi (Un Verified)')) {
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_starts_with($normalized, 'preliminary result')) {
|
if (str_starts_with($normalized, 'Preliminary Results')) {
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_starts_with($normalized, 'data vitek di terima') || str_starts_with($normalized, 'data vitek diterima')) {
|
if (str_starts_with($normalized, 'Data Vitek di Terima')) {
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_starts_with($normalized, 'expertise')) {
|
if (str_starts_with($normalized, 'Expertise Saved (Un Verified)')) {
|
||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($normalized, ['selesai', 'final result'], true)) {
|
if (in_array($normalized, ['Selesai', 'Final Result'], true)) {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
protected function normalizePeriksaStatus($status): string
|
protected function normalizePeriksaStatus($status): string {
|
||||||
{
|
|
||||||
$status = strtolower(trim((string) $status));
|
$status = strtolower(trim((string) $status));
|
||||||
$status = str_replace(['_', '-'], ' ', $status);
|
$status = str_replace(['_', '-'], ' ', $status);
|
||||||
$status = preg_replace('/\s+/', ' ', $status);
|
$status = preg_replace('/\s+/', ' ', $status);
|
||||||
|
|
||||||
return trim($status);
|
return trim($status);
|
||||||
}
|
}
|
||||||
protected function isProsesingKoloniMediaStatus(string $normalizedStatus): bool
|
protected function isProsesingKoloniMediaStatus(string $normalizedStatus): bool {
|
||||||
{
|
|
||||||
$exactStatuses = [
|
$exactStatuses = [
|
||||||
'tidak ada pertumbuhan',
|
'tidak ada pertumbuhan',
|
||||||
'tidak lanjut identifikasi',
|
'tidak lanjut identifikasi',
|
||||||
@@ -898,13 +894,11 @@ class DokterController extends Controller
|
|||||||
|| str_starts_with($normalizedStatus, 'proses identifikasi')
|
|| str_starts_with($normalizedStatus, 'proses identifikasi')
|
||||||
|| str_starts_with($normalizedStatus, 'proses uji kepekaan');
|
|| str_starts_with($normalizedStatus, 'proses uji kepekaan');
|
||||||
}
|
}
|
||||||
protected function shouldMarkAsCritical(Request $request): bool
|
protected function shouldMarkAsCritical(Request $request): bool {
|
||||||
{
|
|
||||||
$flag = strtolower((string) $request->input('nilai_kritis', '0'));
|
$flag = strtolower((string) $request->input('nilai_kritis', '0'));
|
||||||
return in_array($flag, ['1', 'true', 'on', 'yes'], true);
|
return in_array($flag, ['1', 'true', 'on', 'yes'], true);
|
||||||
}
|
}
|
||||||
protected function upsertCriticalValueSample(Periksa $periksa): void
|
protected function upsertCriticalValueSample(Periksa $periksa): void {
|
||||||
{
|
|
||||||
$now = Carbon::now();
|
$now = Carbon::now();
|
||||||
$criticalSample = CriticalValueSample::firstOrNew(['periksa_id' => $periksa->id]);
|
$criticalSample = CriticalValueSample::firstOrNew(['periksa_id' => $periksa->id]);
|
||||||
$criticalSample->nofoto = $periksa->nofoto;
|
$criticalSample->nofoto = $periksa->nofoto;
|
||||||
@@ -913,7 +907,6 @@ class DokterController extends Controller
|
|||||||
$criticalSample->nmpasien = $periksa->nmpasien;
|
$criticalSample->nmpasien = $periksa->nmpasien;
|
||||||
$criticalSample->nm_spesimen = $periksa->nm_spesimen;
|
$criticalSample->nm_spesimen = $periksa->nm_spesimen;
|
||||||
|
|
||||||
// Keep the first critical timestamp intact on repeated clicks.
|
|
||||||
if (empty($criticalSample->critical_set_at)) {
|
if (empty($criticalSample->critical_set_at)) {
|
||||||
$criticalSample->critical_set_at = $now;
|
$criticalSample->critical_set_at = $now;
|
||||||
$criticalSample->critical_set_by_user_id = Session('id');
|
$criticalSample->critical_set_by_user_id = Session('id');
|
||||||
@@ -922,8 +915,7 @@ class DokterController extends Controller
|
|||||||
|
|
||||||
$criticalSample->save();
|
$criticalSample->save();
|
||||||
}
|
}
|
||||||
protected function markCriticalValueAsRead(CriticalValueSample $criticalSample): void
|
protected function markCriticalValueAsRead(CriticalValueSample $criticalSample): void {
|
||||||
{
|
|
||||||
if (!empty($criticalSample->followed_up_at)) {
|
if (!empty($criticalSample->followed_up_at)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -933,16 +925,14 @@ class DokterController extends Controller
|
|||||||
$criticalSample->followed_up_by_name = Session('nama');
|
$criticalSample->followed_up_by_name = Session('nama');
|
||||||
$criticalSample->save();
|
$criticalSample->save();
|
||||||
}
|
}
|
||||||
protected function getPendingCriticalValueItems()
|
protected function getPendingCriticalValueItems() {
|
||||||
{
|
|
||||||
return $this->appendCriticalValueTatMeta(
|
return $this->appendCriticalValueTatMeta(
|
||||||
CriticalValueSample::whereNull('followed_up_at')
|
CriticalValueSample::whereNull('followed_up_at')
|
||||||
->orderBy('critical_set_at', 'asc')
|
->orderBy('critical_set_at', 'asc')
|
||||||
->get()
|
->get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
protected function resolveCriticalValueReportRange(Request $request): array
|
protected function resolveCriticalValueReportRange(Request $request): array {
|
||||||
{
|
|
||||||
$defaultStart = Carbon::now()->startOfMonth()->toDateString();
|
$defaultStart = Carbon::now()->startOfMonth()->toDateString();
|
||||||
$defaultEnd = Carbon::now()->endOfMonth()->toDateString();
|
$defaultEnd = Carbon::now()->endOfMonth()->toDateString();
|
||||||
$startDate = trim((string) $request->query('start_date', $defaultStart));
|
$startDate = trim((string) $request->query('start_date', $defaultStart));
|
||||||
@@ -975,8 +965,7 @@ class DokterController extends Controller
|
|||||||
'end_at' => $end,
|
'end_at' => $end,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
protected function getFollowedCriticalValueItems(?Carbon $startAt = null, ?Carbon $endAt = null)
|
protected function getFollowedCriticalValueItems(?Carbon $startAt = null, ?Carbon $endAt = null) {
|
||||||
{
|
|
||||||
$query = CriticalValueSample::whereNotNull('followed_up_at');
|
$query = CriticalValueSample::whereNotNull('followed_up_at');
|
||||||
|
|
||||||
if ($startAt !== null) {
|
if ($startAt !== null) {
|
||||||
@@ -994,8 +983,7 @@ class DokterController extends Controller
|
|||||||
->get()
|
->get()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
protected function appendCriticalValueTatMeta($items)
|
protected function appendCriticalValueTatMeta($items) {
|
||||||
{
|
|
||||||
return $items->map(function ($item) {
|
return $items->map(function ($item) {
|
||||||
$item->tat_minutes = null;
|
$item->tat_minutes = null;
|
||||||
$item->tat_duration_label = '-';
|
$item->tat_duration_label = '-';
|
||||||
@@ -1014,8 +1002,7 @@ class DokterController extends Controller
|
|||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
protected function formatTatDuration(int $totalMinutes): string
|
protected function formatTatDuration(int $totalMinutes): string {
|
||||||
{
|
|
||||||
$hours = intdiv($totalMinutes, 60);
|
$hours = intdiv($totalMinutes, 60);
|
||||||
$minutes = $totalMinutes % 60;
|
$minutes = $totalMinutes % 60;
|
||||||
|
|
||||||
@@ -1025,8 +1012,7 @@ class DokterController extends Controller
|
|||||||
|
|
||||||
return $minutes.' menit';
|
return $minutes.' menit';
|
||||||
}
|
}
|
||||||
public function criticalValueNotifications(Request $request)
|
public function criticalValueNotifications(Request $request) {
|
||||||
{
|
|
||||||
$highlightId = $request->query('highlight');
|
$highlightId = $request->query('highlight');
|
||||||
$reportRange = $this->resolveCriticalValueReportRange($request);
|
$reportRange = $this->resolveCriticalValueReportRange($request);
|
||||||
$items = $this->getPendingCriticalValueItems();
|
$items = $this->getPendingCriticalValueItems();
|
||||||
@@ -1040,8 +1026,7 @@ class DokterController extends Controller
|
|||||||
'endDate' => $reportRange['end_date'],
|
'endDate' => $reportRange['end_date'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function criticalValueNotificationExport(Request $request)
|
public function criticalValueNotificationExport(Request $request) {
|
||||||
{
|
|
||||||
$type = $request->query('type', 'pending');
|
$type = $request->query('type', 'pending');
|
||||||
$isFollowed = $type === 'followed';
|
$isFollowed = $type === 'followed';
|
||||||
$reportRange = $this->resolveCriticalValueReportRange($request);
|
$reportRange = $this->resolveCriticalValueReportRange($request);
|
||||||
@@ -1121,8 +1106,7 @@ class DokterController extends Controller
|
|||||||
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function criticalValueNotificationSummary()
|
public function criticalValueNotificationSummary() {
|
||||||
{
|
|
||||||
if (Session::get('id') === null) {
|
if (Session::get('id') === null) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'count' => 0,
|
'count' => 0,
|
||||||
@@ -1147,13 +1131,11 @@ class DokterController extends Controller
|
|||||||
])->render(),
|
])->render(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function criticalValueNotificationOpen($id)
|
public function criticalValueNotificationOpen($id) {
|
||||||
{
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('criticalValueNotifications', ['highlight' => $id]);
|
->route('criticalValueNotifications', ['highlight' => $id]);
|
||||||
}
|
}
|
||||||
public function criticalValueNotificationMarkRead($id)
|
public function criticalValueNotificationMarkRead($id) {
|
||||||
{
|
|
||||||
$criticalSample = CriticalValueSample::findOrFail($id);
|
$criticalSample = CriticalValueSample::findOrFail($id);
|
||||||
if (!empty($criticalSample->followed_up_at)) {
|
if (!empty($criticalSample->followed_up_at)) {
|
||||||
return redirect()
|
return redirect()
|
||||||
@@ -1194,8 +1176,7 @@ class DokterController extends Controller
|
|||||||
->route('criticalValueNotifications', ['highlight' => $criticalSample->id])
|
->route('criticalValueNotifications', ['highlight' => $criticalSample->id])
|
||||||
->with('success', 'Sample nilai kritis sudah ditandai sudah ditindaklanjuti.');
|
->with('success', 'Sample nilai kritis sudah ditandai sudah ditindaklanjuti.');
|
||||||
}
|
}
|
||||||
public function batalPeriksa(Request $request)
|
public function batalPeriksa(Request $request) {
|
||||||
{
|
|
||||||
$id = $request->input('id');
|
$id = $request->input('id');
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -1227,8 +1208,7 @@ class DokterController extends Controller
|
|||||||
'message' => 'Pemeriksaan berhasil dibatalkan.'
|
'message' => 'Pemeriksaan berhasil dibatalkan.'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
public function batalPeriksaTerima(Request $request)
|
public function batalPeriksaTerima(Request $request) {
|
||||||
{
|
|
||||||
$id = $request->input('id');
|
$id = $request->input('id');
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
Reference in New Issue
Block a user