} // DRUG TABLE $drugTable = '<table border="1" cellpadding="1"> <tr> <th>Chracterisation</th> <th>Product</th> <th>MAL No.</th> <th>Active Ingredient</th> <th>Dose / Dose Unit</th> <th>Dose Frequency</th> <th>Indication</th> <th>Therapy Start Date</th> <th>Therapy Stop Date</th> <th>Relatedness</th> </tr>'; $adrugSql = "SELECT DISTINCT adrFormID, product_name, dosage, dosageUnit, DATE_FORMAT(therapy_start, '%d/%m/%Y') AS therapy_start, DATE_FORMAT(therapy_stop, '%d/%m/%Y') AS therapy_stop, \n\t\t\tsuspected, indication, unit, freq, route, generic, icdcode, dcount, drug_cat, manf, pharm_gr, drug_gr, \n\t\t\tduration, atccode, product_ref, sus_state, req_holder, MALnum, actvIngredient, Pharmaceutical, \n\t\t\tPharmacological, doseInterval, doseIntervalUnit, doseIntervalUnitOtr, cumDoseDay, cumDoseDayUnit, \n\t\t\tdrugAction, relatedness, actionTaken, subsided, reappear, rptrCmmt, conserf_reason, conserf_medType\n\t\t\tFROM adr_druglist WHERE adrFormID = '{$formID}'"; $adrugRes = mysqli_query($con, $adrugSql); if ($adrugRes) { if (mysqli_num_rows($adrugRes) > 0) { while ($adrugRows = mysqli_fetch_assoc($adrugRes)) { $suspected = getCharacterisation($adrugRows['suspected']); $product_name = $adrugRows['product_name']; $MALnum = $adrugRows['MALnum']; $actvIngredient = $adrugRows['actvIngredient']; $dosage = $adrugRows['dosage']; $dosageUnit = getDoseUnitByValue($con, $adrugRows['dosageUnit']); $doseInterval = $adrugRows['doseInterval']; $doseIntervalUnit = getDoseUnitByValue($con, $adrugRows['doseIntervalUnit']); $indication = $adrugRows['indication']; $therapy_start = $adrugRows['therapy_start']; $therapy_stop = $adrugRows['therapy_stop']; $relatedness = getRelatednessByValue($con, $adrugRows['relatedness']); $drugTable .= '<tr> <td> ' . $suspected . ' </td> <td> ' . $product_name . ' </td> <td> ' . $MALnum . ' </td> <td> ' . $actvIngredient . ' </td> <td> ' . $dosage . ' ' . $dosageUnit . ' </td> <td> ' . $doseInterval . ' ' . $doseIntervalUnit . ' </td> <td> ' . $indication . ' </td> <td> ' . $therapy_start . ' </td> <td> ' . $therapy_stop . ' </td> <td> ' . $relatedness . ' </td>
} $adrdetailID = ""; if ($resRow['adrdetailID'] != NULL || $resRow['adrdetailID'] != "") { $adrdetailID = getAdrTermByID($resRow['adrdetailID']); } else { $adrdetailID = $resRow['adrdetailID']; } $dosage = $resRow['dosage']; if ($dosage == NULL) { $dosage = ""; } $doseInterval = $resRow['doseInterval']; if ($doseInterval == NULL) { $doseInterval = ""; } $dosageUnit = getDoseUnitByValue($con, $resRow['dosageUnit']); $doseIntervalUnit = getDoseIntervalUnitByValue($resRow['doseIntervalUnit']); $therapy_start = dateChecker($resRow['therapy_start']); $therapy_stop = dateChecker($resRow['therapy_stop']); $relatedness = $resRow['relatedness']; if ($relatedness == 1) { $relatedness = " Certain"; } else { if ($relatedness == 2) { $relatedness = " Probable"; } else { if ($relatedness == 3) { $relatedness = " Possible"; } else { if ($relatedness == 4) { $relatedness = " Unlikely";
if ($suspected == 1) { $suspected = "Suspected"; } else { if ($suspected == 2) { $suspected = "Interaction"; } else { if ($suspected == 3) { $suspected = "Concomitant"; } } } $actvIngredient = $rowPart3['actvIngredient']; $product_name = $rowPart3['product_name']; $route = getRouteByValue($con, $rowPart3['route']); $dosage = $rowPart3['dosage']; $dosageUnit = getDoseUnitByValue($con, $rowPart3['dosageUnit']); $doseInterval = $rowPart3['doseInterval']; $indication = $rowPart3['indication']; $therapy_start = dateChecker($rowPart3['therapy_start']); $therapy_stop = dateChecker($rowPart3['therapy_stop']); $part3Table .= "<tr> <td>{$suspected}</td> <td>{$actvIngredient}</td> <td>{$product_name}</td> <td> {$route} </td> <td>{$dosage} {$dosageUnit}</td> <td>{$doseInterval}</td> <td>{$indication}</td> <td>{$therapy_start} - {$therapy_stop}</td> </tr>"; } } else { $part3Table .= "<tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>"; } $part3Table .= "</table>"; } $sqlPart4 = "SELECT DISTINCT adrug.suspected, adrug.actvIngredient, adrug.actionTaken, adrug.subsided, adrug.reappear, adetail.AdrTerminology, adrug.relatedness\n\t\t\t\t\t\t\t\t\tFROM adrdata adata, adrdetail adetail, adr_druglist adrug\n\t\t\t\t\t\t\t\t\tWHERE adata.adrFormID = adetail.adrFormID\n\t\t\t\t\t\t\t\t\tAND adata.adrFormID = adrug.adrFormID\n\t\t\t\t\t\t\t\t\tAND adrug.adrdetailID = adetail.adrDetailID\n\t\t\t\t\t\t\t\t\tAND adata.adrFormID = '{$fID}'"; $resPart4 = mysqli_query($con, $sqlPart4); if ($resPart4) { $part4Table = "<table border='1' class='table table-condensed table-bordered'><tr class='dark'><td colspan='8'> <b> REACTION EVENT RELATEDNESS </b> </td></tr><tr><td> Characterisation </td><td> Active Ingredient </td><td> Action Taken </td><td> Dechallenge </td><td> Rechallenge </td><td> Reaction Terminology </td><td> Relatedness </td><td> </td></tr>";
function getDrugStrByFormID($con, $formID) { $sql = "SELECT DISTINCT adrDrugListID, suspected, actvIngredient, product_name, dosage, dosageUnit, doseInterval, therapy_start, therapy_stop\n\tFROM adr_druglist WHERE adrFormID = {$formID}"; $res = mysqli_query($con, $sql); $drugStr = "<table class='table table-condensed table-bordered table-hover'>"; if ($res) { if (mysqli_num_rows($res) > 0) { while ($row = mysqli_fetch_array($res)) { $suspected = $row['suspected']; if ($suspected == 1) { $suspected = "Suspected"; } else { if ($suspected == 2) { $suspected = "Interaction"; } else { if ($suspected == 3) { $suspected = "Concomitant"; } } } $actvIngredient = $row['actvIngredient']; $product_name = $row['product_name']; $dosage = $row['dosage']; $dosageUnit = getDoseUnitByValue($con, $row['dosageUnit']); $doseInterval = $row['doseInterval']; $therapy_start = dateChecker($row['therapy_start']); $therapy_stop = dateChecker($row['therapy_stop']); $drugStr .= "<tr>\n\t\t\t\t<td>\n\t\t\t\t\tCharacterisation: {$suspected} <br/>\n\t\t\t\t\tActive Ingredient: {$actvIngredient} <br/>\n\t\t\t\t\tProduct Name: {$product_name} <br/>\n\t\t\t\t\tDose: {$dosage} {$dosageUnit} <br/>\n\t\t\t\t\tDose Frequency: {$doseInterval} <br/>\n\t\t\t\t\tActive Ingredient: {$actvIngredient} <br/>\n\t\t\t\t\t{$therapy_start} - {$therapy_stop} <br/>\n\t\t\t\t</td>\n\t\t\t</tr>"; } $drugStr .= "</table>"; } else { $drugStr .= "No Drug Found"; } } else { $drugStr .= "E"; } return $drugStr; }