update
This commit is contained in:
@@ -471,7 +471,7 @@ class DokterController extends Controller
|
||||
$tglverifikasi = $periksa->verifikasi ?? $today;
|
||||
|
||||
$cekganda = Periksa::where('noregister', $noregister)->where('nmadendum', $nmadendum)->where('nm_spesimen', 'SPUTUM')->where('id', '!=', $idperiksa)->get();
|
||||
$statusdraft = 'Proses Analisis Sampel';
|
||||
$statusdraft = 'Pemeriksaan awal';
|
||||
KomponenJawaban::where('accnumber', $nofoto)->where('template', $dlp)->delete();
|
||||
$data = $request->except(['_token', 'periksa_id', 'val01', 'val10', 'acc_number']);
|
||||
foreach ($data as $key => $value) {
|
||||
@@ -582,6 +582,7 @@ class DokterController extends Controller
|
||||
$cekdokter = optional(User::find($iddokter));
|
||||
$cekanalis = optional(User::find($analis));
|
||||
$cekppds3 = optional(User::find($ppds3));
|
||||
$statusdraft = $this->resolvePeriksaHierarchyStatus($periksa->status, $statusdraft);
|
||||
switch ($kerja) {
|
||||
case 'verifikasi':
|
||||
if ($periksa->status != 'Selesai'){
|
||||
@@ -601,7 +602,7 @@ class DokterController extends Controller
|
||||
'akhir' => $tglverifikasi,
|
||||
'nmexcutor' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'status' => 'Selesai',
|
||||
'status' => $this->resolvePeriksaHierarchyStatus($periksa->status, 'Selesai'),
|
||||
];
|
||||
$periksa->update($updateData);
|
||||
if ($this->shouldMarkAsCritical($request)) {
|
||||
@@ -639,7 +640,7 @@ class DokterController extends Controller
|
||||
'nmdrafter' => Session('nama'),
|
||||
'nmexcutor' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'status' => 'Pewarnaan Langsung',
|
||||
'status' => $this->resolvePeriksaHierarchyStatus($periksa->status, 'Pewarnaan Langsung'),
|
||||
]);
|
||||
return response()->json(['icon' => 'success', 'status' => 'Success', 'message' => 'Set Status Pewarnaan Langsung']);
|
||||
case 'preliminary':
|
||||
@@ -656,7 +657,7 @@ class DokterController extends Controller
|
||||
'verifikasi' => $tglverifikasi,
|
||||
'nmexcutor' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'status' => 'Preliminary Results',
|
||||
'status' => $this->resolvePeriksaHierarchyStatus($periksa->status, 'Preliminary Results'),
|
||||
];
|
||||
$periksa->update($updateData);
|
||||
if ($this->shouldMarkAsCritical($request)) {
|
||||
@@ -687,7 +688,7 @@ class DokterController extends Controller
|
||||
'nmexcutor' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'nmpembaca' => Session('nama'),
|
||||
'status' => 'Expertise Saved (Un Verified)',
|
||||
'status' => $this->resolvePeriksaHierarchyStatus($periksa->status, 'Expertise Saved (Un Verified)'),
|
||||
];
|
||||
$periksa->update($updateData);
|
||||
$surat = self::genSurat($periksa->id, 'dengan kop');
|
||||
@@ -714,7 +715,7 @@ class DokterController extends Controller
|
||||
'nmexcutor' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'nmpembaca' => Session('nama'),
|
||||
'status' => 'Otor Maldi (Un Verified)',
|
||||
'status' => $this->resolvePeriksaHierarchyStatus($periksa->status, 'Otor Maldi (Un Verified)'),
|
||||
];
|
||||
$periksa->update($updateData);
|
||||
$surat = self::genSurat($periksa->id, 'dengan kop');
|
||||
@@ -785,6 +786,118 @@ class DokterController extends Controller
|
||||
return response()->json(['icon' => 'success', 'status' => 'Success', 'message' => 'Expertise Saved']);
|
||||
}
|
||||
}
|
||||
protected function resolvePeriksaHierarchyStatus($currentStatus, $proposedStatus): string
|
||||
{
|
||||
$currentStatus = trim((string) $currentStatus);
|
||||
$proposedStatus = trim((string) $proposedStatus);
|
||||
|
||||
if ($proposedStatus === '') {
|
||||
return $currentStatus;
|
||||
}
|
||||
|
||||
$currentRank = $this->periksaHierarchyStatusRank($currentStatus);
|
||||
$proposedRank = $this->periksaHierarchyStatusRank($proposedStatus);
|
||||
|
||||
if ($currentStatus === '') {
|
||||
return $proposedStatus;
|
||||
}
|
||||
|
||||
if ($proposedRank === null) {
|
||||
return $currentRank === null ? $proposedStatus : $currentStatus;
|
||||
}
|
||||
|
||||
if ($currentRank === null || $proposedRank >= $currentRank) {
|
||||
return $proposedStatus;
|
||||
}
|
||||
|
||||
return $currentStatus;
|
||||
}
|
||||
protected function periksaHierarchyStatusRank($status): ?int
|
||||
{
|
||||
$normalized = $this->normalizePeriksaStatus($status);
|
||||
|
||||
if ($normalized === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($normalized === 'penerimaan sampel') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (in_array($normalized, ['pemeriksaan awal', 'pemeriksaan sampel', 'proses analisis sampel'], true)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'data bd di terima') || str_starts_with($normalized, 'data bd diterima')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ($normalized === 'pewarnaan langsung') {
|
||||
return 4;
|
||||
}
|
||||
|
||||
if ($this->isProsesingKoloniMediaStatus($normalized)) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'otor maldi')) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'preliminary result')) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'data vitek di terima') || str_starts_with($normalized, 'data vitek diterima')) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
if (str_starts_with($normalized, 'expertise')) {
|
||||
return 9;
|
||||
}
|
||||
|
||||
if (in_array($normalized, ['selesai', 'final result'], true)) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
protected function normalizePeriksaStatus($status): string
|
||||
{
|
||||
$status = strtolower(trim((string) $status));
|
||||
$status = str_replace(['_', '-'], ' ', $status);
|
||||
$status = preg_replace('/\s+/', ' ', $status);
|
||||
|
||||
return trim($status);
|
||||
}
|
||||
protected function isProsesingKoloniMediaStatus(string $normalizedStatus): bool
|
||||
{
|
||||
$exactStatuses = [
|
||||
'tidak ada pertumbuhan',
|
||||
'tidak lanjut identifikasi',
|
||||
'tidak tindak lanjut identifikasi',
|
||||
'inkubasi lanjutan',
|
||||
'sub kultur',
|
||||
'menunggu kultur yg lain',
|
||||
'menunggu kultur yang lain',
|
||||
'proses identifikasi dan uji kepekaan',
|
||||
'id/ast pending result',
|
||||
'data malditof diterima',
|
||||
'data malditof di terima',
|
||||
'sedang id+ast',
|
||||
'sedang malditof',
|
||||
'pertumbuhan primer',
|
||||
];
|
||||
|
||||
if (in_array($normalizedStatus, $exactStatuses, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return str_starts_with($normalizedStatus, 'prosesing koloni media')
|
||||
|| str_starts_with($normalizedStatus, 'processing koloni media')
|
||||
|| str_starts_with($normalizedStatus, 'proses identifikasi')
|
||||
|| str_starts_with($normalizedStatus, 'proses uji kepekaan');
|
||||
}
|
||||
protected function shouldMarkAsCritical(Request $request): bool
|
||||
{
|
||||
$flag = strtolower((string) $request->input('nilai_kritis', '0'));
|
||||
|
||||
Reference in New Issue
Block a user