|
@@ -206,7 +206,7 @@ class Client extends Model
|
|
|
public function recentMeasurements()
|
|
|
{
|
|
|
return $this->hasMany(Measurement::class, 'client_id', 'id')
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->whereNotNull('label')
|
|
|
->where('label', '<>', 'SBP')
|
|
|
->where('label', '<>', 'DBP')
|
|
@@ -219,7 +219,7 @@ class Client extends Model
|
|
|
{
|
|
|
return $this->hasMany(Measurement::class, 'client_id', 'id')
|
|
|
/*->distinct('label')*/
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->where('is_cellular_zero', false)
|
|
|
->orderBy('effective_date', 'desc');
|
|
|
}
|
|
@@ -227,7 +227,7 @@ class Client extends Model
|
|
|
public function getNonZeroBpMeasurements(){
|
|
|
return $this->hasMany(Measurement::class, 'client_id', 'id')
|
|
|
/*->distinct('label')*/
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->where('label', '=', 'BP')
|
|
|
->where('sbp_mm_hg', '>', 0)
|
|
|
->where('dbp_mm_hg', '>', 0)
|
|
@@ -237,7 +237,7 @@ class Client extends Model
|
|
|
public function getNonZeroWeightMeasurements(){
|
|
|
return $this->hasMany(Measurement::class, 'client_id', 'id')
|
|
|
/*->distinct('label')*/
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->where('label', '=', 'Wt. (lbs.)')
|
|
|
->where('numeric_value', '>', 0)
|
|
|
->orderBy('ts', 'desc');
|
|
@@ -264,7 +264,7 @@ class Client extends Model
|
|
|
::where('client_id', $this->id)
|
|
|
->whereRaw('EXTRACT(MONTH FROM effective_date) = ?', [$month])
|
|
|
->whereRaw('EXTRACT(YEAR FROM effective_date) = ?', [$year])
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->orderBy('ts', 'desc')
|
|
|
->get();
|
|
|
return $measurements;
|
|
@@ -273,7 +273,7 @@ class Client extends Model
|
|
|
public function allMeasurements()
|
|
|
{
|
|
|
return $this->hasMany(Measurement::class, 'client_id', 'id')
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->whereNull('parent_measurement_id')
|
|
|
->orderBy('label', 'asc')
|
|
|
->orderBy('effective_date', 'desc');
|
|
@@ -316,7 +316,7 @@ class Client extends Model
|
|
|
->whereNotNull('bdt_measurement_id')
|
|
|
->whereNotNull('ts')
|
|
|
->where('is_cellular_zero', false)
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->where('is_active', true)
|
|
|
->where('label', '=', $_type)
|
|
|
->orderBy('ts', 'desc')
|
|
|
->first();
|
|
@@ -778,7 +778,7 @@ FROM measurement m
|
|
|
WHERE m.care_month_id = :careMonthID
|
|
|
AND m.label NOT IN ('SBP', 'DBP')
|
|
|
AND m.bdt_measurement_id IS NOT NULL
|
|
|
- AND m.is_removed IS FALSE
|
|
|
+ AND m.is_active IS TRUE
|
|
|
AND (m.is_cellular_zero = FALSE or m.is_cellular_zero IS NULL)
|
|
|
AND m.ts IS NOT NULL
|
|
|
AND m.client_bdt_measurement_id IS NOT NULL
|