Untitled
unknown
plain_text
a year ago
1.9 kB
8
Indexable
public function getDataVitailSignRangeAnesthesia()
{
$formData = $this->request->getJSON();
$anesthesiaModel = new AssessmentAnesthesiaModel();
$examinationModel = new ExaminationModel();
$anesthesiaData = $this->lowerKey($anesthesiaModel->where('document_id', $formData->document_id)->first());
if (empty($anesthesiaData)) {
return $this->response->setJSON(['message' => 'Data not found.', 'respon' => false]);
}
$startAnesthesia = $anesthesiaData['start_anesthesia'];
$endAnesthesia = $anesthesiaData['end_anesthesia'];
$visitId = $anesthesiaData['visit_id'];
$examinationQuery = $examinationModel->where('visit_id', $visitId)
->where('clinic_id', 'P002');
if (!is_null($startAnesthesia)) {
$examinationQuery->where('examination_date >=', $startAnesthesia);
}
if (!is_null($endAnesthesia)) {
$examinationQuery->where('examination_date <=', $endAnesthesia);
}
$examinationData = $this->lowerKey($examinationQuery->findAll());
$responseData = [
'assessment_anesthesia' => [
'start_anesthesia' => $anesthesiaData['start_anesthesia'],
'end_anesthesia' => $anesthesiaData['end_anesthesia'],
'document_id' => $anesthesiaData['document_id']
],
'examination_info' => $examinationData
];
if (!empty($examinationData)) {
return $this->response->setJSON(['message' => 'Data found.', 'respon' => true, 'data' => $responseData]);
} else {
return $this->response->setJSON(['message' => 'Data not found.', 'respon' => false, 'data' => $responseData]);
}
}// new 1/08Editor is loading...
Leave a Comment