|
@@ -44,7 +44,14 @@ class Point extends Model
|
|
|
$points = Point
|
|
|
::where('client_id', $_patient->id)
|
|
|
->where('category', $_category)
|
|
|
- ->where('addition_reason_category', 'ON_INTAKE')
|
|
|
+ ->where(function ($query1) use ($_note) {
|
|
|
+ $query1
|
|
|
+ ->where('addition_reason_category', 'ON_INTAKE')
|
|
|
+ ->orWhere(function ($query2) use ($_note) {
|
|
|
+ $query2->where('addition_reason_category', 'DURING_VISIT')
|
|
|
+ ->where('added_in_note_id', '<>', $_note->id);
|
|
|
+ });
|
|
|
+ })
|
|
|
->where(function ($query1) use ($_note) {
|
|
|
$query1
|
|
|
->where('is_removed', false)
|
|
@@ -67,7 +74,6 @@ class Point extends Model
|
|
|
$points = Point
|
|
|
::where('client_id', $_patient->id)
|
|
|
->where('category', $_category)
|
|
|
- ->where('addition_reason_category', 'DURING_VISIT')
|
|
|
->where(function ($query1) use ($_note) {
|
|
|
$query1
|
|
|
->where('is_removed', false)
|