Sfoglia il codice sorgente

fixed .env.example

= 3 anni fa
parent
commit
9cb87cd9d7

+ 64 - 0
.env.example

@@ -0,0 +1,64 @@
+APP_NAME=Stag
+APP_ENV=local
+APP_KEY=base64:1yKRgeLWTeEXTfh51vXtJaf6GJaRUn4NHzdlOdyDpRY=
+APP_DEBUG=true
+APP_URL=http://localhost
+
+LOG_CHANNEL=stack
+
+DB_CONNECTION=pgsql
+DB_HOST=127.0.0.1
+DB_PORT=5432
+DB_DATABASE=stag2
+DB_USERNAME=postgres
+DB_PASSWORD=pass
+
+DB_HOST_FDB=localhost
+DB_PORT_FDB=5432
+DB_DATABASE_FDB=fdbhealth
+DB_USERNAME_FDB=postgres
+DB_PASSWORD_FDB=pass
+
+BROADCAST_DRIVER=log
+CACHE_DRIVER=file
+QUEUE_CONNECTION=sync
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_MAILER=smtp
+MAIL_HOST=smtp.mailtrap.io
+MAIL_PORT=2525
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
+MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS=null
+MAIL_FROM_NAME="${APP_NAME}"
+
+AWS_ACCESS_KEY_ID=
+AWS_SECRET_ACCESS_KEY=
+AWS_DEFAULT_REGION=us-east-1
+AWS_BUCKET=
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_APP_CLUSTER=mt1
+
+MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+
+BACKEND_URL="http://localhost:8080/api"
+ADMIN_PORTAL_URL="http://localhost:3000"
+
+AUTH_URL="https://pro.leadershiphealth.local"
+
+BACKEND_WS_URL=http://localhost:8080/ws
+AGORA_APPID=9d04292b03524927a8fe9d937a448d85
+AGORA_MODE=screen
+
+GOOGLE_SPREADSHEET_ID=15pM6zM5o-S55SCLO5qkAbKCWAzYRZvDkAbgnsDNqWjk
+GOOGLE_SPREADSHEET_PRODUCTS_SHEET_NAME=records

+ 152 - 0
app/Console/Commands/clientsToGsheet.php

@@ -0,0 +1,152 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Models\BDTDevice;
+use App\Models\Client;
+use App\Models\SimpleProduct;
+use Google\Service\Sheets\ValueRange;
+use Google_Client;
+use Illuminate\Console\Command;
+use Revolution\Google\Sheets\Facades\Sheets;
+use Revolution\Google\Sheets\Sheets as SheetsSheets;
+
+class clientsToGsheet extends Command
+{
+  
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'clients:export-to-gsheet';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Export records to gsheet';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        $this->pushSheet();
+        return 0;
+    }
+
+
+    function pushSheet(){
+
+        $spreadsheetId = config('app.googleSpreadsheetId');
+        $googleSpreadsheetProductsSheetName = config('app.googleSpreadsheetProductsSheetName'); 
+       
+        $client = $this->getApiClient();
+        $service = new \Google\Service\Sheets($client);
+
+        
+        $values = $this->getValues();
+
+
+        $range = $googleSpreadsheetProductsSheetName.'!A1:V1';
+        $body = new ValueRange([
+            'values' => $values
+        ]);
+        $params = [
+           'valueInputOption' => 'RAW'
+        ];
+
+        $result = $service->spreadsheets_values->append($spreadsheetId, $range, $body, $params);
+
+        $this->info(json_encode($result));
+
+    }
+
+
+    function getApiClient(){
+      
+        $KEY_FILE_LOCATION = storage_path('stag-gsheets-d9ead2f78b4b.json');
+
+        $client = new Google_Client();
+        $client->setApplicationName("My Rooster Admin");
+        $client->setAuthConfig($KEY_FILE_LOCATION);
+        
+        $client->setScopes([\Google\Service\Sheets::DRIVE, \Google\Service\Sheets::SPREADSHEETS]);
+
+        return $client;
+
+    }
+
+
+    private function getValues(){
+
+        $values = [];
+
+        $values[] = [
+            'Chart Number',
+			'Name',
+			'Issued Yet?',
+			'Client',
+			'Used?',
+			'MCP',
+			'Issue Date',
+			'Last Meas. Date',
+			'Last Meas. Days Ago',
+			'Days with Remote Meas. this Month',
+			'Days with Remote Meas. last Month',
+			'Client Engagement Status Category',
+			'Admin Engagement Assessment Status',
+			'Mcp Engagement Assessment Status',
+			'Default Na Engagement Assessment Status'
+        ];
+
+        Client::whereNull('shadow_pro_id')->chunk(function($clients) use ($values){
+            foreach($clients as $patient){
+                $patientStr =($patient->chart_number).'~~'.
+                ($patient->displayName()).'~~'.
+                (@$patient->mcp ? $patient->mcp->displayName() : '--').'~~'.
+                ($patient->mailing_address_state).'~~'.
+                ($patient->getPrimaryCoverage()?$patient->getPrimaryCoverage()->insuranceDisplayName():'-').'~~'.
+                (friendly_date($patient->most_recent_completed_mcp_note_date) ).'~~'.
+                ($patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-').'~~'.
+                (friendlier_date_time($patient->most_recent_cellular_bp_measurement_at) ).'~~'.
+                (friendlier_date_time($patient->most_recent_cellular_weight_measurement_at) ).'~~'.
+                (friendly_date_time($patient->created_at, false)).'~~'.
+                ($patient->getMcpAssignedOn()).'~~'.
+                (count($patient->activeNotes)).'~~'.
+                ($patient->client_engagement_status_category == 'DUMMY'? 'Test Record': $patient->client_engagement_status_category).'~~'.
+                ($patient->temparatureGunDeliveryStatus()).'~~'.
+                ($patient->pulseOximeterDeliveryStatus()).'~~'.
+                ($patient->hasBPDevice()?'DELIVERED':'').'~~'.
+                ($patient->hasWeightScaleDevice()?'DELIVERED':'').'~~';
+                $values[] = explode('~~', $patientStr);
+            }
+        });
+       
+        return $values;
+    }
+
+    
+}
+
+				
+			
+			
+				
+			
+				
+				

+ 1 - 24
app/Http/Controllers/AdminController.php

@@ -40,30 +40,7 @@ class AdminController extends Controller
         $filters = $request->all();
         $patients = Client::whereNull('shadow_pro_id');
 
-        // filters
-        /*
-        array:18 [▼
-          "age_category" => "LESS_THAN"
-          "age_value_1" => "34"
-          "age_value_2" => null
-          "sex" => "M"
-          "bmi_category" => "BETWEEN"
-          "bmi_value_1" => "20"
-          "bmi_value_2" => "25"
-          "last_visit_category" => "LESS_THAN"
-          "last_visit_value_1" => "2021-10-14"
-          "last_visit_value_2" => null
-          "next_appointment_category" => "LESS_THAN"
-          "next_appointment_value_1" => "2021-10-15"
-          "status" => "ACTIVE"
-          "last_weighed_in_category" => "EXACTLY"
-          "last_weighed_in_value_1" => "2021-10-07"
-          "last_bp_category" => "BETWEEN"
-          "last_bp_value_1" => "2021-10-01"
-          "last_bp_value_2" => "2021-10-31"
-        ]
-        */
-
+       
         if ($request->input('name')) {
             $name = trim($request->input('name'));
             if ($name) {