Browse Source

Fix for 'unable to refresh templates' (wip)

Vijayakrishnan 3 năm trước cách đây
mục cha
commit
b27b3554e4

+ 4 - 0
app/Helpers/fdb.php

@@ -505,6 +505,8 @@ WHERE r1.ddi_codex IN (" . implode(',', array_map(function ($_x) {
 if(!function_exists('duplicate_therapy_info')) {
     function duplicate_therapy_info($_drugs) {
 
+        if(!$_drugs || count($_drugs) < 2) return '';
+
         $dptClasses = [];
         foreach ($_drugs as $drug) {
             $drug->dpt = getDptClassFromGcnSeqNo($drug->data->gcnSeqno);
@@ -532,6 +534,8 @@ if(!function_exists('duplicate_therapy_info')) {
 if(!function_exists('duplicate_therapy_info_with_pivot')) {
     function duplicate_therapy_info_with_pivot($_pivot, $_drugs) {
 
+        if(!$_drugs || count($_drugs) < 1) return '';
+
         $_pivot->dpt = getDptClassFromGcnSeqNo($_pivot->data->gcnSeqno);
 
         $dptClasses = [];

+ 1 - 1
resources/views/app/patient/segment-templates/plan_allergies/summary.blade.php

@@ -4,7 +4,7 @@ use App\Models\Point;
 
 /** @var \App\Models\Client $patient */
 
-$allergies = Point::getPointsOfCategoryExtended($patient, 'ALLERGY', $note);
+list($allergies, $counts) = Point::getPointsOfCategoryExtended($patient, 'ALLERGY', $note);
 
 $numRelevant = 0;
 $numVisible = 0;

+ 1 - 1
resources/views/app/patient/segment-templates/plan_care_team/summary.blade.php

@@ -4,7 +4,7 @@ use App\Models\Point;
 
 /** @var \App\Models\Client $patient */
 
-$careTeamMembers = Point::getPointsOfCategoryExtended($patient, 'CARE_TEAM_MEMBER', $note);
+list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, 'CARE_TEAM_MEMBER', $note);
 
 $numRelevant = 0;
 $numVisible = 0;

+ 1 - 1
resources/views/app/patient/segment-templates/plan_goals/summary.blade.php

@@ -4,7 +4,7 @@ use App\Models\Point;
 
 /** @var \App\Models\Client $patient */
 
-$goals = Point::getPointsOfCategoryExtended($patient, 'GOAL', $note);
+list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $note);
 
 $goals = array_filter($goals, function ($_x) use ($note) {
     $rel = $_x->relevanceToNote($note);

+ 1 - 1
resources/views/app/patient/segment-templates/plan_medications/summary.blade.php

@@ -4,7 +4,7 @@ use App\Models\Point;
 
 /** @var \App\Models\Client $patient */
 
-$medications = Point::getPointsOfCategoryExtended($patient, 'MEDICATION', $note);
+list($medications, $counts) = Point::getPointsOfCategoryExtended($patient, 'MEDICATION', $note);
 
 $numRelevant = 0;
 $numVisible = 0;

+ 1 - 1
resources/views/app/patient/segment-templates/plan_problems/summary.blade.php

@@ -4,7 +4,7 @@ use App\Models\Point;
 
 /** @var \App\Models\Client $patient */
 
-$problems = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
+list($problems, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
 
 $numRelevant = 0;
 $numVisible = 0;