diff --git a/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.html b/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.html
index f8348a9f..62b66d48 100644
--- a/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.html
+++ b/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.html
@@ -263,87 +263,84 @@
-
-
-
-
-
- {{
- current_language_set?.casesheet?.clinicalObs
- }}
-
- search
-
-
+
+
+
+ {{
+ current_language_set?.casesheet?.clinicalObs
+ }}
+
+
-
-
+ {{ obs.term }}
+
+
+
-
-
+
+
+
+
@@ -351,92 +348,84 @@
-
-
-
-
-
- {{
- current_language_set?.casesheet?.significantFind
- }}
-
-
- search
-
-
+
+
+
+ {{
+ current_language_set?.casesheet?.significantFind
+ }}
+
+
-
-
+ {{ finding.term }}
+
+
+
-
-
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.ts b/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.ts
index 094b8a87..2ff6c858 100644
--- a/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.ts
+++ b/src/app/app-modules/nurse-doctor/case-record/general-case-record/findings/findings.component.ts
@@ -83,6 +83,11 @@ export class FindingsComponent implements OnInit, DoCheck, OnDestroy {
current_language_set: any;
enableIsHistory = false;
enableProvisionalDiag = false;
+
+ suggestedObservationsList: any = [];
+ suggestedFindingsSearchList: any = [];
+ private latestObservationQuery: Map = new Map();
+ private latestFindingsQuery: Map = new Map();
displayedColumns: any = [
'chiefComplaintsDetails',
'duration',
@@ -618,11 +623,7 @@ export class FindingsComponent implements OnInit, DoCheck, OnDestroy {
findingsList.reset();
}
this.generalFindingsForm.markAsDirty();
- this.resetFindingsCheckbox(
- this.generalFindingsForm.controls[
- 'significantFindingsList'
- ].value.at(0).term,
- );
+ this.resetFindingsCheckbox();
}
});
} else {
@@ -631,10 +632,7 @@ export class FindingsComponent implements OnInit, DoCheck, OnDestroy {
} else {
findingsList.reset();
}
- this.resetFindingsCheckbox(
- this.generalFindingsForm.controls['significantFindingsList'].value.at(0)
- .term,
- );
+ this.resetFindingsCheckbox();
}
}
patchCapturedClinicalObservations(clinicalObservations: any) {
@@ -686,12 +684,95 @@ export class FindingsComponent implements OnInit, DoCheck, OnDestroy {
].disable();
if (findingsList.length < savedFindings.length) this.addFindings();
}
- this.resetFindingsCheckbox(
- this.generalFindingsForm.controls['significantFindingsList'].value.at(0)
- .term,
- );
+ this.resetFindingsCheckbox();
+ }
+ }
+ // --- Clinical Observations: Autocomplete search ---
+ onObservationInputKeyup(value: string, index: number) {
+ const term = (value || '').trim();
+ this.latestObservationQuery.set(index, term);
+ const observationsFormArray = this.generalFindingsForm.get(
+ 'clinicalObservationsList',
+ ) as FormArray;
+ const observationsFormGroup = observationsFormArray.at(index) as FormGroup;
+ observationsFormGroup.patchValue({ conceptID: null, term: null });
+ if (term.length >= 3) {
+ this.masterdataService.searchDiagnosisBasedOnPageNo(term, 0).subscribe({
+ next: (results: any) => {
+ if (this.latestObservationQuery.get(index) === term) {
+ this.suggestedObservationsList[index] =
+ results?.data?.sctMaster ?? [];
+ }
+ },
+ error: () => {
+ console.error('Error fetching observation data');
+ },
+ });
+ } else {
+ this.suggestedObservationsList[index] = [];
}
}
+
+ displayObservation(obs: any): string {
+ return typeof obs === 'string' ? obs : obs?.term || '';
+ }
+
+ onObservationSelected(selected: any, index: number) {
+ const observationsFormArray = this.generalFindingsForm.get(
+ 'clinicalObservationsList',
+ ) as FormArray;
+ const observationsFormGroup = observationsFormArray.at(index) as FormGroup;
+ observationsFormGroup.patchValue({
+ clinicalObservationsProvided: selected?.term || null,
+ conceptID: selected?.conceptID || null,
+ term: selected?.term || null,
+ });
+ }
+
+ // --- Significant Findings: Autocomplete search ---
+ onFindingsInputKeyup(value: string, index: number) {
+ const term = (value || '').trim();
+ this.latestFindingsQuery.set(index, term);
+ const findingsFormArray = this.generalFindingsForm.get(
+ 'significantFindingsList',
+ ) as FormArray;
+ const findingsFormGroup = findingsFormArray.at(index) as FormGroup;
+ findingsFormGroup.patchValue({ conceptID: null, term: null });
+ this.resetFindingsCheckbox();
+ if (term.length >= 3) {
+ this.masterdataService.searchDiagnosisBasedOnPageNo(term, 0).subscribe({
+ next: (results: any) => {
+ if (this.latestFindingsQuery.get(index) === term) {
+ this.suggestedFindingsSearchList[index] =
+ results?.data?.sctMaster ?? [];
+ }
+ },
+ error: () => {
+ console.error('Error fetching findings data');
+ },
+ });
+ } else {
+ this.suggestedFindingsSearchList[index] = [];
+ }
+ }
+
+ displayFindings(finding: any): string {
+ return typeof finding === 'string' ? finding : finding?.term || '';
+ }
+
+ onFindingsSelected(selected: any, index: number) {
+ const findingsFormArray = this.generalFindingsForm.get(
+ 'significantFindingsList',
+ ) as FormArray;
+ const findingsFormGroup = findingsFormArray.at(index) as FormGroup;
+ findingsFormGroup.patchValue({
+ significantFindingsProvided: selected?.term || null,
+ conceptID: selected?.conceptID || null,
+ term: selected?.term || null,
+ });
+ this.resetFindingsCheckbox();
+ }
+
ngOnDestroy() {
if (this.doctorMasterDataSubscription)
this.doctorMasterDataSubscription.unsubscribe();
@@ -702,26 +783,18 @@ export class FindingsComponent implements OnInit, DoCheck, OnDestroy {
}
}
- resetFindingsCheckbox(significantFindingsProvidedValue: any) {
- if (
- this.generalFindingsForm.controls['significantFindingsList'].value
- .length === 1 &&
- (significantFindingsProvidedValue === undefined ||
- significantFindingsProvidedValue === null ||
- significantFindingsProvidedValue === '')
- ) {
- this.generalFindingsForm.controls['isForHistory'].patchValue(null);
- this.enableIsHistory = false;
- }
-
- if (
- this.generalFindingsForm.controls['significantFindingsList'].value
- .length > 0 &&
- significantFindingsProvidedValue !== null &&
- significantFindingsProvidedValue !== ''
- ) {
+ resetFindingsCheckbox() {
+ const findingsList = this.generalFindingsForm.get(
+ 'significantFindingsList',
+ ) as FormArray;
+ const hasAnyFinding = findingsList.controls.some((ctrl) => {
+ const val = (ctrl as FormGroup).get('significantFindingsProvided')?.value;
+ return val !== null && val !== undefined && val !== '';
+ });
+ if (hasAnyFinding) {
this.enableIsHistory = true;
} else {
+ this.generalFindingsForm.controls['isForHistory'].patchValue(null);
this.enableIsHistory = false;
}
}
diff --git a/src/app/app-modules/nurse-doctor/case-record/general-case-record/prescription/prescription.component.html b/src/app/app-modules/nurse-doctor/case-record/general-case-record/prescription/prescription.component.html
index fe8657ef..9c83ab6b 100644
--- a/src/app/app-modules/nurse-doctor/case-record/general-case-record/prescription/prescription.component.html
+++ b/src/app/app-modules/nurse-doctor/case-record/general-case-record/prescription/prescription.component.html
@@ -70,7 +70,6 @@
getFormValueChanged();
trackFieldInteraction('Medicine Form Selection')
"
- required
>
name="form"
[(ngModel)]="tempform"
(selectionChange)="getFormValueChanged()"
- required
>
[(ngModel)]="tempDrugName"
(keyup)="filterMedicine(tempDrugName)"
(blur)="reEnterMedicine()"
- required
[matAutocomplete]="autoGroup"
/>
name="dose"
[(ngModel)]="currentPrescription.dose"
[disabled]="!currentPrescription.drugID"
- required
>
name="frequency"
[(ngModel)]="currentPrescription.frequency"
[disabled]="!currentPrescription.drugID"
- required
>
name="duration"
[(ngModel)]="currentPrescription.duration"
[disabled]="!currentPrescription.drugID"
- required
>
name="unit"
[(ngModel)]="currentPrescription.unit"
[disabled]="!currentPrescription.drugID"
- required
>
name="quantity"
[(ngModel)]="currentPrescription.qtyPrescribed"
[disabled]="!currentPrescription.drugID"
- required
>
(
- (caseRecordForm && caseRecordForm.controls
- ? caseRecordForm.controls['drugPrescriptionForm']
- : null)
- );
- if (drugPrescriptionForm) {
- let prescribedDrugs =
- drugPrescriptionForm.value &&
- drugPrescriptionForm.value.prescribedDrugs
- ? drugPrescriptionForm.value.prescribedDrugs
- : [];
- prescribedDrugs = prescribedDrugs.filter((d: any) => !!d.createdBy);
- if (!prescribedDrugs || prescribedDrugs.length === 0) {
- required.push(
- this.current_language_set?.Prescription?.prescriptionRequired ||
- 'Please add at least one prescription',
- );
- }
- }
- } catch (err) {
- console.warn('Error validating prescription presence', err);
- }
- }
if (required.length) {
this.confirmationService.notify(
@@ -3661,7 +3635,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -3925,13 +3900,15 @@ export class WorkareaComponent
labTestOrders.length > 0
) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info
+ ?.datafillSuccessfully ?? 'Data saved successfully',
'success',
);
this.navigateToSpecialistWorklist();
} else {
this.getHealthIDDetails(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info
+ ?.datafillSuccessfully ?? 'Data saved successfully',
);
}
} else {
@@ -3943,13 +3920,15 @@ export class WorkareaComponent
this.schedulerData !== null)
) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info
+ ?.datafillSuccessfully ?? 'Data saved successfully',
'success',
);
this.navigateToDoctorWorklist();
} else {
this.getHealthIDDetails(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info
+ ?.datafillSuccessfully ?? 'Data saved successfully',
);
}
}
@@ -4103,7 +4082,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -4179,7 +4159,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -4212,7 +4193,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -4248,7 +4230,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -4309,13 +4292,15 @@ export class WorkareaComponent
this.schedulerData !== null)
) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info
+ ?.datafillSuccessfully ?? 'Data saved successfully',
'success',
);
this.navigateToDoctorWorklist();
} else {
this.getHealthIDDetails(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info
+ ?.datafillSuccessfully ?? 'Data saved successfully',
);
}
}
@@ -4389,7 +4374,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -4423,7 +4409,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -4466,13 +4453,15 @@ export class WorkareaComponent
this.testsPrescribed.laboratoryList.length > 0
) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToSpecialistWorklist();
} else {
this.getHealthIDDetails(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
);
}
}
@@ -4490,13 +4479,15 @@ export class WorkareaComponent
(this.schedulerData !== undefined && this.schedulerData !== null)
) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToDoctorWorklist();
} else {
this.getHealthIDDetails(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
);
}
}
@@ -4508,7 +4499,8 @@ export class WorkareaComponent
'info',
successResponseFromAPI +
'. ' +
- this.current_language_set.common.doYouWantToLinkCareContext,
+ (this.current_language_set?.common?.doYouWantToLinkCareContext ??
+ 'Do you want to link care context?'),
)
.subscribe((res) => {
if (res) {
@@ -5631,7 +5623,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -5664,7 +5657,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();
@@ -5694,7 +5688,8 @@ export class WorkareaComponent
(res: any) => {
if (res.statusCode === 200 && res.data !== null) {
this.confirmationService.alert(
- this.current_language_set.alerts.info.datafillSuccessfully,
+ this.current_language_set?.alerts?.info?.datafillSuccessfully ??
+ 'Data saved successfully',
'success',
);
this.navigateToNurseWorklist();