OPD consult: add women history fields, persist in history, update print sections
This commit is contained in:
parent
6d6dad5ca0
commit
f311d50745
|
|
@ -144,6 +144,10 @@ class Opd extends BaseController
|
||||||
// Women related
|
// Women related
|
||||||
'women_lmp', 'women_last_baby', 'women_pregnancy_related', 'women_related_problems',
|
'women_lmp', 'women_last_baby', 'women_pregnancy_related', 'women_related_problems',
|
||||||
'women_block', // Formatted: Women Related : LMP | Last Baby | ...
|
'women_block', // Formatted: Women Related : LMP | Last Baby | ...
|
||||||
|
// Women specific patient history
|
||||||
|
'obstetric_history', 'menstrual_history', 'medical_surgical_history',
|
||||||
|
'family_history', 'allergic_history', 'vaccination_history',
|
||||||
|
'patient_history_block',
|
||||||
// Co-morbidities
|
// Co-morbidities
|
||||||
'morbidities', // Raw comma-separated list
|
'morbidities', // Raw comma-separated list
|
||||||
'morbidities_block', // Formatted: Co-Morbidities : Diabetes, HTn, ...
|
'morbidities_block', // Formatted: Co-Morbidities : Diabetes, HTn, ...
|
||||||
|
|
@ -2789,6 +2793,23 @@ class Opd extends BaseController
|
||||||
$womenPregnancyRelated = trim((string) ($rx['women_pregnancy_related'] ?? ''));
|
$womenPregnancyRelated = trim((string) ($rx['women_pregnancy_related'] ?? ''));
|
||||||
$womenRelatedProblems = trim((string) ($rx['women_related_problems'] ?? ''));
|
$womenRelatedProblems = trim((string) ($rx['women_related_problems'] ?? ''));
|
||||||
|
|
||||||
|
// ── Women specific patient history ──────────────────────────────────
|
||||||
|
$obstetricHistory = trim((string) ($rx['obstetric_history'] ?? ''));
|
||||||
|
$menstrualHistory = trim((string) ($rx['menstrual_history'] ?? ''));
|
||||||
|
$medicalSurgicalHistory = trim((string) ($rx['medical_surgical_history'] ?? ''));
|
||||||
|
$familyHistory = trim((string) ($rx['family_history'] ?? ''));
|
||||||
|
$allergicHistory = trim((string) ($rx['allergic_history'] ?? ''));
|
||||||
|
$vaccinationHistory = trim((string) ($rx['vaccination_history'] ?? ''));
|
||||||
|
|
||||||
|
$patientHistoryParts = [];
|
||||||
|
if ($obstetricHistory !== '') { $patientHistoryParts[] = 'Obstetric: ' . $obstetricHistory; }
|
||||||
|
if ($menstrualHistory !== '') { $patientHistoryParts[] = 'Menstrual: ' . $menstrualHistory; }
|
||||||
|
if ($medicalSurgicalHistory !== '') { $patientHistoryParts[] = 'Medical/Surgical: ' . $medicalSurgicalHistory; }
|
||||||
|
if ($familyHistory !== '') { $patientHistoryParts[] = 'Family: ' . $familyHistory; }
|
||||||
|
if ($allergicHistory !== '') { $patientHistoryParts[] = 'Allergic: ' . $allergicHistory; }
|
||||||
|
if ($vaccinationHistory !== '') { $patientHistoryParts[] = 'Vaccination: ' . $vaccinationHistory; }
|
||||||
|
$patientHistoryBlock = implode(' | ', $patientHistoryParts);
|
||||||
|
|
||||||
$printContent = '<table width="100%" border="0" style="font-size:10pt;">'
|
$printContent = '<table width="100%" border="0" style="font-size:10pt;">'
|
||||||
. '<tr>'
|
. '<tr>'
|
||||||
. '<td width="33.3%" valign="top">'
|
. '<td width="33.3%" valign="top">'
|
||||||
|
|
@ -2892,6 +2913,13 @@ class Opd extends BaseController
|
||||||
'women_last_baby' => $womenLastBaby,
|
'women_last_baby' => $womenLastBaby,
|
||||||
'women_pregnancy_related' => $womenPregnancyRelated,
|
'women_pregnancy_related' => $womenPregnancyRelated,
|
||||||
'women_related_problems' => $womenRelatedProblems,
|
'women_related_problems' => $womenRelatedProblems,
|
||||||
|
'obstetric_history' => $obstetricHistory,
|
||||||
|
'menstrual_history' => $menstrualHistory,
|
||||||
|
'medical_surgical_history' => $medicalSurgicalHistory,
|
||||||
|
'family_history' => $familyHistory,
|
||||||
|
'allergic_history' => $allergicHistory,
|
||||||
|
'vaccination_history' => $vaccinationHistory,
|
||||||
|
'patient_history_block' => $patientHistoryBlock,
|
||||||
'Finding_Examinations' => $findingExaminationsText,
|
'Finding_Examinations' => $findingExaminationsText,
|
||||||
'finding_examinations' => $findingExaminationsText,
|
'finding_examinations' => $findingExaminationsText,
|
||||||
'Prescriber_Remarks' => $prescriberRemarksText,
|
'Prescriber_Remarks' => $prescriberRemarksText,
|
||||||
|
|
@ -3489,6 +3517,25 @@ class Opd extends BaseController
|
||||||
$womenBlock = implode(' | ', $womenParts);
|
$womenBlock = implode(' | ', $womenParts);
|
||||||
$tokens['women_block'] = $womenBlock !== '' ? $formatBlock('Women Related', $womenBlock) : '';
|
$tokens['women_block'] = $womenBlock !== '' ? $formatBlock('Women Related', $womenBlock) : '';
|
||||||
|
|
||||||
|
// ── Women specific patient history (formatted) ─────────────────────
|
||||||
|
$patientHistoryParts = [];
|
||||||
|
$obstetric = trim((string) ($tokens['obstetric_history'] ?? ''));
|
||||||
|
$menstrual = trim((string) ($tokens['menstrual_history'] ?? ''));
|
||||||
|
$medicalSurgical = trim((string) ($tokens['medical_surgical_history'] ?? ''));
|
||||||
|
$family = trim((string) ($tokens['family_history'] ?? ''));
|
||||||
|
$allergic = trim((string) ($tokens['allergic_history'] ?? ''));
|
||||||
|
$vaccination = trim((string) ($tokens['vaccination_history'] ?? ''));
|
||||||
|
|
||||||
|
if ($obstetric !== '') { $patientHistoryParts[] = '<strong>Obstetric:</strong> ' . esc($obstetric); }
|
||||||
|
if ($menstrual !== '') { $patientHistoryParts[] = '<strong>Menstrual:</strong> ' . esc($menstrual); }
|
||||||
|
if ($medicalSurgical !== '') { $patientHistoryParts[] = '<strong>Medical/Surgical:</strong> ' . esc($medicalSurgical); }
|
||||||
|
if ($family !== '') { $patientHistoryParts[] = '<strong>Family:</strong> ' . esc($family); }
|
||||||
|
if ($allergic !== '') { $patientHistoryParts[] = '<strong>Allergic:</strong> ' . esc($allergic); }
|
||||||
|
if ($vaccination !== '') { $patientHistoryParts[] = '<strong>Vaccination:</strong> ' . esc($vaccination); }
|
||||||
|
|
||||||
|
$patientHistoryHtml = implode('<br/>', $patientHistoryParts);
|
||||||
|
$tokens['patient_history_block'] = $patientHistoryHtml !== '' ? $formatBlock('Patient History', $patientHistoryHtml, true) : '';
|
||||||
|
|
||||||
// ── Morbidities (formatted) ───────────────────────────────────────────
|
// ── Morbidities (formatted) ───────────────────────────────────────────
|
||||||
$tokens['morbidities_block'] = $formatBlock('Co-Morbidities', (string) ($tokens['morbidities'] ?? ''));
|
$tokens['morbidities_block'] = $formatBlock('Co-Morbidities', (string) ($tokens['morbidities'] ?? ''));
|
||||||
|
|
||||||
|
|
@ -3520,6 +3567,7 @@ class Opd extends BaseController
|
||||||
(string) ($tokens['Rx'] ?? ''),
|
(string) ($tokens['Rx'] ?? ''),
|
||||||
(string) ($tokens['InvestigationBlock'] ?? ''),
|
(string) ($tokens['InvestigationBlock'] ?? ''),
|
||||||
(string) ($tokens['RemarksBlock'] ?? ''),
|
(string) ($tokens['RemarksBlock'] ?? ''),
|
||||||
|
(string) ($tokens['patient_history_block'] ?? ''),
|
||||||
(string) ($tokens['AdviceBlock'] ?? ''),
|
(string) ($tokens['AdviceBlock'] ?? ''),
|
||||||
(string) ($tokens['NextVisitBlock'] ?? ''),
|
(string) ($tokens['NextVisitBlock'] ?? ''),
|
||||||
], static fn ($value): bool => trim((string) $value) !== ''));
|
], static fn ($value): bool => trim((string) $value) !== ''));
|
||||||
|
|
@ -3894,6 +3942,17 @@ class Opd extends BaseController
|
||||||
$row['drug_allergy_details'] = (string) ($nabhInfo['drug_allergy_details'] ?? '');
|
$row['drug_allergy_details'] = (string) ($nabhInfo['drug_allergy_details'] ?? '');
|
||||||
$row['adr_history'] = (string) ($nabhInfo['adr_history'] ?? '');
|
$row['adr_history'] = (string) ($nabhInfo['adr_history'] ?? '');
|
||||||
$row['current_medications'] = (string) ($nabhInfo['current_medications'] ?? '');
|
$row['current_medications'] = (string) ($nabhInfo['current_medications'] ?? '');
|
||||||
|
|
||||||
|
$historyInfo = $this->hydratePatientHistoryPrintFields(
|
||||||
|
$row,
|
||||||
|
(string) ($row['Prescriber_Remarks'] ?? '')
|
||||||
|
);
|
||||||
|
$row['obstetric_history'] = (string) ($historyInfo['obstetric_history'] ?? '');
|
||||||
|
$row['menstrual_history'] = (string) ($historyInfo['menstrual_history'] ?? '');
|
||||||
|
$row['medical_surgical_history'] = (string) ($historyInfo['medical_surgical_history'] ?? '');
|
||||||
|
$row['family_history'] = (string) ($historyInfo['family_history'] ?? '');
|
||||||
|
$row['allergic_history'] = (string) ($historyInfo['allergic_history'] ?? '');
|
||||||
|
$row['vaccination_history'] = (string) ($historyInfo['vaccination_history'] ?? '');
|
||||||
$data['opd_prescription'] = $row;
|
$data['opd_prescription'] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6923,6 +6982,58 @@ class Opd extends BaseController
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function hydratePatientHistoryPrintFields(array $row, string $remarks): array
|
||||||
|
{
|
||||||
|
$pick = function (array $candidates) use ($row): string {
|
||||||
|
foreach ($candidates as $field) {
|
||||||
|
$value = trim((string) ($row[$field] ?? ''));
|
||||||
|
if ($value !== '') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'obstetric_history' => $pick(['obstetric_history', 'obstetric_hist', 'obstetric_details']),
|
||||||
|
'menstrual_history' => $pick(['menstrual_history', 'menstrual_hist', 'menstrual_details']),
|
||||||
|
'medical_surgical_history' => $pick(['medical_surgical_history', 'medical_surgical_hist', 'past_medical_surgical_history', 'medical_history', 'surgical_history']),
|
||||||
|
'family_history' => $pick(['family_history', 'family_hist']),
|
||||||
|
'allergic_history' => $pick(['allergic_history', 'allergy_history', 'allergy_hist']),
|
||||||
|
'vaccination_history' => $pick(['vaccination_history', 'vaccination_hist', 'immunization_history']),
|
||||||
|
];
|
||||||
|
|
||||||
|
$parsed = $this->extractPatientHistoryPrintFieldsFromRemarks($remarks);
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if ($value === '' && ! empty($parsed[$key])) {
|
||||||
|
$data[$key] = (string) $parsed[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function extractPatientHistoryPrintFieldsFromRemarks(string $remarks): array
|
||||||
|
{
|
||||||
|
$extract = static function (string $pattern, string $source): string {
|
||||||
|
if (preg_match($pattern, $source, $m) !== 1) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return trim((string) ($m[1] ?? ''));
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
'obstetric_history' => $extract('/^\s*OBSTETRIC\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'menstrual_history' => $extract('/^\s*MENSTRUAL\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'medical_surgical_history' => $extract('/^\s*MEDICAL\s*\/\s*SURGICAL\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'family_history' => $extract('/^\s*FAMILY\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'allergic_history' => $extract('/^\s*ALLERGIC\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'vaccination_history' => $extract('/^\s*VACCINATION\s*:\s*(.+)$/im', $remarks),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
private function extractNabhFieldsFromRemarks(string $remarks): array
|
private function extractNabhFieldsFromRemarks(string $remarks): array
|
||||||
{
|
{
|
||||||
$extract = static function (string $pattern, string $source): string {
|
$extract = static function (string $pattern, string $source): string {
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,17 @@ class Opd_prescription extends BaseController
|
||||||
$first->drug_allergy_details = (string) ($nabhInfo['drug_allergy_details'] ?? '');
|
$first->drug_allergy_details = (string) ($nabhInfo['drug_allergy_details'] ?? '');
|
||||||
$first->adr_history = (string) ($nabhInfo['adr_history'] ?? '');
|
$first->adr_history = (string) ($nabhInfo['adr_history'] ?? '');
|
||||||
$first->current_medications = (string) ($nabhInfo['current_medications'] ?? '');
|
$first->current_medications = (string) ($nabhInfo['current_medications'] ?? '');
|
||||||
|
|
||||||
|
$historyInfo = $this->hydratePatientHistoryFields(
|
||||||
|
$firstRow,
|
||||||
|
(string) ($first->Prescriber_Remarks ?? '')
|
||||||
|
);
|
||||||
|
$first->obstetric_history = (string) ($historyInfo['obstetric_history'] ?? '');
|
||||||
|
$first->menstrual_history = (string) ($historyInfo['menstrual_history'] ?? '');
|
||||||
|
$first->medical_surgical_history = (string) ($historyInfo['medical_surgical_history'] ?? '');
|
||||||
|
$first->family_history = (string) ($historyInfo['family_history'] ?? '');
|
||||||
|
$first->allergic_history = (string) ($historyInfo['allergic_history'] ?? '');
|
||||||
|
$first->vaccination_history = (string) ($historyInfo['vaccination_history'] ?? '');
|
||||||
$prescription[0] = $first;
|
$prescription[0] = $first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -390,6 +401,12 @@ class Opd_prescription extends BaseController
|
||||||
'women_lmp' => trim((string) $this->request->getPost('women_lmp')),
|
'women_lmp' => trim((string) $this->request->getPost('women_lmp')),
|
||||||
'women_last_baby' => trim((string) $this->request->getPost('women_last_baby')),
|
'women_last_baby' => trim((string) $this->request->getPost('women_last_baby')),
|
||||||
'women_pregnancy_related' => trim((string) $this->request->getPost('women_pregnancy_related')),
|
'women_pregnancy_related' => trim((string) $this->request->getPost('women_pregnancy_related')),
|
||||||
|
'obstetric_history' => trim((string) $this->request->getPost('obstetric_history')),
|
||||||
|
'menstrual_history' => trim((string) $this->request->getPost('menstrual_history')),
|
||||||
|
'medical_surgical_history' => trim((string) $this->request->getPost('medical_surgical_history')),
|
||||||
|
'family_history' => trim((string) $this->request->getPost('family_history')),
|
||||||
|
'allergic_history' => trim((string) $this->request->getPost('allergic_history')),
|
||||||
|
'vaccination_history' => trim((string) $this->request->getPost('vaccination_history')),
|
||||||
'drug_allergy_status' => trim((string) $this->request->getPost('drug_allergy_status')),
|
'drug_allergy_status' => trim((string) $this->request->getPost('drug_allergy_status')),
|
||||||
'drug_allergy_details' => trim((string) $this->request->getPost('drug_allergy_details')),
|
'drug_allergy_details' => trim((string) $this->request->getPost('drug_allergy_details')),
|
||||||
'adr_history' => trim((string) $this->request->getPost('adr_history')),
|
'adr_history' => trim((string) $this->request->getPost('adr_history')),
|
||||||
|
|
@ -465,8 +482,26 @@ class Opd_prescription extends BaseController
|
||||||
];
|
];
|
||||||
$this->mapNabhFieldsToExistingColumns($payload, $fields, $nabhInput);
|
$this->mapNabhFieldsToExistingColumns($payload, $fields, $nabhInput);
|
||||||
|
|
||||||
|
$patientHistoryInput = [
|
||||||
|
'obstetric_history' => (string) ($payload['obstetric_history'] ?? ''),
|
||||||
|
'menstrual_history' => (string) ($payload['menstrual_history'] ?? ''),
|
||||||
|
'medical_surgical_history' => (string) ($payload['medical_surgical_history'] ?? ''),
|
||||||
|
'family_history' => (string) ($payload['family_history'] ?? ''),
|
||||||
|
'allergic_history' => (string) ($payload['allergic_history'] ?? ''),
|
||||||
|
'vaccination_history' => (string) ($payload['vaccination_history'] ?? ''),
|
||||||
|
];
|
||||||
|
$unmappedPatientHistory = $this->mapPatientHistoryFieldsToExistingColumns($payload, $fields, $patientHistoryInput);
|
||||||
|
|
||||||
// Keep prescription remarks user-controlled; do not auto-inject structured NABH lines.
|
// Keep prescription remarks user-controlled; do not auto-inject structured NABH lines.
|
||||||
$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'] ?? ''));
|
||||||
|
|
||||||
|
if ($this->hasAnyPatientHistoryField($unmappedPatientHistory)) {
|
||||||
|
$payload['Prescriber_Remarks'] = $this->upsertPatientHistoryFieldsIntoRemarks(
|
||||||
|
(string) ($payload['Prescriber_Remarks'] ?? ''),
|
||||||
|
$unmappedPatientHistory
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!in_array('women_related_problems', $fields, true)) {
|
if (!in_array('women_related_problems', $fields, true)) {
|
||||||
$womenText = trim((string) ($payload['women_related_problems'] ?? ''));
|
$womenText = trim((string) ($payload['women_related_problems'] ?? ''));
|
||||||
|
|
@ -6854,6 +6889,165 @@ class Opd_prescription extends BaseController
|
||||||
return trim($clean);
|
return trim($clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $row
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
private function hydratePatientHistoryFields(array $row, string $remarks): array
|
||||||
|
{
|
||||||
|
$pick = function (array $candidates) use ($row): string {
|
||||||
|
foreach ($candidates as $field) {
|
||||||
|
$value = trim((string) ($row[$field] ?? ''));
|
||||||
|
if ($value !== '') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'obstetric_history' => $pick(['obstetric_history', 'obstetric_hist', 'obstetric_details']),
|
||||||
|
'menstrual_history' => $pick(['menstrual_history', 'menstrual_hist', 'menstrual_details']),
|
||||||
|
'medical_surgical_history' => $pick(['medical_surgical_history', 'medical_surgical_hist', 'past_medical_surgical_history', 'medical_history', 'surgical_history']),
|
||||||
|
'family_history' => $pick(['family_history', 'family_hist']),
|
||||||
|
'allergic_history' => $pick(['allergic_history', 'allergy_history', 'allergy_hist']),
|
||||||
|
'vaccination_history' => $pick(['vaccination_history', 'vaccination_hist', 'immunization_history']),
|
||||||
|
];
|
||||||
|
|
||||||
|
$parsed = $this->extractPatientHistoryFieldsFromRemarks($remarks);
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if ($value === '' && ! empty($parsed[$key])) {
|
||||||
|
$data[$key] = (string) $parsed[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $payload
|
||||||
|
* @param array<int, string> $fields
|
||||||
|
* @param array<string, string> $input
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
private function mapPatientHistoryFieldsToExistingColumns(array &$payload, array $fields, array $input): array
|
||||||
|
{
|
||||||
|
$mapping = [
|
||||||
|
'obstetric_history' => ['obstetric_history', 'obstetric_hist', 'obstetric_details'],
|
||||||
|
'menstrual_history' => ['menstrual_history', 'menstrual_hist', 'menstrual_details'],
|
||||||
|
'medical_surgical_history' => ['medical_surgical_history', 'medical_surgical_hist', 'past_medical_surgical_history', 'medical_history', 'surgical_history'],
|
||||||
|
'family_history' => ['family_history', 'family_hist'],
|
||||||
|
'allergic_history' => ['allergic_history', 'allergy_history', 'allergy_hist'],
|
||||||
|
'vaccination_history' => ['vaccination_history', 'vaccination_hist', 'immunization_history'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$unmapped = [];
|
||||||
|
foreach ($mapping as $logical => $candidates) {
|
||||||
|
$value = trim((string) ($input[$logical] ?? ''));
|
||||||
|
$target = null;
|
||||||
|
foreach ($candidates as $candidate) {
|
||||||
|
if (in_array($candidate, $fields, true)) {
|
||||||
|
$target = $candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target !== null) {
|
||||||
|
$payload[$target] = $value;
|
||||||
|
} else {
|
||||||
|
$unmapped[$logical] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $unmapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
private function extractPatientHistoryFieldsFromRemarks(string $remarks): array
|
||||||
|
{
|
||||||
|
$extract = static function (string $pattern, string $source): string {
|
||||||
|
if (preg_match($pattern, $source, $m) !== 1) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return trim((string) ($m[1] ?? ''));
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
'obstetric_history' => $extract('/^\s*OBSTETRIC\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'menstrual_history' => $extract('/^\s*MENSTRUAL\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'medical_surgical_history' => $extract('/^\s*MEDICAL\s*\/\s*SURGICAL\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'family_history' => $extract('/^\s*FAMILY\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'allergic_history' => $extract('/^\s*ALLERGIC\s*HISTORY\s*:\s*(.+)$/im', $remarks),
|
||||||
|
'vaccination_history' => $extract('/^\s*VACCINATION\s*:\s*(.+)$/im', $remarks),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function stripPatientHistoryFieldsFromRemarks(string $remarks): string
|
||||||
|
{
|
||||||
|
$clean = trim($remarks);
|
||||||
|
$clean = preg_replace('/\n?\s*OBSTETRIC\s*HISTORY\s*:\s*.+$/im', '', $clean) ?? $clean;
|
||||||
|
$clean = preg_replace('/\n?\s*MENSTRUAL\s*HISTORY\s*:\s*.+$/im', '', $clean) ?? $clean;
|
||||||
|
$clean = preg_replace('/\n?\s*MEDICAL\s*\/\s*SURGICAL\s*HISTORY\s*:\s*.+$/im', '', $clean) ?? $clean;
|
||||||
|
$clean = preg_replace('/\n?\s*FAMILY\s*HISTORY\s*:\s*.+$/im', '', $clean) ?? $clean;
|
||||||
|
$clean = preg_replace('/\n?\s*ALLERGIC\s*HISTORY\s*:\s*.+$/im', '', $clean) ?? $clean;
|
||||||
|
$clean = preg_replace('/\n?\s*VACCINATION\s*:\s*.+$/im', '', $clean) ?? $clean;
|
||||||
|
|
||||||
|
return trim($clean);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $input
|
||||||
|
*/
|
||||||
|
private function upsertPatientHistoryFieldsIntoRemarks(string $remarks, array $input): string
|
||||||
|
{
|
||||||
|
$clean = $this->stripPatientHistoryFieldsFromRemarks($remarks);
|
||||||
|
|
||||||
|
$labels = [
|
||||||
|
'obstetric_history' => 'OBSTETRIC HISTORY',
|
||||||
|
'menstrual_history' => 'MENSTRUAL HISTORY',
|
||||||
|
'medical_surgical_history' => 'MEDICAL / SURGICAL HISTORY',
|
||||||
|
'family_history' => 'FAMILY HISTORY',
|
||||||
|
'allergic_history' => 'ALLERGIC HISTORY',
|
||||||
|
'vaccination_history' => 'VACCINATION',
|
||||||
|
];
|
||||||
|
|
||||||
|
$lines = [];
|
||||||
|
foreach ($labels as $key => $label) {
|
||||||
|
$value = trim((string) ($input[$key] ?? ''));
|
||||||
|
if ($value !== '') {
|
||||||
|
$lines[] = $label . ': ' . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($lines)) {
|
||||||
|
return $clean;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clean !== '') {
|
||||||
|
return $clean . "\n" . implode("\n", $lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode("\n", $lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $input
|
||||||
|
*/
|
||||||
|
private function hasAnyPatientHistoryField(array $input): bool
|
||||||
|
{
|
||||||
|
foreach ($input as $value) {
|
||||||
|
if (trim((string) $value) !== '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private function ensureClinicalTemplateTable(): bool
|
private function ensureClinicalTemplateTable(): bool
|
||||||
{
|
{
|
||||||
if ($this->db->tableExists('opd_clinical_templates')) {
|
if ($this->db->tableExists('opd_clinical_templates')) {
|
||||||
|
|
@ -8651,7 +8845,7 @@ OPD SNAPSHOT JSON: " . $payload;
|
||||||
$alerts = [];
|
$alerts = [];
|
||||||
|
|
||||||
$rows = $this->db->table('opd_prescription p')
|
$rows = $this->db->table('opd_prescription p')
|
||||||
->select('p.opd_id,p.complaints,p.diagnosis,p.bp,p.diastolic,p.pulse,p.temp,p.spo2,p.investigation,p.advice,o.apointment_date')
|
->select('p.*,o.apointment_date')
|
||||||
->join('opd_master o', 'o.opd_id=p.opd_id', 'left')
|
->join('opd_master o', 'o.opd_id=p.opd_id', 'left')
|
||||||
->where('p.p_id', $patientId)
|
->where('p.p_id', $patientId)
|
||||||
->where('p.opd_id !=', $currentOpdId)
|
->where('p.opd_id !=', $currentOpdId)
|
||||||
|
|
@ -8696,6 +8890,27 @@ OPD SNAPSHOT JSON: " . $payload;
|
||||||
'message' => $dateLabel . ': ' . implode(' | ', $vitalLine),
|
'message' => $dateLabel . ': ' . implode(' | ', $vitalLine),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$historyFields = $this->hydratePatientHistoryFields($row, (string) ($row['Prescriber_Remarks'] ?? ''));
|
||||||
|
$historyLabels = [
|
||||||
|
'obstetric_history' => 'Obstetric History',
|
||||||
|
'menstrual_history' => 'Menstrual History',
|
||||||
|
'medical_surgical_history' => 'Medical / Surgical History',
|
||||||
|
'family_history' => 'Family History',
|
||||||
|
'allergic_history' => 'Allergic History',
|
||||||
|
'vaccination_history' => 'Vaccination',
|
||||||
|
];
|
||||||
|
foreach ($historyLabels as $key => $label) {
|
||||||
|
$value = trim((string) ($historyFields[$key] ?? ''));
|
||||||
|
if ($value === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$alerts[] = [
|
||||||
|
'type' => $label,
|
||||||
|
'message' => $dateLabel . ': ' . $value,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->db->tableExists('patient_remark')) {
|
if ($this->db->tableExists('patient_remark')) {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,12 @@
|
||||||
$womenLmp = trim((string) ($rx['women_lmp'] ?? ''));
|
$womenLmp = trim((string) ($rx['women_lmp'] ?? ''));
|
||||||
$womenLastBaby = trim((string) ($rx['women_last_baby'] ?? ''));
|
$womenLastBaby = trim((string) ($rx['women_last_baby'] ?? ''));
|
||||||
$womenPregnancyRelated = trim((string) ($rx['women_pregnancy_related'] ?? ''));
|
$womenPregnancyRelated = trim((string) ($rx['women_pregnancy_related'] ?? ''));
|
||||||
|
$obstetricHistory = trim((string) ($rx['obstetric_history'] ?? ''));
|
||||||
|
$menstrualHistory = trim((string) ($rx['menstrual_history'] ?? ''));
|
||||||
|
$medicalSurgicalHistory = trim((string) ($rx['medical_surgical_history'] ?? ''));
|
||||||
|
$familyHistory = trim((string) ($rx['family_history'] ?? ''));
|
||||||
|
$allergicHistory = trim((string) ($rx['allergic_history'] ?? ''));
|
||||||
|
$vaccinationHistory = trim((string) ($rx['vaccination_history'] ?? ''));
|
||||||
|
|
||||||
$vitals = array_filter([
|
$vitals = array_filter([
|
||||||
trim((string) ($rx['bp'] ?? '')) !== '' ? ('BP: ' . trim((string) ($rx['bp'] ?? '')) . '/' . trim((string) ($rx['diastolic'] ?? ''))) : '',
|
trim((string) ($rx['bp'] ?? '')) !== '' ? ('BP: ' . trim((string) ($rx['bp'] ?? '')) . '/' . trim((string) ($rx['diastolic'] ?? ''))) : '',
|
||||||
|
|
@ -141,6 +147,30 @@
|
||||||
<div class="col-xs-12"><strong>Pregnancy Related:</strong> <?= nl2br(esc($womenPregnancyRelated)) ?></div>
|
<div class="col-xs-12"><strong>Pregnancy Related:</strong> <?= nl2br(esc($womenPregnancyRelated)) ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($obstetricHistory !== '') : ?>
|
||||||
|
<div class="col-xs-12"><strong>OBSTETRIC HISTORY:</strong> <?= nl2br(esc($obstetricHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($menstrualHistory !== '') : ?>
|
||||||
|
<div class="col-xs-12"><strong>MENSTRUAL HISTORY:</strong> <?= nl2br(esc($menstrualHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($medicalSurgicalHistory !== '') : ?>
|
||||||
|
<div class="col-xs-12"><strong>MEDICAL / SURGICAL HISTORY:</strong> <?= nl2br(esc($medicalSurgicalHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($familyHistory !== '') : ?>
|
||||||
|
<div class="col-xs-12"><strong>FAMILY HISTORY:</strong> <?= nl2br(esc($familyHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($allergicHistory !== '') : ?>
|
||||||
|
<div class="col-xs-12"><strong>ALLERGIC HISTORY:</strong> <?= nl2br(esc($allergicHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($vaccinationHistory !== '') : ?>
|
||||||
|
<div class="col-xs-12"><strong>VACCINATION:</strong> <?= nl2br(esc($vaccinationHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($rx['investigation'] ?? '')) : ?>
|
<?php if (!empty($rx['investigation'] ?? '')) : ?>
|
||||||
<div class="col-xs-12"><strong>Investigation:</strong> <?= nl2br(esc((string) ($rx['investigation'] ?? ''))) ?></div>
|
<div class="col-xs-12"><strong>Investigation:</strong> <?= nl2br(esc((string) ($rx['investigation'] ?? ''))) ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,12 @@ $drugAllergyStatus = trim((string) ($rx['drug_allergy_status'] ?? ''));
|
||||||
$drugAllergyDetails = trim((string) ($rx['drug_allergy_details'] ?? ''));
|
$drugAllergyDetails = trim((string) ($rx['drug_allergy_details'] ?? ''));
|
||||||
$adrHistory = trim((string) ($rx['adr_history'] ?? ''));
|
$adrHistory = trim((string) ($rx['adr_history'] ?? ''));
|
||||||
$currentMedications = trim((string) ($rx['current_medications'] ?? ''));
|
$currentMedications = trim((string) ($rx['current_medications'] ?? ''));
|
||||||
|
$obstetricHistory = trim((string) ($rx['obstetric_history'] ?? ''));
|
||||||
|
$menstrualHistory = trim((string) ($rx['menstrual_history'] ?? ''));
|
||||||
|
$medicalSurgicalHistory = trim((string) ($rx['medical_surgical_history'] ?? ''));
|
||||||
|
$familyHistory = trim((string) ($rx['family_history'] ?? ''));
|
||||||
|
$allergicHistory = trim((string) ($rx['allergic_history'] ?? ''));
|
||||||
|
$vaccinationHistory = trim((string) ($rx['vaccination_history'] ?? ''));
|
||||||
$painScaleMap = [
|
$painScaleMap = [
|
||||||
'0' => 'No Pain',
|
'0' => 'No Pain',
|
||||||
'1' => 'Mild Pain',
|
'1' => 'Mild Pain',
|
||||||
|
|
@ -307,6 +313,30 @@ $toLocalText = static function (string $input): string {
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($obstetricHistory !== '') : ?>
|
||||||
|
<div class="section-line"><span class="label">OBSTETRIC HISTORY :</span> <?= nl2br(esc($obstetricHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($menstrualHistory !== '') : ?>
|
||||||
|
<div class="section-line"><span class="label">MENSTRUAL HISTORY :</span> <?= nl2br(esc($menstrualHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($medicalSurgicalHistory !== '') : ?>
|
||||||
|
<div class="section-line"><span class="label">MEDICAL / SURGICAL HISTORY :</span> <?= nl2br(esc($medicalSurgicalHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($familyHistory !== '') : ?>
|
||||||
|
<div class="section-line"><span class="label">FAMILY HISTORY :</span> <?= nl2br(esc($familyHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($allergicHistory !== '') : ?>
|
||||||
|
<div class="section-line"><span class="label">ALLERGIC HISTORY :</span> <?= nl2br(esc($allergicHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($vaccinationHistory !== '') : ?>
|
||||||
|
<div class="section-line"><span class="label">VACCINATION :</span> <?= nl2br(esc($vaccinationHistory)) ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($rx['Provisional_diagnosis'] ?? '')) : ?>
|
<?php if (!empty($rx['Provisional_diagnosis'] ?? '')) : ?>
|
||||||
<div class="section-line"><span class="label">Diagnosis :</span> <?= nl2br(esc((string) ($rx['Provisional_diagnosis'] ?? ''))) ?></div>
|
<div class="section-line"><span class="label">Diagnosis :</span> <?= nl2br(esc((string) ($rx['Provisional_diagnosis'] ?? ''))) ?></div>
|
||||||
<?php elseif (!empty($rx['diagnosis'] ?? '')) : ?>
|
<?php elseif (!empty($rx['diagnosis'] ?? '')) : ?>
|
||||||
|
|
|
||||||
|
|
@ -525,16 +525,6 @@
|
||||||
<div class="text-muted">Loading scan history...</div>
|
<div class="text-muted">Loading scan history...</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header"><strong>Extracted Scan Text</strong></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<textarea id="scan_extracted_text" class="form-control form-control-sm" rows="5" placeholder="ECG/Lab scan text will appear here..."></textarea>
|
|
||||||
<div class="mt-2 d-flex gap-2">
|
|
||||||
<button type="button" class="btn btn-sm btn-outline-success" id="btn_scan_to_finding">Copy to Finding</button>
|
|
||||||
<button type="button" class="btn btn-sm btn-outline-success" id="btn_scan_to_investigation">Copy to Investigation</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-8 rx-right-panel">
|
<div class="col-lg-8 rx-right-panel">
|
||||||
|
|
@ -723,7 +713,41 @@
|
||||||
<?php if ($isFemalePatient) { ?>
|
<?php if ($isFemalePatient) { ?>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="border rounded p-2">
|
<div class="border rounded p-2">
|
||||||
<h6 class="mb-2">Women Related Problems</h6>
|
<h6 class="mb-2">Women Specific Patient History</h6>
|
||||||
|
<div class="row g-2">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label mb-1">OBSTETRIC HISTORY</label>
|
||||||
|
<textarea class="form-control form-control-sm rx-field" id="obstetric_history" rows="2" maxlength="4000" placeholder="Past pregnancies, deliveries, abortions, complications..."><?= esc($opd_prescription[0]->obstetric_history ?? '') ?></textarea>
|
||||||
|
<div class="rx-counter" id="counter_obstetric_history">0/4000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label mb-1">MENSTRUAL HISTORY</label>
|
||||||
|
<textarea class="form-control form-control-sm rx-field" id="menstrual_history" rows="2" maxlength="4000" placeholder="Cycle pattern, flow, dysmenorrhea, menopause status..."><?= esc($opd_prescription[0]->menstrual_history ?? '') ?></textarea>
|
||||||
|
<div class="rx-counter" id="counter_menstrual_history">0/4000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label mb-1">MEDICAL / SURGICAL HISTORY</label>
|
||||||
|
<textarea class="form-control form-control-sm rx-field" id="medical_surgical_history" rows="2" maxlength="4000" placeholder="Past illnesses, surgeries, hospitalizations..."><?= esc($opd_prescription[0]->medical_surgical_history ?? '') ?></textarea>
|
||||||
|
<div class="rx-counter" id="counter_medical_surgical_history">0/4000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label mb-1">FAMILY HISTORY</label>
|
||||||
|
<textarea class="form-control form-control-sm rx-field" id="family_history" rows="2" maxlength="4000" placeholder="Family diseases, hereditary conditions..."><?= esc($opd_prescription[0]->family_history ?? '') ?></textarea>
|
||||||
|
<div class="rx-counter" id="counter_family_history">0/4000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label mb-1">ALLERGIC HISTORY</label>
|
||||||
|
<textarea class="form-control form-control-sm rx-field" id="allergic_history" rows="2" maxlength="4000" placeholder="Drug, food, environmental allergies..."><?= esc($opd_prescription[0]->allergic_history ?? '') ?></textarea>
|
||||||
|
<div class="rx-counter" id="counter_allergic_history">0/4000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label mb-1">VACCINATION</label>
|
||||||
|
<textarea class="form-control form-control-sm rx-field" id="vaccination_history" rows="2" maxlength="4000" placeholder="Immunization status and recent vaccines..."><?= esc($opd_prescription[0]->vaccination_history ?? '') ?></textarea>
|
||||||
|
<div class="rx-counter" id="counter_vaccination_history">0/4000</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="my-2">
|
||||||
<div class="row g-2 mb-2">
|
<div class="row g-2 mb-2">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input type="number" min="0" step="1" class="form-control form-control-sm rx-instant" id="women_lmp" placeholder="LMP (No. of days before)" value="<?= esc($opd_prescription[0]->women_lmp ?? '') ?>">
|
<input type="number" min="0" step="1" class="form-control form-control-sm rx-instant" id="women_lmp" placeholder="LMP (No. of days before)" value="<?= esc($opd_prescription[0]->women_lmp ?? '') ?>">
|
||||||
|
|
@ -735,7 +759,7 @@
|
||||||
<input type="text" class="form-control form-control-sm rx-instant" id="women_pregnancy_related" placeholder="Pregnancy Related" value="<?= esc($opd_prescription[0]->women_pregnancy_related ?? '') ?>">
|
<input type="text" class="form-control form-control-sm rx-instant" id="women_pregnancy_related" placeholder="Pregnancy Related" value="<?= esc($opd_prescription[0]->women_pregnancy_related ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<textarea class="form-control form-control-sm rx-field" id="women_related_problems" rows="2" maxlength="4000" placeholder="Enter women related problems if applicable..."><?= esc($opd_prescription[0]->women_related_problems ?? '') ?></textarea>
|
<textarea class="form-control form-control-sm rx-field" id="women_related_problems" rows="2" maxlength="4000" placeholder="Additional women related notes..."><?= esc($opd_prescription[0]->women_related_problems ?? '') ?></textarea>
|
||||||
<div class="rx-counter" id="counter_women_related_problems">0/4000</div>
|
<div class="rx-counter" id="counter_women_related_problems">0/4000</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -3356,6 +3380,12 @@
|
||||||
women_lmp: $('#women_lmp').length ? $('#women_lmp').val() : '',
|
women_lmp: $('#women_lmp').length ? $('#women_lmp').val() : '',
|
||||||
women_last_baby: $('#women_last_baby').length ? $('#women_last_baby').val() : '',
|
women_last_baby: $('#women_last_baby').length ? $('#women_last_baby').val() : '',
|
||||||
women_pregnancy_related: $('#women_pregnancy_related').length ? $('#women_pregnancy_related').val() : '',
|
women_pregnancy_related: $('#women_pregnancy_related').length ? $('#women_pregnancy_related').val() : '',
|
||||||
|
obstetric_history: $('#obstetric_history').length ? $('#obstetric_history').val() : '',
|
||||||
|
menstrual_history: $('#menstrual_history').length ? $('#menstrual_history').val() : '',
|
||||||
|
medical_surgical_history: $('#medical_surgical_history').length ? $('#medical_surgical_history').val() : '',
|
||||||
|
family_history: $('#family_history').length ? $('#family_history').val() : '',
|
||||||
|
allergic_history: $('#allergic_history').length ? $('#allergic_history').val() : '',
|
||||||
|
vaccination_history: $('#vaccination_history').length ? $('#vaccination_history').val() : '',
|
||||||
drug_allergy_status: $('#drug_allergy_status').length ? $('#drug_allergy_status').val() : '',
|
drug_allergy_status: $('#drug_allergy_status').length ? $('#drug_allergy_status').val() : '',
|
||||||
drug_allergy_details: $('#drug_allergy_details').length ? $('#drug_allergy_details').val() : '',
|
drug_allergy_details: $('#drug_allergy_details').length ? $('#drug_allergy_details').val() : '',
|
||||||
adr_history: $('#adr_history').length ? $('#adr_history').val() : '',
|
adr_history: $('#adr_history').length ? $('#adr_history').val() : '',
|
||||||
|
|
@ -3429,6 +3459,24 @@
|
||||||
if ($('#women_pregnancy_related').length) {
|
if ($('#women_pregnancy_related').length) {
|
||||||
$('#women_pregnancy_related').val(data.women_pregnancy_related || '');
|
$('#women_pregnancy_related').val(data.women_pregnancy_related || '');
|
||||||
}
|
}
|
||||||
|
if ($('#obstetric_history').length) {
|
||||||
|
$('#obstetric_history').val(data.obstetric_history || '');
|
||||||
|
}
|
||||||
|
if ($('#menstrual_history').length) {
|
||||||
|
$('#menstrual_history').val(data.menstrual_history || '');
|
||||||
|
}
|
||||||
|
if ($('#medical_surgical_history').length) {
|
||||||
|
$('#medical_surgical_history').val(data.medical_surgical_history || '');
|
||||||
|
}
|
||||||
|
if ($('#family_history').length) {
|
||||||
|
$('#family_history').val(data.family_history || '');
|
||||||
|
}
|
||||||
|
if ($('#allergic_history').length) {
|
||||||
|
$('#allergic_history').val(data.allergic_history || '');
|
||||||
|
}
|
||||||
|
if ($('#vaccination_history').length) {
|
||||||
|
$('#vaccination_history').val(data.vaccination_history || '');
|
||||||
|
}
|
||||||
if ($('#drug_allergy_status').length) {
|
if ($('#drug_allergy_status').length) {
|
||||||
$('#drug_allergy_status').val(data.drug_allergy_status || '');
|
$('#drug_allergy_status').val(data.drug_allergy_status || '');
|
||||||
}
|
}
|
||||||
|
|
@ -4779,30 +4827,6 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_scan_to_finding').on('click', function() {
|
|
||||||
var txt = ($('#scan_extracted_text').val() || '').trim();
|
|
||||||
if (!txt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var old = ($('#finding_examinations').val() || '').trim();
|
|
||||||
$('#finding_examinations').val(old ? (old + '\n' + txt) : txt);
|
|
||||||
refreshCounters();
|
|
||||||
updateScanBanner();
|
|
||||||
markDirty('Scan text appended to Finding');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn_scan_to_investigation').on('click', function() {
|
|
||||||
var txt = ($('#scan_extracted_text').val() || '').trim();
|
|
||||||
if (!txt) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var old = ($('#investigation').val() || '').trim();
|
|
||||||
$('#investigation').val(old ? (old + '\n' + txt) : txt);
|
|
||||||
refreshCounters();
|
|
||||||
updateScanBanner();
|
|
||||||
markDirty('Scan text appended to Investigation');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn_reload_patient_scan_history').on('click', function() {
|
$('#btn_reload_patient_scan_history').on('click', function() {
|
||||||
loadPatientScanHistory();
|
loadPatientScanHistory();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user