|
@@ -340,29 +340,38 @@ class PracticeManagementController extends Controller
|
|
|
// poll to check if there are patients with active mcp requests
|
|
|
public function getPatientsInQueue(Request $request)
|
|
|
{
|
|
|
- $requests = McpRequest::where('is_active', true)->where('was_claimed', false)->limit(3)->get();
|
|
|
+
|
|
|
+ $myInitiatives = $this->performer->pro->initiatives;
|
|
|
+ if($myInitiatives){
|
|
|
+ $myInitiatives = strtoupper($myInitiatives);
|
|
|
+ }
|
|
|
+ $myInitiativesList = explode('|', $myInitiatives);
|
|
|
+
|
|
|
+ $myForeignLanguages = $this->performer->pro->foreign_languages;
|
|
|
+ if($myForeignLanguages){
|
|
|
+ $myForeignLanguages = strtoupper($myForeignLanguages);
|
|
|
+ }
|
|
|
+ $myForeignLanguagesList = explode('|', $myForeignLanguages);
|
|
|
+
|
|
|
+ $clients = Client::whereNotNull('active_mcp_request_id')->where(function($query) use ($myInitiativesList){
|
|
|
+ $query->whereNull('initiative')->orWhereIn('initiative', $myInitiativesList);
|
|
|
+ })
|
|
|
+ ->where(function($query) use ($myForeignLanguagesList) {
|
|
|
+ $query->whereNull('preferred_foreign_language')->orWhereIn('preferred_foreign_language', $myForeignLanguagesList);
|
|
|
+ })->limit(3)->get();
|
|
|
$results = [];
|
|
|
- if ($requests && count($requests)) {
|
|
|
- foreach ($requests as $mcpRequest) {
|
|
|
- $client = $mcpRequest->client;
|
|
|
- // if ($client->initiative) {
|
|
|
- // if (strpos($this->performer->pro->initiative, $client->initiative) !== false) {
|
|
|
- // $results[] = [
|
|
|
- // "clientUid" => $client->uid,
|
|
|
- // "name" => $client->displayName(),
|
|
|
- // "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
|
|
|
- // ];
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- $results[] = [
|
|
|
- "clientUid" => $client->uid,
|
|
|
- "name" => $client->displayName(),
|
|
|
- "initials" => substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
|
|
|
- ];
|
|
|
- //}
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ foreach($clients as $client){
|
|
|
+ $results[] = [
|
|
|
+ 'clientUid' => $client->uid,
|
|
|
+ 'name' => $client->displayName(),
|
|
|
+ 'initials'=> substr($client->name_first, 0, 1) . substr($client->name_last, 0, 1)
|
|
|
+ ];
|
|
|
}
|
|
|
+
|
|
|
return json_encode($results);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public function currentWork(Request $request)
|