diff --git a/app/Controllers/Ipd_discharge.php b/app/Controllers/Ipd_discharge.php index a746ee9..a9ad931 100644 --- a/app/Controllers/Ipd_discharge.php +++ b/app/Controllers/Ipd_discharge.php @@ -816,12 +816,25 @@ class Ipd_discharge extends BaseController private function normalizeHistoryItemKey(string $item): string { - $value = strtolower(trim($item)); + $value = trim($item); if ($value === '') { return ''; } - $value = (string) preg_replace('/[^a-z0-9]+/i', '', $value); + if (function_exists('mb_strtolower')) { + $value = (string) mb_strtolower($value, 'UTF-8'); + } else { + $value = strtolower($value); + } + + // Keep letters/digits across languages so Hindi and other Unicode scripts + // participate in dedupe instead of being dropped as empty keys. + $value = (string) preg_replace('/[^\p{L}\p{N}]+/u', '', $value); + + if ($value === '') { + // Stable fallback key for symbol-only or unusual content. + $value = md5(trim($item)); + } return $value; } diff --git a/app/Views/billing/ipd/discharge_create.php b/app/Views/billing/ipd/discharge_create.php index d5678ce..38d6c7c 100644 --- a/app/Views/billing/ipd/discharge_create.php +++ b/app/Views/billing/ipd/discharge_create.php @@ -230,8 +230,6 @@ $historyFields = [ 'is_alcohol' => 'Alcohol', 'is_tobacoo' => 'Tobacco', 'is_drug_abuse' => 'Drug abuse', - 'is_hypertesion' => 'Hypertension', - 'is_niddm' => 'Type 2 diabetes mellitus (DM)', 'is_hbsag' => 'HBsAg', 'is_hcv' => 'HCV', 'is_hiv_I_II' => 'HIV I & II', @@ -551,6 +549,7 @@ $historyFields = [