billing: improve patient name display on consult form and history page

This commit is contained in:
DevSoftTech Server 2026-05-08 13:49:37 +05:30
parent fbb03a6abb
commit 5d5c9656ea
3 changed files with 43 additions and 8 deletions

View File

@ -914,9 +914,33 @@ class Patient extends BaseController
];
}
// Resolve patient profile picture
$profileFilePath = '/assets/images/no_image.svg';
$profilePicturePath = '';
if ($this->db->fieldExists('profile_picture', 'patient_master')) {
$profilePicturePath = trim((string) ($patient->profile_picture ?? ''));
}
$profileFileId = (int) ($patient->profile_file_id ?? 0);
if ($profileFileId > 0 && $this->db->tableExists('file_upload_data')) {
$fileRow = $this->db->table('file_upload_data')
->select('full_path')
->where('id', $profileFileId)
->get(1)
->getRow();
$fullPath = trim((string) ($fileRow->full_path ?? ''));
if ($fullPath !== '') {
$pos = strpos($fullPath, '/uploads/', 1);
$profileFilePath = $pos !== false ? substr($fullPath, $pos) : $fullPath;
}
} elseif ($profilePicturePath !== '') {
$pos = strpos($profilePicturePath, '/uploads/', 1);
$profileFilePath = $pos !== false ? substr($profilePicturePath, $pos) : $profilePicturePath;
}
return view('billing/Patient_Profile_Opd_V', [
'patient' => $patient,
'opdGroups' => $opdGroups,
'profile_file_path' => $profileFilePath,
]);
}

View File

@ -121,15 +121,22 @@
</div>
<div class="patient-info-card">
<div class="patient-info-title">Patient Information</div>
<div class="patient-info-row">
<div class="patient-info-item">
<span class="label">Name:</span>
<span class="value"><?= esc($patientName !== '' ? $patientName : '-') ?></span>
<div class="d-flex align-items-start gap-3">
<?php if (!empty($profile_file_path)) { ?>
<div class="flex-shrink-0">
<img src="<?= esc($profile_file_path) ?>" alt="Patient Photo"
style="width:72px;height:72px;object-fit:cover;border-radius:50%;border:2px solid #aac4f0;">
</div>
<div class="patient-info-item">
<span class="label">Relation:</span>
<span class="value"><?= esc($relationWithName !== '' ? $relationWithName : '-') ?></span>
<?php } ?>
<div class="patient-info-row" style="flex:1;">
<div class="patient-info-item w-100" style="font-size:1.18rem;font-weight:700;color:#0b3b91;line-height:1.3;">
<?= esc($patientName !== '' ? $patientName : '-') ?>
</div>
<?php if ($relationWithName !== '') { ?>
<div class="patient-info-item w-100" style="font-size:0.88rem;font-weight:400;color:#374151;margin-top:1px;">
<?= esc($relationWithName) ?>
</div>
<?php } ?>
<div class="patient-info-item">
<span class="label">Age:</span>
<span class="value"><?= esc($ageDisplay !== '' ? $ageDisplay : '-') ?></span>
@ -139,6 +146,7 @@
<span class="value"><?= esc($firstVisitDisplay) ?></span>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -410,7 +410,10 @@
<div class="rx-meta-box mb-3">
<div class="row g-2 align-items-start">
<div class="col-8">
<div class="rx-meta-line"><strong>Name:</strong> <?= esc($patientNameWithRelation !== '' ? $patientNameWithRelation : '-') ?></div>
<div class="rx-meta-line"><strong>Patient Name:</strong> <span style="font-size:1.18rem;font-weight:700;color:#0b3b91;"><?= esc($patientName !== '' ? $patientName : '-') ?></span></div>
<?php if ($relationLabel !== '') { ?>
<div class="rx-meta-line" style="font-size:0.88rem;font-weight:400;color:#374151;margin-top:1px;"><?= esc($relationLabel) ?></div>
<?php } ?>
<div class="rx-meta-line"><strong>UHID:</strong> <?= esc($patient_master[0]->p_code ?? '') ?></div>
<div class="rx-meta-line"><strong>Age:</strong> <?= esc($patient_master[0]->str_age ?? '') ?></div>
<div class="rx-meta-line"><strong>Gender:</strong> <?= esc($patient_master[0]->xgender ?? '') ?></div>