function form_consult_history() { if (func_num_args() > 0) { $arg_list = func_get_args(); $menu_id = $arg_list[0]; $post_vars = $arg_list[1]; $get_vars = $arg_list[2]; $validuser = $arg_list[3]; $isadmin = $arg_list[4]; //print_r($arg_list); } $patient_id = healthcenter::get_patient_id($get_vars["consult_id"]); $sql = "select notes_history from m_consult_notes where notes_id = '" . $get_vars["notes_id"] . "'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { list($history) = mysql_fetch_array($result); } } $checkSQL = "select pasthistory_id, familyhistory_id, medintake_id,\n\t \t\tmenarche, date_format(lmp,'%m/%d/%Y'), period_duration, cycle, pads_perday,\n\t \t\tonset_sexinter, method_id, menopause, meno_age,\n\t \t\tsmoking, pack_peryear, alcohol, bottles_perday, ill_drugs\n\t \t\tfrom m_patient_history where patient_id = '{$patient_id}'"; if ($checkResult = mysql_query($checkSQL)) { if (mysql_num_rows($checkResult)) { list($pasthistory_id, $familyhistory_id, $medintake_id, $menarche, $lmp, $period_duration, $cycle, $pads_perday, $onset_sexinter, $method_id, $menopause, $meno_age, $smoking, $pack_peryear, $alcohol, $bottles_perday, $ill_drugs) = mysql_fetch_array($checkResult); } /*else { $checkSQL = "SELECT date_format(patient_lmp,'%m/%d/%Y') FROM m_patient_mc WHERE patient_id='$patient_id' ORDER by patient_lmp DESC LIMIT 1"; if ($checkResult = mysql_query($checkSQL)) { if (mysql_num_rows($checkResult)) { list($lmp) = mysql_fetch_array($checkResult); } } }*/ } print "<script type='text/javascript' src='../js/script/jquery-1.10.2.min.js'></script>"; print " <script>\n\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\t\$(function(){\n\t\t\t\t\t\t \$('.header').nextUntil('tr.header').hide();\n\t\t\t\t\t\t \$('.header').find('span.clickable').html('+');\n\t\t\n\t\t\n\t\t\t\t\t\t\$('.header').click(function(){\n\t\t\t\t\t\t \$(this).find('span.clickable').text(function(_, value){return value=='-'?'+':'-'});\n\t\t\t\t\t\t \$(this).nextUntil('tr#end').slideToggle(100, function(){\n\t\t\t\t\t\t });\n\t\t\t\t\t\t});\n\t\t\t\t\t\t \n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t</script>"; print "<style type='text/css'>\n\t\t\t\t\ttr#end.header.nopointer td:first-child\n\t\t\t\t\t{\n\t\t\t\t\t\tcursor:default;\n\t\t\t\t\t}\n\t\t\t \ttr.header td:first-child, tr.alertheader td:first-child\n\t\t\t\t\t{\n\t\t\t\t\t cursor:pointer;\n\t\t\t\t\t}\n\t\t\t\t</style>"; print "<a name='history_form'>"; print "<table width='350px'>"; print "<form method='post' action='#history_form' name='form_history'>"; print "<tr><td>"; print "<b>" . FTITLE_CONSULT_HISTORY_FORM . "</b><br/>"; print "<br/></td></tr>"; print "<tr><td>"; print "<span class='boxtitle'>" . LBL_NOTES_ID . "</span><br/>"; print "<font color='red'>" . module::pad_zero($get_vars["notes_id"], 7) . "</font><br/>"; print "<br/></td></tr>"; print "<tr id='end' class='header'><td>"; print "<span class='clickable'>-</span> <span class='boxtitle'>PAST MEDICAL HISTORY</span><br/></td></tr>"; print "<tr><td>"; print notes::checkbox_medical_history('past', $pasthistory_id); print "<br/><hr></hr><br/></td></tr>"; print "<tr id='end' class='header'><td>"; print "<span class='clickable'>-</span> <span class='boxtitle'>FAMILY HISTORY</span><br/></td></tr>"; print "<tr><td>"; print notes::checkbox_medical_history('family', $familyhistory_id); print "<br/><hr></hr><br/></td></tr>"; print "<tr id='end' class='header'><td>"; print "<span class='clickable'>-</span> <span class='boxtitle'>MEDICINE INTAKE HISTORY</span><br/></td></tr>"; print "<tr><td>"; print notes::checkbox_medicine_history($medintake_id); print "<br/><hr></hr><br/></td></tr>"; //get menstrual history print notes::get_menstrual_history($menarche, $lmp, $period_duration, $cycle, $pads_perday, $onset_sexinter, $method_id, $menopause, $meno_age); print "<tr id='end' class='header'><td>"; print "<span class='clickable'>-</span> <span class='boxtitle'>PERSONAL/SOCIAL HISTORY</span><br/></td></tr>"; print "<tr><td>"; print "<span style='width: 80px; display:inline-block;'>Smoking: </span>"; print "<select name='smoking'>"; print "<option value=''>-Select-</option>"; print "<option value='Y' " . ($smoking == 'Y' ? 'selected' : '') . ">Yes</option>"; print "<option value='N' " . ($smoking == 'N' ? 'selected' : '') . ">No</option>"; print "<option value='Q' " . ($smoking == 'Q' ? 'selected' : '') . ">Quit</option>"; print "</select>"; print " <span style='width: 130px; display:inline-block;'>No. of Pack/Year: </span>"; print "<input type='text' name='pack' style='width:50px;' value='" . ($smoking == 'N' ? '0' : $pack_peryear) . "'>"; print "<span style='width: 80px; display:inline-block;'>Alcohol: </span>"; print "<select name='alcohol'>"; print "<option value=''>-Select-</option>"; print "<option value='Y' " . ($alcohol == 'Y' ? 'selected' : '') . ">Yes</option>"; print "<option value='N' " . ($alcohol == 'N' ? 'selected' : '') . ">No</option>"; print "<option value='Q' " . ($alcohol == 'Q' ? 'selected' : '') . ">Quit</option>"; print "</select>"; print " <span style='width: 130px; display:inline-block;'>No. of Bottles/Day: </span>"; print "<input type='text' name='bottles' style='width:50px;' value='" . ($alcohol == 'N' ? '0' : $bottles_perday) . "'>"; print "<span style='width: 80px; display:inline-block;'>Illicit drugs: </span>"; print "<select name='illdrugs'>"; print "<option value=''>-Select-</option>"; print "<option value='Y' " . ($ill_drugs == 'Y' ? 'selected' : '') . ">Yes</option>"; print "<option value='N' " . ($ill_drugs == 'N' ? 'selected' : '') . ">No</option>"; print "<option value='Q' " . ($ill_drugs == 'Q' ? 'selected' : '') . ">Quit</option>"; print "</select>"; print "<br/><br/><hr></hr><br/></td></tr>"; print "<tr id='end' class='header'><td id='surgical'>"; print "<span class='clickable'>-</span> <span class='boxtitle'>SURGICAL HISTORY</span><br/></tr>"; print notes::get_surgical_history(); //print "<input type='text' name='surgicalname[]' placeholder='Operation'>"; //print "<input type='text' size='7' value='' name='surgicaldate'>"; //print "<a href=\"javascript:show_calendar4('document.form_history.surgicaldate', document.form_history.surgicaldate.value);\"><img src='../images/cal.gif' width='16' height='16' border='0' alt='Click Here to Pick up the date'></a>"; //print notes::_calendar(); /*print "<tr><td>"; print "<input type='button' value='Add Surgical History' onclick='addSurgical();'>"; print "<br/><br/></td></tr>";*/ print "<tr id='end' class='header nopointer'><td><br/>"; print "<span class='boxtitle'>" . LBL_HISTORY_TEMPLATE . "</span><br/>"; notes::show_templates("HX", $post_vars["template"]); if ($post_vars["template"]) { print "<br/><br/>"; print "<span class='boxtitle'>" . LBL_TEMPLATE_CONTENT . "</span><br> "; print "<table width='200' style='border: 1px dotted black'><tr><td class='tinylight'>"; $history_text = notes::get_template_text($post_vars["template"]); print stripslashes(nl2br($history_text)); print "<br/>"; print "<input type='hidden' name='template_text' value='{$history_text}' />"; print "<input type='hidden' name='prev_template' value='" . $post_vars["template"] . "' class='tinylight' style='border: 1px solid black; background-color: #CCFF33'/>"; print "<input type='submit' name='submitnotes' value='Add Template' class='tinylight' style='border: 1px solid black; background-color: #CCFF33'/>"; print "</td></tr></table>"; } if ($post_vars["submitnotes"] == "Add Template") { $history = $post_vars["history_text"] . $post_vars["template_text"]; } print "<br/></td></tr>"; print "<tr id='end' class='header nopointer'><td>"; print "<span class='boxtitle'>" . LBL_NOTES_HISTORY . "</span><br> "; print "<textarea rows='15' cols='40' class='tinylight' name='history_text' style='border: 1px solid black'>" . ($history ? $history : $post_vars["history_text"]) . "</textarea>"; print "<br/></td></tr>"; print "<tr id='end' class='header nopointer'><td>"; print "<input type='submit' name='submitnotes' value='Save History' class='textbox' style='border: 1px solid black'/> "; print "<br/></td></tr>"; print "</form>"; print "</table><br/>"; }