diff --git a/app/Models/Mis/SttMedicalHistory.php b/app/Models/Mis/SttMedicalHistory.php index 39b5085..4208aaf 100644 --- a/app/Models/Mis/SttMedicalHistory.php +++ b/app/Models/Mis/SttMedicalHistory.php @@ -39,7 +39,12 @@ class SttMedicalHistory extends Model ->where('has_lost', false) ->exists(); - return !$hasOpenIssue; + $hasNotBadStatus = $this->archiveInfo() + ->whereNotNull('status_id') + ->whereNot('status_id', 1) + ->exists(); + + return ($hasOpenIssue !== true && $hasNotBadStatus === true); } /** diff --git a/app/Models/SI/SttMedicalHistory.php b/app/Models/SI/SttMedicalHistory.php index 66de56a..224c348 100644 --- a/app/Models/SI/SttMedicalHistory.php +++ b/app/Models/SI/SttMedicalHistory.php @@ -52,7 +52,12 @@ class SttMedicalHistory extends Model ->where('has_lost', false) ->exists(); - return !$hasOpenIssue; + $hasNotBadStatus = $this->archiveInfo() + ->whereNotNull('status_id') + ->whereNot('status_id', 1) + ->exists(); + + return ($hasOpenIssue !== true && $hasNotBadStatus === true); } /**