Fix OPD print remarks leaking NABH allergy lines
This commit is contained in:
parent
5801b5d276
commit
57397d80e1
|
|
@ -2504,6 +2504,7 @@ class Opd extends BaseController
|
|||
|
||||
$findingExaminationsText = $rxRead($rx, ['Finding_Examinations', 'finding_examinations', 'finding', 'findings', 'examination']);
|
||||
$prescriberRemarksText = $rxRead($rx, ['Prescriber_Remarks', 'prescriber_remarks', 'remarks', 'remark', 'doctor_note']);
|
||||
$prescriberRemarksText = $this->sanitizePrescriberRemarksForPrint($prescriberRemarksText);
|
||||
$nextVisitText = $rxRead($rx, ['next_visit', 'next_visit_date', 'follow_up', 'followup', 'review_after']);
|
||||
$complaintLocal = $this->translateToLocalPatientText($complaintText);
|
||||
$diagnosisLocal = $this->translateToLocalPatientText($diagnosisText);
|
||||
|
|
@ -6478,6 +6479,32 @@ class Opd extends BaseController
|
|||
];
|
||||
}
|
||||
|
||||
private function sanitizePrescriberRemarksForPrint(string $remarks): string
|
||||
{
|
||||
$remarks = trim($remarks);
|
||||
if ($remarks === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$lines = preg_split('/\r\n|\r|\n/', $remarks) ?: [];
|
||||
$cleaned = [];
|
||||
foreach ($lines as $line) {
|
||||
$trimmed = trim((string) $line);
|
||||
if (
|
||||
preg_match('/^Drug\s*Allergy\s*Status\s*:/i', $trimmed) === 1
|
||||
|| preg_match('/^Drug\s*Allergy\s*Details\s*:/i', $trimmed) === 1
|
||||
|| preg_match('/^ADR\s*History\s*:/i', $trimmed) === 1
|
||||
|| preg_match('/^Current\s*Medications\s*:/i', $trimmed) === 1
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cleaned[] = $line;
|
||||
}
|
||||
|
||||
return trim(implode("\n", $cleaned));
|
||||
}
|
||||
|
||||
private function extractWomenRelatedProblemsFromRemarks(string $remarks): string
|
||||
{
|
||||
if ($remarks === '') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user