-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GSoC 2018 Project: PDF generator code for Patient Report section (#1165)
* PDF generator code for Patient Report section * Procedure orders PDF generation code * PDF generation code for clinical instructions, issues, procedure orders added and new code for history * Added support for other sections and removed Demographics error * Improved date comparison, removed bugs and added other features
- Loading branch information
1 parent
9e2b609
commit 3f8b1d3
Showing
17 changed files
with
2,066 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* The purpose of this code is to get the patient billing data | ||
* in a formatted manner and store it in a single variable $content_billing. | ||
* The content of this variable will be printed in the PDF if required. | ||
* | ||
* | ||
* LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0 | ||
* See the Mozilla Public License for more details. | ||
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* @package Librehealth EHR | ||
* @author Abhinav([email protected]) | ||
* @link http://librehealth.io | ||
* | ||
* Please help the overall project by sending changes you make to the author and to the LibreEHR community. | ||
* | ||
*/ | ||
|
||
$content_billing = '<span style="font-size:25px;font-family: Arial, sans-serif;">' . xlt("Billing Information") . ':<br></span>'; | ||
if (count($ar['patient_encounter']) > 0) { | ||
$billings = array(); | ||
$content_billing .= "<table>"; | ||
$content_billing .= '<tr><td width="400"><b>' . xlt("Code") . '</b></td><td><b>' . xlt("Fee") . '</b></td></tr>'; | ||
$total = 0.00; | ||
$copays = 0.00; | ||
foreach ($ar['patient_encounter'] as $be) { | ||
$ta = explode(":",$be); | ||
$billing = getPatientBillingEncounter($pid,$ta[1]); | ||
$billings[] = $billing; | ||
foreach ($billing as $b) { | ||
$content_billing .= "<tr>"; | ||
$content_billing .= "<td>"; | ||
$content_billing .= $b['code_type'] . ": " . $b['code'] . " ". $b['modifier'] . " " . $b['code_text'] . " "; | ||
$content_billing .= "</td>"; | ||
$content_billing .= "<td>"; | ||
$content_billing .= oeFormatMoney($b['fee']); | ||
$content_billing .= "</td>"; | ||
$content_billing .= "</tr>"; | ||
$total += $b['fee']; | ||
if ($b['code_type'] == "COPAY") { | ||
$copays += $b['fee']; | ||
} | ||
} | ||
} | ||
$content_billing .= "<tr><td> </td></tr>"; | ||
$content_billing .= "<tr><td><b>" . xlt("Sub") . "-" . xlt("Total") . "</b></td><td>" . oeFormatMoney($total + abs($copays)) . "</td></tr>"; | ||
$content_billing .= "<tr><td><b>" . xlt("Pid") . "</b></td><td>" . oeFormatMoney(abs($copays)) . "</td></tr>"; | ||
$content_billing .= "<tr><td><b>" . xlt("Total") . "</b></td><td>" . oeFormatMoney($total) . "</td></tr>"; | ||
$content_billing .= "</table>"; | ||
} | ||
else { | ||
pdfPatientBilling($pid); | ||
} | ||
function pdfPatientBilling($pid) { | ||
global $content_billing; | ||
$res = sqlStatement("SELECT * FROM billing WHERE pid='$pid' ORDER BY date"); | ||
while($result = sqlFetchArray($res)) { | ||
$content_billing .= "<span><b>" . oeFormatSDFT(strtotime($result{"date"})) . " : </b></span>"; | ||
$content_billing .= "<span>(".$result{"code_type"}.") "; | ||
$content_billing .= $result['code_type'] == 'COPAY' ? oeFormatMoney($result['code']) : $result['code']; | ||
$content_billing .= " - ". wordwrap($result['code_text'], 70, "\n", true)."</span>"; | ||
$content_billing .= "<br>"; | ||
} | ||
} | ||
|
||
$pdf->WriteHTML($content_billing, true, false, false, false, ''); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* The purpose of this code is to get the patient insurance data | ||
* in a formatted manner and store it in a single variable $content_instructions. | ||
* The content of this variable will be printed in the PDF if required. | ||
* | ||
* | ||
* LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0 | ||
* See the Mozilla Public License for more details. | ||
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* @package Librehealth EHR | ||
* @author Abhinav([email protected]) | ||
* @link http://librehealth.io | ||
* | ||
* Please help the overall project by sending changes you make to the author and to the LibreEHR community. | ||
* | ||
*/ | ||
|
||
foreach($_POST as $instr_name => $instr_value){ | ||
if(substr($instr_name, 0, 21) == "clinical_instructions") | ||
{ | ||
pdfClinicalInstructinsData($pid, $instr_value, $_SESSION['authUser']); | ||
} | ||
} | ||
function pdfClinicalInstructinsData($pid, $encounter, $user){ | ||
global $content_instructions; | ||
|
||
$instructions_query = sqlStatement("SELECT * FROM form_clinical_instructions WHERE pid='$pid' AND encounter='$encounter' AND user='$user'"); | ||
while($instructions_data = sqlFetchArray($instructions_query)) | ||
{ | ||
$content_instructions .= '<span style="font-size:25px;font-family: Arial, sans-serif;">' . xlt("Clinical Instructions") . ':</span>'; | ||
$instructions_date = explode(' ', $instructions_data['date']); | ||
$content_instructions .= '<br style="line-height:15px;">(' . $instructions_date[0] . ')<br style="line-height:15px;">'; | ||
$content_instructions .= '<table border="0.5">'; | ||
$content_instructions .= '<tr><td align="center" style="height:15px;">' . xlt("Instructions") . '</td></tr>'; | ||
$content_instructions .= '<tr><td align="center" style="height:15px;">' . $instructions_data['instruction'] . '</td></tr>'; | ||
$content_instructions .= "</table><br><br>"; | ||
} | ||
} | ||
if($content_instructions) | ||
{ | ||
$pdf->Ln(2); | ||
$pdf->Line(10, $pdf->GetY(), $pdf->GetPageWidth()-10, $pdf->GetY()); | ||
$pdf->Ln(2); | ||
$pdf->WriteHTML($instructions_content, true, false, false, false, ''); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* The purpose of this code is to get the patient communication data | ||
* in a formatted manner and store it in a single variable $content_comu. | ||
* The content of this variable will be printed in the PDF if required. | ||
* | ||
* | ||
* LICENSE: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0 | ||
* See the Mozilla Public License for more details. | ||
* If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* @package Librehealth EHR | ||
* @author Abhinav([email protected]) | ||
* @link http://librehealth.io | ||
* | ||
* Please help the overall project by sending changes you make to the author and to the LibreEHR community. | ||
* | ||
*/ | ||
|
||
$content_comu .= '<span style="font-size:25px;font-family: Arial, sans-serif;">' . xlt("Patient Communication sent") . ':<br></span>'; | ||
$sql="SELECT concat( 'Messsage Type: ', batchcom.msg_type, ', Message Subject: ', batchcom.msg_subject, ', Sent on:', batchcom.msg_date_sent ) AS batchcom_data, batchcom.msg_text, concat( users.fname, users.lname ) AS'user_name' FROM `batchcom` JOIN `users` ON users.id = batchcom.sent_by WHERE batchcom.patient_id='$pid'"; | ||
|
||
$result = sqlStatement($sql); | ||
while ($row=sqlFetchArray($result)) { | ||
$content_comu .= $row{'batchcom_data'}.", ".xlt("By").": ".$row{'user_name'}."<br>".xlt("Text").":<br> ".$row{'msg_txt'}."<br>"; | ||
} | ||
|
||
$pdf->WriteHTML($content_comu, true, false, true, false, ''); | ||
|
||
?> |
Oops, something went wrong.