From f311d5074539b75d5ee406637ec3e43b3137c6ee Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 12 May 2026 12:52:13 +0530 Subject: [PATCH] OPD consult: add women history fields, persist in history, update print sections --- app/Controllers/Opd.php | 111 ++++++++++ app/Controllers/Opd_prescription.php | 217 ++++++++++++++++++- app/Views/billing/opd_letter_head.php | 30 +++ app/Views/billing/opd_letter_head_pdf.php | 30 +++ app/Views/billing/opd_prescription_basic.php | 96 +++++--- 5 files changed, 447 insertions(+), 37 deletions(-) diff --git a/app/Controllers/Opd.php b/app/Controllers/Opd.php index 421c101..ce85c17 100644 --- a/app/Controllers/Opd.php +++ b/app/Controllers/Opd.php @@ -144,6 +144,10 @@ class Opd extends BaseController // Women related 'women_lmp', 'women_last_baby', 'women_pregnancy_related', 'women_related_problems', '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 'morbidities', // Raw comma-separated list 'morbidities_block', // Formatted: Co-Morbidities : Diabetes, HTn, ... @@ -2789,6 +2793,23 @@ class Opd extends BaseController $womenPregnancyRelated = trim((string) ($rx['women_pregnancy_related'] ?? '')); $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 = '' . '' . '
' @@ -2892,6 +2913,13 @@ class Opd extends BaseController 'women_last_baby' => $womenLastBaby, 'women_pregnancy_related' => $womenPregnancyRelated, '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, 'Prescriber_Remarks' => $prescriberRemarksText, @@ -3489,6 +3517,25 @@ class Opd extends BaseController $womenBlock = implode(' | ', $womenParts); $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[] = 'Obstetric: ' . esc($obstetric); } + if ($menstrual !== '') { $patientHistoryParts[] = 'Menstrual: ' . esc($menstrual); } + if ($medicalSurgical !== '') { $patientHistoryParts[] = 'Medical/Surgical: ' . esc($medicalSurgical); } + if ($family !== '') { $patientHistoryParts[] = 'Family: ' . esc($family); } + if ($allergic !== '') { $patientHistoryParts[] = 'Allergic: ' . esc($allergic); } + if ($vaccination !== '') { $patientHistoryParts[] = 'Vaccination: ' . esc($vaccination); } + + $patientHistoryHtml = implode('
', $patientHistoryParts); + $tokens['patient_history_block'] = $patientHistoryHtml !== '' ? $formatBlock('Patient History', $patientHistoryHtml, true) : ''; + // ── Morbidities (formatted) ─────────────────────────────────────────── $tokens['morbidities_block'] = $formatBlock('Co-Morbidities', (string) ($tokens['morbidities'] ?? '')); @@ -3520,6 +3567,7 @@ class Opd extends BaseController (string) ($tokens['Rx'] ?? ''), (string) ($tokens['InvestigationBlock'] ?? ''), (string) ($tokens['RemarksBlock'] ?? ''), + (string) ($tokens['patient_history_block'] ?? ''), (string) ($tokens['AdviceBlock'] ?? ''), (string) ($tokens['NextVisitBlock'] ?? ''), ], 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['adr_history'] = (string) ($nabhInfo['adr_history'] ?? ''); $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; } } @@ -6923,6 +6982,58 @@ class Opd extends BaseController 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 { $extract = static function (string $pattern, string $source): string { diff --git a/app/Controllers/Opd_prescription.php b/app/Controllers/Opd_prescription.php index 7bb65a1..4af12e8 100644 --- a/app/Controllers/Opd_prescription.php +++ b/app/Controllers/Opd_prescription.php @@ -128,6 +128,17 @@ class Opd_prescription extends BaseController $first->drug_allergy_details = (string) ($nabhInfo['drug_allergy_details'] ?? ''); $first->adr_history = (string) ($nabhInfo['adr_history'] ?? ''); $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; } } @@ -390,6 +401,12 @@ class Opd_prescription extends BaseController 'women_lmp' => trim((string) $this->request->getPost('women_lmp')), 'women_last_baby' => trim((string) $this->request->getPost('women_last_baby')), '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_details' => trim((string) $this->request->getPost('drug_allergy_details')), 'adr_history' => trim((string) $this->request->getPost('adr_history')), @@ -465,8 +482,26 @@ class Opd_prescription extends BaseController ]; $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. $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)) { $womenText = trim((string) ($payload['women_related_problems'] ?? '')); @@ -6854,6 +6889,165 @@ class Opd_prescription extends BaseController return trim($clean); } + /** + * @param array $row + * @return array + */ + 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 $payload + * @param array $fields + * @param array $input + * @return array + */ + 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 + */ + 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 $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 $input + */ + private function hasAnyPatientHistoryField(array $input): bool + { + foreach ($input as $value) { + if (trim((string) $value) !== '') { + return true; + } + } + + return false; + } + private function ensureClinicalTemplateTable(): bool { if ($this->db->tableExists('opd_clinical_templates')) { @@ -8651,7 +8845,7 @@ OPD SNAPSHOT JSON: " . $payload; $alerts = []; $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') ->where('p.p_id', $patientId) ->where('p.opd_id !=', $currentOpdId) @@ -8696,6 +8890,27 @@ OPD SNAPSHOT JSON: " . $payload; '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')) { diff --git a/app/Views/billing/opd_letter_head.php b/app/Views/billing/opd_letter_head.php index 8d4c0ca..98f025b 100644 --- a/app/Views/billing/opd_letter_head.php +++ b/app/Views/billing/opd_letter_head.php @@ -71,6 +71,12 @@ $womenLmp = trim((string) ($rx['women_lmp'] ?? '')); $womenLastBaby = trim((string) ($rx['women_last_baby'] ?? '')); $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([ trim((string) ($rx['bp'] ?? '')) !== '' ? ('BP: ' . trim((string) ($rx['bp'] ?? '')) . '/' . trim((string) ($rx['diastolic'] ?? ''))) : '', @@ -141,6 +147,30 @@
Pregnancy Related:
+ +
OBSTETRIC HISTORY:
+ + + +
MENSTRUAL HISTORY:
+ + + +
MEDICAL / SURGICAL HISTORY:
+ + + +
FAMILY HISTORY:
+ + + +
ALLERGIC HISTORY:
+ + + +
VACCINATION:
+ +
Investigation:
diff --git a/app/Views/billing/opd_letter_head_pdf.php b/app/Views/billing/opd_letter_head_pdf.php index 3797ef7..23726a2 100644 --- a/app/Views/billing/opd_letter_head_pdf.php +++ b/app/Views/billing/opd_letter_head_pdf.php @@ -71,6 +71,12 @@ $drugAllergyStatus = trim((string) ($rx['drug_allergy_status'] ?? '')); $drugAllergyDetails = trim((string) ($rx['drug_allergy_details'] ?? '')); $adrHistory = trim((string) ($rx['adr_history'] ?? '')); $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 = [ '0' => 'No Pain', '1' => 'Mild Pain', @@ -307,6 +313,30 @@ $toLocalText = static function (string $input): string { + +
OBSTETRIC HISTORY :
+ + + +
MENSTRUAL HISTORY :
+ + + +
MEDICAL / SURGICAL HISTORY :
+ + + +
FAMILY HISTORY :
+ + + +
ALLERGIC HISTORY :
+ + + +
VACCINATION :
+ +
Diagnosis :
diff --git a/app/Views/billing/opd_prescription_basic.php b/app/Views/billing/opd_prescription_basic.php index 08a43c7..d1b25d7 100644 --- a/app/Views/billing/opd_prescription_basic.php +++ b/app/Views/billing/opd_prescription_basic.php @@ -525,16 +525,6 @@
Loading scan history...
-
-
Extracted Scan Text
-
- -
- - -
-
-
@@ -723,7 +713,41 @@
-
Women Related Problems
+
Women Specific Patient History
+
+
+ + +
0/4000
+
+
+ + +
0/4000
+
+
+ + +
0/4000
+
+
+ + +
0/4000
+
+
+ + +
0/4000
+
+
+ + +
0/4000
+
+
+ +
@@ -735,7 +759,7 @@
- +
@@ -3356,6 +3380,12 @@ women_lmp: $('#women_lmp').length ? $('#women_lmp').val() : '', women_last_baby: $('#women_last_baby').length ? $('#women_last_baby').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_details: $('#drug_allergy_details').length ? $('#drug_allergy_details').val() : '', adr_history: $('#adr_history').length ? $('#adr_history').val() : '', @@ -3429,6 +3459,24 @@ if ($('#women_pregnancy_related').length) { $('#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) { $('#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() { loadPatientScanHistory(); });