Rx print: professional font, vitals on one line, advice in Hindi

This commit is contained in:
DevSoftTech Server 2026-04-01 20:01:38 +05:30
parent c3f07db430
commit caba6dc84b
2 changed files with 49 additions and 10 deletions

View File

@ -1429,7 +1429,7 @@ class Opd extends BaseController
'margin_bottom' => 5,
'margin_header' => 5,
'margin_footer' => 5,
'default_font' => 'freeserif',
'default_font' => 'dejavusans',
'autoScriptToLang' => true,
'autoLangToFont' => true,
'tempDir' => WRITEPATH . 'cache',
@ -1539,7 +1539,7 @@ class Opd extends BaseController
'margin_bottom' => $marginBottom,
'margin_header' => $marginHeader,
'margin_footer' => $marginFooter,
'default_font' => 'freeserif',
'default_font' => 'dejavusans',
'autoScriptToLang' => true,
'autoLangToFont' => true,
'tempDir' => WRITEPATH . 'cache',
@ -2518,7 +2518,7 @@ class Opd extends BaseController
$tokens['advice_raw'] = (string) ($tokens['advice'] ?? '');
$tokens['next_visit_raw'] = (string) ($tokens['next_visit'] ?? '');
$tokens['vital_content'] = $formatBlock('Vitals', (string) ($tokens['vital_content'] ?? ''), true);
$tokens['vital_content'] = $formatBlock('Vitals', (string) ($tokens['vital_content'] ?? ''), false);
$tokens['Complaint'] = $formatBlock('Complaint', (string) ($tokens['Complaint_raw'] ?? ''));
$tokens['complaint'] = $tokens['Complaint'];
$tokens['diagnosis'] = $formatBlock('Diagnosis', (string) ($tokens['diagnosis_raw'] ?? ''));
@ -2529,7 +2529,22 @@ class Opd extends BaseController
$tokens['finding_examinations'] = $tokens['Finding_Examinations'];
$tokens['investigation'] = $formatBlock('Investigation Advised', (string) ($tokens['investigation_raw'] ?? ''));
$tokens['Prescriber_Remarks'] = $formatBlock('Remarks', (string) ($tokens['Prescriber_Remarks_raw'] ?? ''));
$tokens['advice'] = $formatBlock('Advice', (string) ($tokens['advice_raw'] ?? ''));
$adviceRaw = trim((string) ($tokens['advice_raw'] ?? ''));
$adviceLocalText = trim((string) ($tokens['advice_local'] ?? ''));
if ($adviceRaw !== '') {
$advLabelHtml = '<span style="font-weight:700;font-size:13px;line-height:1.35;">सलाह (Advice) :</span>';
$adviceHtml = '<div style="margin-bottom:4px;">';
if ($adviceLocalText !== '') {
$adviceHtml .= $advLabelHtml . ' <span lang="hi">' . $adviceLocalText . '</span>';
$adviceHtml .= '<div style="font-size:10px;color:#666;margin-top:1px;">(Advice: ' . $adviceRaw . ')</div>';
} else {
$adviceHtml .= $advLabelHtml . ' ' . $adviceRaw;
}
$adviceHtml .= '</div>';
$tokens['advice'] = $adviceHtml;
} else {
$tokens['advice'] = '';
}
$tokens['next_visit'] = $formatBlock('Next Visit', (string) ($tokens['next_visit_raw'] ?? ''));
$medicalHtml = trim((string) ($tokens['medical'] ?? ''));

View File

@ -117,6 +117,26 @@ $toLocalText = static function (string $input): string {
'hydrate' => 'पर्याप्त पानी लें',
'avoid oily food' => 'तैलीय भोजन से बचें',
'follow up' => 'फॉलो-अप करें',
'review warning signs' => 'चेतावनी के संकेतों पर ध्यान दें',
'warning signs' => 'चेतावनी के संकेत',
'if symptoms persist' => 'यदि लक्षण बने रहें',
'if symptoms worsen' => 'यदि लक्षण बिगड़ें',
'follow-up' => 'फॉलो-अप',
'bed rest' => 'बिस्तर पर आराम',
'light diet' => 'हल्का भोजन',
'plenty of water' => 'पर्याप्त पानी पियें',
'plenty of fluids' => 'पर्याप्त तरल पदार्थ',
'drink water' => 'पानी पियें',
'avoid cold' => 'ठंड से बचें',
'no smoking' => 'धूम्रपान न करें',
'avoid alcohol' => 'शराब से बचें',
'take medicine regularly' => 'नियमित दवाई लें',
'low salt diet' => 'कम नमक का भोजन',
'low sugar diet' => 'कम चीनी का भोजन',
'exercise regularly' => 'नियमित व्यायाम करें',
'avoid stress' => 'तनाव से बचें',
'wear mask' => 'मास्क पहनें',
'wash hands' => 'हाथ धोएं',
'review' => 'पुनः जांच',
];
@ -137,7 +157,7 @@ $toLocalText = static function (string $input): string {
<meta charset="utf-8">
<title>OPD Consult Note</title>
<style>
body { font-family: freeserif, dejavusans, sans-serif; font-size: 10.5px; color: #111; }
body { font-family: dejavusans, sans-serif; font-size: 11px; color: #111; line-height: 1.5; }
.wrap { width: 100%; margin-top: <?= (int) $topSpacerMm ?>mm; }
.top-head { width: 100%; border-bottom: 1px solid #666; padding-bottom: 5px; margin-bottom: 8px; }
.top-head td { vertical-align: top; }
@ -154,7 +174,7 @@ $toLocalText = static function (string $input): string {
.rx-table th { text-align: left; border-bottom: 1px solid #444; font-size: 11px; padding: 2px 3px; }
.rx-table td { border-bottom: 1px solid #bbb; padding: 2px 3px; vertical-align: top; }
.sub-line { font-size: 9.5px; color: #444; margin-top: 1px; }
.local-line { font-size: 9.5px; color: #111; margin-top: 1px; }
.local-line { font-size: 11px; color: #111; margin-top: 2px; }
.small-gap { margin-top: 8px; }
.signature { margin-top: 28px; text-align: right; }
.signature .name { font-size: 15px; font-weight: 700; }
@ -364,16 +384,20 @@ $toLocalText = static function (string $input): string {
?>
<?php if (!empty($adviceLine)) : ?>
<?php $adviceEng = implode(' | ', $adviceLine); ?>
<div class="section-line"><span class="label">Advice :</span> <?= esc($adviceEng) ?></div>
<?php if (!empty($adviceLocalLine)) : ?>
<div class="section-line local-line" lang="hi"><span class="label">सलाह :</span> <?= esc(implode(' | ', $adviceLocalLine)) ?></div>
<div class="section-line" lang="hi"><span class="label">सलाह :</span> <?= esc(implode(' | ', $adviceLocalLine)) ?></div>
<div style="font-size:9.5px; color:#666; margin-top:1px;">(Advice: <?= esc($adviceEng) ?>)</div>
<?php else : ?>
<div class="section-line"><span class="label">सलाह (Advice) :</span> <?= esc($adviceEng) ?></div>
<?php endif; ?>
<?php endif; ?>
<?php elseif (!empty($rx['advice'] ?? '')) : ?>
<?php $adviceEng = (string) ($rx['advice'] ?? ''); $adviceLocal = $toLocalText($adviceEng); ?>
<div class="section-line"><span class="label">Advice :</span> <?= nl2br(esc($adviceEng)) ?></div>
<?php if ($adviceLocal !== '' && strtolower($adviceLocal) !== strtolower(trim($adviceEng))) : ?>
<div class="section-line local-line" lang="hi"><span class="label">सलाह :</span> <?= nl2br(esc($adviceLocal)) ?></div>
<div class="section-line" lang="hi"><span class="label">सलाह :</span> <?= nl2br(esc($adviceLocal)) ?></div>
<div style="font-size:9.5px; color:#666; margin-top:1px;">(Advice: <?= nl2br(esc($adviceEng)) ?>)</div>
<?php else : ?>
<div class="section-line"><span class="label">सलाह (Advice) :</span> <?= nl2br(esc($adviceEng)) ?></div>
<?php endif; ?>
<?php endif; ?>