update message summary
This commit is contained in:
@@ -10,6 +10,9 @@ use App\Models\Message;
|
||||
use App\Models\File;
|
||||
use App\Models\Livechat;
|
||||
use App\Models\Person;
|
||||
use App\Models\Prescription;
|
||||
use App\Models\PrescriptionItem;
|
||||
use App\Models\Drug;
|
||||
use App\Models\OLDLMS\User;
|
||||
use App\Models\OLDLMS\UserDetail;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -234,8 +237,6 @@ class ChatController extends Controller
|
||||
if($address){
|
||||
$address = $address->sAlamat;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Ini Untul Chat
|
||||
@@ -259,6 +260,19 @@ class ChatController extends Controller
|
||||
if ($livechat->health_certificate_start && $livechat->health_certificate_end){
|
||||
$healthSertificate = True;
|
||||
}
|
||||
|
||||
$prescription = Prescription::where('livechat_id', $livechat->id)->first();
|
||||
$prescriptionItems = PrescriptionItem::with('drug')->where('prescription_id',$prescription->id)->get();
|
||||
$prescriptions = [];
|
||||
if ($prescriptionItems){
|
||||
foreach($prescriptionItems as $item){
|
||||
$row['medicine'] = $item->drug->name;
|
||||
$row['direction'] = $item->direction;
|
||||
$row['signa'] = $item->signa;
|
||||
$row['note'] = $item->note;
|
||||
array_push($prescriptions, $row);
|
||||
}
|
||||
}
|
||||
// Berikan respons yang sesuai ke klien
|
||||
return response()->json([
|
||||
'message' => 'Message sent successfully',
|
||||
@@ -292,6 +306,7 @@ class ChatController extends Controller
|
||||
'to' => $data->lastItem(),
|
||||
],
|
||||
'summary' => $consultationSummary,
|
||||
'prescription' => $prescriptions
|
||||
|
||||
]
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user