|
@@ -328,8 +328,8 @@ if(!function_exists('drug_drug_interaction_info_with_pivot')) {
|
|
|
|
|
|
$output = [];
|
|
|
|
|
|
- for ($i=0; $i<count($_drugs); $i++) {
|
|
|
- $output[] = drugDrugInteractionSinglePair($_pivot, $_drugs[$i]);
|
|
|
+ foreach ($_drugs as $drug) {
|
|
|
+ $output[] = drugDrugInteractionSinglePair($_pivot, $drug);
|
|
|
}
|
|
|
|
|
|
$output = array_filter($output, function($_x) {
|
|
@@ -514,11 +514,18 @@ if(!function_exists('duplicate_therapy_info')) {
|
|
|
|
|
|
$leftIndex = 0;
|
|
|
$matches = [];
|
|
|
- for ($i = $leftIndex; $i < count($_drugs) - 1; $i++) {
|
|
|
- for ($j = $i + 1; $j < count($_drugs); $j++) {
|
|
|
- $compareResult = compareDPTs($_drugs[$i]->dpt, $_drugs[$j]->dpt);
|
|
|
+
|
|
|
+ // convert to simple array
|
|
|
+ $drugsArray = [];
|
|
|
+ foreach ($_drugs as $drug) {
|
|
|
+ $drugsArray[] = $drug;
|
|
|
+ }
|
|
|
+
|
|
|
+ for ($i = $leftIndex; $i < count($drugsArray) - 1; $i++) {
|
|
|
+ for ($j = $i + 1; $j < count($drugsArray); $j++) {
|
|
|
+ $compareResult = compareDPTs($drugsArray[$i]->dpt, $drugsArray[$j]->dpt);
|
|
|
foreach ($compareResult as $c) {
|
|
|
- $matches[] = "<b>{$_drugs[$i]->data->name}</b> and <b>{$_drugs[$j]->data->name}</b> both participate in the duplicate therapy class <b>{$c->dpt_class_desc}</b> (duplicates allowed: {$c->dpt_allowance})";
|
|
|
+ $matches[] = "<b>{$drugsArray[$i]->data->name}</b> and <b>{$drugsArray[$j]->data->name}</b> both participate in the duplicate therapy class <b>{$c->dpt_class_desc}</b> (duplicates allowed: {$c->dpt_allowance})";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -545,10 +552,10 @@ if(!function_exists('duplicate_therapy_info_with_pivot')) {
|
|
|
|
|
|
$leftIndex = 0;
|
|
|
$matches = [];
|
|
|
- for ($i = 0; $i < count($_drugs); $i++) {
|
|
|
- $compareResult = compareDPTs($_pivot->dpt, $_drugs[$i]->dpt);
|
|
|
+ foreach ($_drugs as $drug) {
|
|
|
+ $compareResult = compareDPTs($_pivot->dpt, $drug->dpt);
|
|
|
foreach ($compareResult as $c) {
|
|
|
- $matches[] = "<b>{$_pivot->data->name}</b> and <b>{$_drugs[$i]->data->name}</b> both participate in the duplicate therapy class <b>{$c->dpt_class_desc}</b> (duplicates allowed: {$c->dpt_allowance})";
|
|
|
+ $matches[] = "<b>{$_pivot->data->name}</b> and <b>{$drug->data->name}</b> both participate in the duplicate therapy class <b>{$c->dpt_class_desc}</b> (duplicates allowed: {$c->dpt_allowance})";
|
|
|
}
|
|
|
}
|
|
|
|