Persist consult NABH fields via remarks fallback
This commit is contained in:
parent
c4a6e95933
commit
8bfd11ccda
|
|
@ -575,7 +575,7 @@ class Opd_prescription extends BaseController
|
||||||
'adr_history' => (string) ($payload['adr_history'] ?? ''),
|
'adr_history' => (string) ($payload['adr_history'] ?? ''),
|
||||||
'current_medications' => (string) ($payload['current_medications'] ?? ''),
|
'current_medications' => (string) ($payload['current_medications'] ?? ''),
|
||||||
];
|
];
|
||||||
$this->mapNabhFieldsToExistingColumns($payload, $fields, $nabhInput);
|
$unmappedNabh = $this->mapNabhFieldsToExistingColumns($payload, $fields, $nabhInput);
|
||||||
|
|
||||||
$patientHistoryInput = [
|
$patientHistoryInput = [
|
||||||
'obstetric_history' => (string) ($payload['obstetric_history'] ?? ''),
|
'obstetric_history' => (string) ($payload['obstetric_history'] ?? ''),
|
||||||
|
|
@ -591,6 +591,13 @@ class Opd_prescription extends BaseController
|
||||||
$payload['Prescriber_Remarks'] = $this->stripNabhFieldsFromRemarks((string) ($payload['Prescriber_Remarks'] ?? ''));
|
$payload['Prescriber_Remarks'] = $this->stripNabhFieldsFromRemarks((string) ($payload['Prescriber_Remarks'] ?? ''));
|
||||||
$payload['Prescriber_Remarks'] = $this->stripPatientHistoryFieldsFromRemarks((string) ($payload['Prescriber_Remarks'] ?? ''));
|
$payload['Prescriber_Remarks'] = $this->stripPatientHistoryFieldsFromRemarks((string) ($payload['Prescriber_Remarks'] ?? ''));
|
||||||
|
|
||||||
|
if ($this->hasAnyNabhField($unmappedNabh)) {
|
||||||
|
$payload['Prescriber_Remarks'] = $this->upsertNabhFieldsIntoRemarks(
|
||||||
|
(string) ($payload['Prescriber_Remarks'] ?? ''),
|
||||||
|
$unmappedNabh
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->hasAnyPatientHistoryField($unmappedPatientHistory)) {
|
if ($this->hasAnyPatientHistoryField($unmappedPatientHistory)) {
|
||||||
$payload['Prescriber_Remarks'] = $this->upsertPatientHistoryFieldsIntoRemarks(
|
$payload['Prescriber_Remarks'] = $this->upsertPatientHistoryFieldsIntoRemarks(
|
||||||
(string) ($payload['Prescriber_Remarks'] ?? ''),
|
(string) ($payload['Prescriber_Remarks'] ?? ''),
|
||||||
|
|
@ -9156,6 +9163,20 @@ class Opd_prescription extends BaseController
|
||||||
return implode("\n", $lines);
|
return implode("\n", $lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $input
|
||||||
|
*/
|
||||||
|
private function hasAnyNabhField(array $input): bool
|
||||||
|
{
|
||||||
|
foreach ($input as $value) {
|
||||||
|
if (trim((string) $value) !== '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, string> $input
|
* @param array<string, string> $input
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user