public function patientReport(Request $request, $patientId)
 {
     if (!HospitalEmployee::isNurse()) {
         return response()->json(["success" => false, "error" => 'notlogin or notvalid']);
     }
     $height = $request->input('height');
     $weight = $request->input('weight');
     $pressure = $request->input('pressure');
     $error = [];
     if (!$height) {
         $error[] = 'height_not_found';
     }
     if (!$weight) {
         $error[] = 'weight_not_found';
     }
     if (!$pressure) {
         $error[] = 'pressure_not_found';
     }
     if (sizeof($error) != 0) {
         return response()->json(["success" => false, "message" => $error]);
     }
     $patientReport = new PatientReport();
     $patientReport->patient_id = $patientId;
     $patientReport->height = $height;
     $patientReport->weight = $weight;
     $patientReport->pressure = $pressure;
     $patientReport->save();
     return response()->json(["success" => true, "data" => $patientReport, "meessage" => 'saved record patient']);
 }
Beispiel #2
0
 public function latestPatientReport()
 {
     return PatientReport::where('patient_id', $this->id)->orderBy('patient_id', 'desc')->first();
 }