[WIP] Encounter
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Icd;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Practitioner;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
@@ -30,6 +32,35 @@ class OptionController extends Controller
|
||||
|
||||
return $icds;
|
||||
break;
|
||||
case 'doctors':
|
||||
$doctors = Practitioner::query()
|
||||
->whereHas('person', function ($person) use ($request) {
|
||||
$person->where('name', 'LIKE', '%'.$request->search.'%');
|
||||
})
|
||||
->limit('10')
|
||||
->get();
|
||||
|
||||
$doctors = $doctors->map(function($doctor) {
|
||||
$doctorDetail = $doctor->person->toArray();
|
||||
unset($doctorDetail['id']);
|
||||
|
||||
return array_merge([
|
||||
'id' => $doctor->id,
|
||||
'code' => $doctor->code
|
||||
], $doctorDetail);
|
||||
});
|
||||
|
||||
return $doctors;
|
||||
break;
|
||||
case 'healthcares':
|
||||
$healthcares = Organization::query()
|
||||
->hospital()
|
||||
->where('name', 'LIKE', '%'.$request->search.'%')
|
||||
->limit('10')
|
||||
->get();
|
||||
|
||||
return $healthcares;
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
|
||||
Reference in New Issue
Block a user