Request Rx Refill Insert

0){

$row_pat=mysql_fetch_array($res_pat);

$patient_id=$row_pat[‘patientId’];

$uniqueId=date(“Y-m-d-h-i-sa”);

$sql_ins_traige=”INSERT INTO `patient_triageline`(`patientId`,`triage_date`,`rx_request_comments`,`uniqueId`,`datetimeAdded`) VALUES (‘$patient_id’,'”.date(“m/d/Y”).”‘,’$rx_request_comments’,’$uniqueId’,CURRENT_TIMESTAMP)”;

mysql_query($sql_ins_traige);
$triagelineId=mysql_insert_id();

//if($rx_prescription1!=”){

mysql_query(“INSERT INTO `patient_prescription_log`(`triagelineId`,`patient_name`) VALUES (‘$triagelineId’,’$patient_id’)”);
$patient_prescription_log_id=mysql_insert_id();

mysql_query(“INSERT INTO `patient_prescription_log_prescription`(`patient_prescription_log_id`, `patient_id`, `prescription_date`, `prescription_desc`, `prescription_strength`, `prescription_measure`, `prescription_dosage`, `prescription_dose`, `prescription_frequency`, `prescription_frequency_other`, `prescription_quantity`, `prescription_refills`, `prescription_pharmacy_name`, `prescription_pharmacy_phone`) VALUES (‘$patient_prescription_log_id’,’$patient_id’,’$rx_date_added1′,’$rx_prescription1′,’$rx_strength1′,’$rx_measure1′,’$rx_dosage1′,’$rx_dose1′,’$rx_frequency1′,’$rx_frequency_other1′,’$rx_quantity1′,’$rx_refills1′,’$rx_pharmacy_name1′,’$rx_pharmacy_phone1′)”);

$concern_date = date(‘Y-m-d H:i:s’);

$res_corr=mysql_query(“select patient_correspondence_log_id from patient_correspondence_log where patient_name=’$patient_id’ and status=’show'”);
$no_corr_rec=mysql_num_rows($res_corr);
$row_corr=mysql_fetch_array($res_corr);

if($no_corr_rec==0){

mysql_query(“INSERT INTO `patient_correspondence_log`(`triage_progressnote_Id`,`addedFrom`,`patient_name`) VALUES (‘$patient_prescription_log_id’,’Triage’,’$patient_id’)”);
$patient_correspondence_log_id=mysql_insert_id();

mysql_query(“INSERT INTO `patient_correspondence_log_concerns`(`patient_correspondence_log_id`, `patient_id`, `concern_date`, `concern_type_contact`, `concern_action_date`, `triage_progressnote_Id`) VALUES (‘$patient_correspondence_log_id’,’$patient_id’,’$concern_date’,’RX Request’,'”.date(“Y-m-d H:i:s”).”‘,’$patient_prescription_log_id’)”);

}else{

mysql_query(“INSERT INTO `patient_correspondence_log_concerns`(`patient_correspondence_log_id`, `patient_id`, `concern_date`, `concern_type_contact`, `concern_action_date`, `triage_progressnote_Id`) VALUES (‘”.$row_corr[‘patient_correspondence_log_id’].”‘,’$patient_id’,’$concern_date’,’RX Request’,'”.date(“Y-m-d H:i:s”).”‘,’$patient_prescription_log_id’)”);

}

//}

echo “Thank you for submitting . Your request is submitted . We will get back soon”;

}else{

$to = ’email@identiti-portfolio.work’;
$to = ‘ari@coem.com’;
$from = “email@identiti-portfolio.work”;
$from = “orders@coem.com”;
$subject = ‘Request Rx Refill From Coem’;

$message = “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ‘

‘;
$message .= ‘

PATIENT NAME ‘;
$message .= $patient_name;
$message .= “
DOB “;
$message .= $dob;
$message .= “
RX REQUEST “;
$message .= $rx_request_comments;
$message .= “
“;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= “”;
$message .= ‘

‘;
$message .= “

“;
$message .= “

“;
$message .= “

“;
$message .= “

“;
$message .= “

“;
$message .= “

Date Prescription Strength Measure Dosage Form Qty Refills Dose/Frequency Pharmacy Name Phone #
“.$rx_date_added1.” “.$rx_prescription1.” “.$rx_strength1.” “.$rx_measure1.” “.$rx_dosage1.” “.$rx_quantity1.” “.$rx_refills1.” “.$rx_dose1.”/”.$rx_frequency1.” “.$rx_pharmacy_name1.” “.$rx_pharmacy_phone1.”

“;

$headers = “From:”. $from . “\r\n”;
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-type: text/html; charset= iso-8859-1”;
$headers .= “\r\nReply-To: $from”;

wp_mail( $to, $subject, $message, $headers );

//mail($to,$subject,$message,$headers);

echo “Thank you for submitting your prescription request. Your request has been emailed to the concerned person who will either call it in or call you back to confirm any remaining details which are required. “;

}

}

}
mysql_close($conn);
?>