fix(discharge): show in-hospital lab only for explicitly selected dates
This commit is contained in:
parent
d751ff9b4b
commit
302f779ea2
|
|
@ -2466,30 +2466,17 @@ class Ipd_discharge extends BaseController
|
||||||
$savedClinicalDates = $this->getSavedClinicalLabDates($ipdId);
|
$savedClinicalDates = $this->getSavedClinicalLabDates($ipdId);
|
||||||
$clinicalLabRows = $this->getClinicalInvestigationLabRows($patientId, $admitDate, $dischargeDate, $savedClinicalDates);
|
$clinicalLabRows = $this->getClinicalInvestigationLabRows($patientId, $admitDate, $dischargeDate, $savedClinicalDates);
|
||||||
|
|
||||||
|
// Strict selection mode: in-hospital lab should print only when user
|
||||||
|
// explicitly selected one or more investigation dates.
|
||||||
$effectiveClinicalDates = $savedClinicalDates;
|
$effectiveClinicalDates = $savedClinicalDates;
|
||||||
if (empty($effectiveClinicalDates)) {
|
|
||||||
foreach ($clinicalLabRows as $row) {
|
|
||||||
$dt = $this->normalizeDateValue((string) ($row['inv_date'] ?? ''));
|
|
||||||
if ($dt !== null) {
|
|
||||||
$effectiveClinicalDates[$dt] = $dt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$effectiveClinicalDates = array_values($effectiveClinicalDates);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pathologyMatrix = $this->getClinicalPathologyMatrixRows($patientId, $effectiveClinicalDates);
|
$pathologyMatrix = $this->getClinicalPathologyMatrixRows($patientId, $effectiveClinicalDates);
|
||||||
|
|
||||||
$selectedLabRows = [];
|
$selectedLabRows = [];
|
||||||
foreach ($clinicalLabRows as $row) {
|
foreach ($clinicalLabRows as $row) {
|
||||||
if (! empty($savedClinicalDates)) {
|
if (! empty($row['checked'])) {
|
||||||
if (! empty($row['checked'])) {
|
$selectedLabRows[] = $row;
|
||||||
$selectedLabRows[] = $row;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No saved selection yet: include all available pathology dates as fallback.
|
|
||||||
$selectedLabRows[] = $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$otherExamRow = [];
|
$otherExamRow = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user