<?php

use App\Models\Point;

$category = 'OBJECTIVE_SYSTEM';
$endPoint = 'upsertNoteSingleton';

$point = Point::where('added_in_note_id', $note->id)->where('category', $category)->orderBy('id', 'DESC')->first();
$contentData = [
    "reviewed_relevant_labs" => null,
    "lab_findings" => null,
    "reviewed_relevant_rpm_data" => null,
    "rpm_findings" => null,
    "rpm_data_unavailable" => null
];
if (!!@$point->data) {
    $contentData = json_decode($point->data, true);
}

$output = [];
if(@$contentData["reviewed_relevant_labs"]) {
    $output[] = "Reviewed relevant labs.";
    if(@$contentData["lab_findings"]) {
        $output[] = "Findings: {$contentData["lab_findings"]}.";
    }
}
if(@$contentData["rpm_data_unavailable"]) {
    $output[] = "Remote monitoring data not available.";
}
elseif(@$contentData["reviewed_relevant_rpm_data"]) {
    $output[] = "Reviewed relevant remote measurements.";
    if(@$contentData["rpm_findings"]) {
        $output[] = "Findings: {$contentData["rpm_findings"]}.";
    }
}
?>
{{ count($output) ? implode(' ', $output) : '-' }}
