From 8904a0ab9f9c16b4d0c2be1a98ff3df5a2d4cabf Mon Sep 17 00:00:00 2001 From: 5Amogh Date: Wed, 4 Mar 2026 14:04:06 +0530 Subject: [PATCH] feat: amm-2175 dockendra ecg abnormal findings feature added --- .../shared/services/master-data.service.ts | 4 + .../lab/shared/utility/lab-utility.ts | 1 + .../workarea/LabSubmissionDataManipulation.ts | 8 +- .../lab/workarea/workarea.component.html | 114 ++++-------------- .../lab/workarea/workarea.component.ts | 47 +++++++- .../test-and-radiology.component.html | 40 ++++++ .../test-and-radiology.component.ts | 41 ++++++- .../view-test-report.component.html | 5 + ...doctor-diagnosis-case-sheet.component.html | 5 + .../doctor-diagnosis-case-sheet.component.ts | 43 +++++++ .../shared/services/masterdata.service.ts | 4 + src/environments/environment.dev.ts | 1 + src/environments/environment.development.ts | 1 + src/environments/environment.local.ts | 1 + src/environments/environment.prod.ts | 1 + 15 files changed, 220 insertions(+), 96 deletions(-) diff --git a/src/app/app-modules/lab/shared/services/master-data.service.ts b/src/app/app-modules/lab/shared/services/master-data.service.ts index 5470d5b..22b9aa1 100644 --- a/src/app/app-modules/lab/shared/services/master-data.service.ts +++ b/src/app/app-modules/lab/shared/services/master-data.service.ts @@ -35,4 +35,8 @@ export class MasterDataService { visitCode: visitCode, }); } + + getEcgAbnormalFindings() { + return this.http.get(environment.getEcgAbnormalFindingsUrl); + } } diff --git a/src/app/app-modules/lab/shared/utility/lab-utility.ts b/src/app/app-modules/lab/shared/utility/lab-utility.ts index 40795a2..714deb5 100644 --- a/src/app/app-modules/lab/shared/utility/lab-utility.ts +++ b/src/app/app-modules/lab/shared/utility/lab-utility.ts @@ -55,6 +55,7 @@ export class LabUtils { calibrationStatusAPI: null, calibrationEndAPI: null, compListDetails: this.fb.array([]), + ecgAbnormalFindings: this.fb.control([]), }); } diff --git a/src/app/app-modules/lab/workarea/LabSubmissionDataManipulation.ts b/src/app/app-modules/lab/workarea/LabSubmissionDataManipulation.ts index dd34d1f..c35513f 100644 --- a/src/app/app-modules/lab/workarea/LabSubmissionDataManipulation.ts +++ b/src/app/app-modules/lab/workarea/LabSubmissionDataManipulation.ts @@ -37,11 +37,15 @@ export class DataManipulation { const labTestResults: any = []; labForm.forEach((element: any, i: any) => { if (element.prescriptionID || element.procedureID) { - labTestResults.push({ + const procedureObj: any = { prescriptionID: element.prescriptionID, procedureID: element.procedureID, compList: this.labComponentRestruct(element.compListDetails), - }); + }; + if (element.ecgAbnormalFindings && element.ecgAbnormalFindings.length > 0) { + procedureObj.abnormalFindings = element.ecgAbnormalFindings; + } + labTestResults.push(procedureObj); } }); diff --git a/src/app/app-modules/lab/workarea/workarea.component.html b/src/app/app-modules/lab/workarea/workarea.component.html index 7811bd9..4dbc826 100644 --- a/src/app/app-modules/lab/workarea/workarea.component.html +++ b/src/app/app-modules/lab/workarea/workarea.component.html @@ -141,20 +141,7 @@
{{ procedure.value.procedureName }} 
(input)="checkNormalRange(i, j)" (blur)="checkRange(i, j)" [required]=" - procedure.value.isMandatory === - true && - procedure.value.procedureName === - testName && - stripSelected === true - ? true - : false || - (procedure.value - .procedureName !== - testName && - procedure.value - .isMandatory === true) - ? true - : false + isFieldRequired(procedure) " /> @@ -191,22 +178,7 @@
{{ procedure.value.procedureName }} 
>

{{ @@ -220,20 +192,7 @@

{{ procedure.value.procedureName }} 
formControlName="compOptSelected" disableRipple="true" [required]=" - procedure.value.isMandatory === - true && - procedure.value.procedureName === - testName && - stripSelected === true - ? true - : false || - (procedure.value - .procedureName !== - testName && - procedure.value - .isMandatory === true) - ? true - : false + isFieldRequired(procedure) " > {{ procedure.value.procedureName }}  {{ radio.value.name }} -
- - - {{ option.ecgAbnormality }} - - - -
{{ procedure.value.procedureName }}  ?.result }}" [required]=" - procedure.value.isMandatory === - true && - procedure.value.procedureName === - testName && - stripSelected === true - ? true - : false || - (procedure.value - .procedureName !== - testName && - procedure.value - .isMandatory === true) - ? true - : false + isFieldRequired(procedure) " > {{ procedure.value.procedureName }}  +
+ + + + {{ option.findingName }} + + + +
diff --git a/src/app/app-modules/lab/workarea/workarea.component.ts b/src/app/app-modules/lab/workarea/workarea.component.ts index d501fe0..e15dd4b 100644 --- a/src/app/app-modules/lab/workarea/workarea.component.ts +++ b/src/app/app-modules/lab/workarea/workarea.component.ts @@ -85,8 +85,7 @@ export class WorkareaComponent testName!: string; current_language_set: any; maxFileSize = 5; - ecgAbnormalities: any; - enableEcgAbnormal = false; + ecgAbnormalOptions: any[] = []; constructor( private fb: FormBuilder, @@ -108,6 +107,7 @@ export class WorkareaComponent this.getTestRequirements(); this.stepExpand = 0; this.testName = environment.RBSTest; + this.fetchEcgAbnormalFindings(); } ngDoCheck() { this.assignSelectedLanguage(); @@ -118,6 +118,45 @@ export class WorkareaComponent this.current_language_set = getLanguageJson.currentLanguageObject; } + fetchEcgAbnormalFindings() { + this.masterdataService.getEcgAbnormalFindings().subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data) { + this.ecgAbnormalOptions = res.data + .filter((item: any) => !item.deleted) + .sort((a: any, b: any) => + a.findingName.localeCompare(b.findingName), + ); + } + }, + (error) => { + console.error('Error fetching ECG abnormal findings', error); + }, + ); + } + + isEcgAbnormal(procedure: any): boolean { + const name = procedure?.value?.procedureName; + const comps = procedure?.value?.compListDetails; + if (!name || !Array.isArray(comps)) { + return false; + } + return ( + name.includes('ECG') && + comps.some((comp: any) => comp.compOptSelected === 'Abnormal') + ); + } + + isFieldRequired(procedure: any): boolean { + return ( + (procedure.value.isMandatory === true && + procedure.value.procedureName === this.testName && + this.stripSelected === true) || + (procedure.value.procedureName !== this.testName && + procedure.value.isMandatory === true) + ); + } + /** * MERGE ALL 3 FORMS after getting data */ @@ -220,7 +259,8 @@ export class WorkareaComponent * Patch Values for Lab Test Procedure */ patchLabTestProcedureMasterData(test: any, index: any) { - this.labForm.at(index).patchValue({ + const ctrl = this.labForm.at(index); + ctrl.patchValue({ procedureType: test.procedureType, procedureName: test.procedureName, procedureID: test.procedureID, @@ -232,6 +272,7 @@ export class WorkareaComponent calibrationStartAPI: test.calibrationStartAPI, calibrationStatusAPI: test.calibrationStatusAPI, calibrationEndAPI: test.calibrationEndAPI, + ecgAbnormalFindings: test.ecgAbnormalFindings || [], }); this.patchLabTestComponentCommonMasterData(test.compListDetails, index); } diff --git a/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.html b/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.html index 4680ab7..2a8e2bb 100644 --- a/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.html +++ b/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.html @@ -109,6 +109,26 @@

{{ component?.remarks }} + + + ECG Abnormal Findings: + {{ test?.abnormalFindingLabels?.join(", ") }} + + @@ -485,6 +505,26 @@

{{ component?.remarks }} + + + ECG Abnormal Findings: + {{ test?.abnormalFindingLabels?.join(", ") }} + + diff --git a/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.ts b/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.ts index 68bea07..2c3c9ff 100644 --- a/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.ts +++ b/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/test-and-radiology.component.ts @@ -25,7 +25,7 @@ import { ViewTestReportComponent } from './view-test-report/view-test-report.com import { ViewRadiologyUploadedFilesComponent } from '../../../../lab/view-radiology-uploaded-files/view-radiology-uploaded-files.component'; import { LabService } from '../../../../lab/shared/services'; import { ConfirmationService } from '../../../../core/services/confirmation.service'; -import { DoctorService } from '../../../shared/services'; +import { DoctorService, MasterdataService } from '../../../shared/services'; import { DomSanitizer } from '@angular/platform-browser'; import { MatDialog } from '@angular/material/dialog'; import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-language.component'; @@ -61,6 +61,7 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { public sanitizer: DomSanitizer, private testInVitalsService: TestInVitalsService, readonly sessionstorage: SessionStorageService, + private masterdataService: MasterdataService, ) {} currentLabRowsPerPage = 5; @@ -71,6 +72,7 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { beneficiaryRegID: any; visitID: any; visitCategory: any; + ecgFindingsMap: { [key: number]: string } = {}; ngOnInit() { this.beneficiaryRegID = this.sessionstorage.getItem('beneficiaryRegID'); this.visitID = this.sessionstorage.getItem('visitID'); @@ -78,6 +80,7 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { this.testInVitalsService.clearVitalsRBSValueInReports(); this.testInVitalsService.clearVitalsRBSValueInReportsInUpdate(); this.visitCategory = this.sessionstorage.getItem('visitCategory'); + this.fetchEcgAbnormalFindings(); this.testInVitalsService.vitalRBSTestResult$.subscribe((response) => { console.log('vital subscription response: ', response); @@ -206,6 +209,39 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { } } + fetchEcgAbnormalFindings() { + this.masterdataService.getEcgAbnormalFindings().subscribe( + (response: any) => { + if (response && response.data) { + response.data.forEach((finding: any) => { + this.ecgFindingsMap[finding.findingID] = finding.findingName; + }); + } + }, + (error: any) => { + console.error('Error fetching ECG abnormal findings:', error); + }, + ); + } + + mapEcgFindingsToLabels(labResults: any[]) { + if (!labResults || labResults.length === 0) { + return; + } + labResults.forEach((procedure: any) => { + if (procedure.procedureName && procedure.procedureName.includes('ECG')) { + if ( + procedure.abnormalFindings && + procedure.abnormalFindings.length > 0 + ) { + procedure.abnormalFindingLabels = procedure.abnormalFindings.map( + (id: number) => this.ecgFindingsMap[id] || `Unknown (${id})`, + ); + } + } + }); + } + labResults: any = []; radiologyResults: any = []; archivedResults: any = []; @@ -248,6 +284,7 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { }, ); this.archivedResults = res.data.ArchivedVisitcodeForLabResult; + this.mapEcgFindingsToLabels(this.filteredLabResults); this.currentLabPageChanged({ page: this.currentLabActivePage, itemsPerPage: this.currentLabRowsPerPage, @@ -361,6 +398,7 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { ) { this.archivedResults[j] = archivedResponse[i]; } + this.mapEcgFindingsToLabels(this.filteredLabResults); this.currentLabPageChanged({ page: this.currentLabActivePage, @@ -497,6 +535,7 @@ export class TestAndRadiologyComponent implements OnInit, OnDestroy, DoCheck { this.archivedLabResults = response.data.filter((lab: any) => { return lab.procedureType === 'Laboratory'; }); + this.mapEcgFindingsToLabels(this.archivedLabResults); this.filteredArchivedLabResults = this.archivedLabResults; this.previousLabPageChanged({ page: this.previousLabActivePage, diff --git a/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/view-test-report/view-test-report.component.html b/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/view-test-report/view-test-report.component.html index b13a91e..ac83207 100644 --- a/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/view-test-report/view-test-report.component.html +++ b/src/app/app-modules/nurse-doctor/case-record/general-case-record/test-and-radiology/view-test-report/view-test-report.component.html @@ -41,6 +41,11 @@

{{ report?.testResultValue }} {{ report?.testResultUnit }} + + + ECG Abnormal Findings: {{ testReport?.abnormalFindingLabels?.join(', ') }} + +
diff --git a/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.html b/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.html index 00e7bc0..62d3f55 100644 --- a/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.html +++ b/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.html @@ -649,6 +649,11 @@

{{ report?.testResultUnit }} {{ report?.remarks }} + + + ECG Abnormal Findings: {{ procedure?.abnormalFindingLabels?.join(', ') }} + + diff --git a/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts b/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts index 02c4975..c602275 100644 --- a/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts +++ b/src/app/app-modules/nurse-doctor/case-sheet/general-case-sheet/doctor-diagnosis-case-sheet/doctor-diagnosis-case-sheet.component.ts @@ -102,6 +102,7 @@ export class DoctorDiagnosisCaseSheetComponent referralReasonList = ''; isCovidVaccinationStatusVisible = false; userName: any; + ecgFindingsMap: { [key: number]: string } = {}; constructor( private doctorService: DoctorService, @@ -119,6 +120,7 @@ export class DoctorDiagnosisCaseSheetComponent this.getHealthIDDetails(); this.assignSelectedLanguage(); this.getAssessmentID(); + this.fetchEcgAbnormalFindings(); } ngDoCheck() { @@ -274,6 +276,11 @@ export class DoctorDiagnosisCaseSheetComponent ); } + // Map ECG findings IDs to labels + if (this.caseRecords && this.caseRecords.LabReport) { + this.mapEcgFindingsToLabels(this.caseRecords.LabReport); + } + if ( this.caseRecords.diagnosis.complicationOfCurrentPregnancy !== undefined ) { @@ -551,6 +558,42 @@ export class DoctorDiagnosisCaseSheetComponent ); } + fetchEcgAbnormalFindings() { + this.masterdataService.getEcgAbnormalFindings().subscribe( + (response: any) => { + if (response && response.data) { + response.data.forEach((finding: any) => { + this.ecgFindingsMap[finding.findingID] = finding.findingName; + }); + if (this.caseRecords && this.caseRecords.LabReport) { + this.mapEcgFindingsToLabels(this.caseRecords.LabReport); + } + } + }, + (error: any) => { + console.error('Error fetching ECG abnormal findings:', error); + }, + ); + } + + mapEcgFindingsToLabels(labResults: any[]) { + if (!labResults || labResults.length === 0) { + return; + } + labResults.forEach((procedure: any) => { + if (procedure.procedureName && procedure.procedureName.includes('ECG')) { + if ( + procedure.abnormalFindings && + procedure.abnormalFindings.length > 0 + ) { + procedure.abnormalFindingLabels = procedure.abnormalFindings.map( + (id: number) => this.ecgFindingsMap[id] || `Unknown (${id})`, + ); + } + } + }); + } + getAssessmentID() { const benRegID = this.sessionstorage.getItem('caseSheetBeneficiaryRegID'); this.doctorService.getAssessment(benRegID).subscribe((res: any) => { diff --git a/src/app/app-modules/nurse-doctor/shared/services/masterdata.service.ts b/src/app/app-modules/nurse-doctor/shared/services/masterdata.service.ts index a9e95b9..c517bae 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/masterdata.service.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/masterdata.service.ts @@ -197,4 +197,8 @@ export class MasterdataService { }; return this.http.post(this.previousCovidVaccinationUrl, reqObj); } + + getEcgAbnormalFindings() { + return this.http.get(environment.getEcgAbnormalFindingsUrl); + } } diff --git a/src/environments/environment.dev.ts b/src/environments/environment.dev.ts index a8b786b..80da77e 100644 --- a/src/environments/environment.dev.ts +++ b/src/environments/environment.dev.ts @@ -157,6 +157,7 @@ export const environment = { getprescribedTestDataUrl: `${TM_API}labTechnician/get/prescribedProceduresList`, labSaveWork: `${TM_API}labTechnician/save/LabTestResult`, + getEcgAbnormalFindingsUrl: `${TM_API}master/ecgAbnormalFindings`, /** * Worklist Urls diff --git a/src/environments/environment.development.ts b/src/environments/environment.development.ts index 2233d1e..5b1eeaa 100644 --- a/src/environments/environment.development.ts +++ b/src/environments/environment.development.ts @@ -157,6 +157,7 @@ export const environment = { getprescribedTestDataUrl: `${TM_API}labTechnician/get/prescribedProceduresList`, labSaveWork: `${TM_API}labTechnician/save/LabTestResult`, + getEcgAbnormalFindingsUrl: `${TM_API}master/ecgAbnormalFindings`, /** * Worklist Urls diff --git a/src/environments/environment.local.ts b/src/environments/environment.local.ts index e46adb2..a41dd38 100644 --- a/src/environments/environment.local.ts +++ b/src/environments/environment.local.ts @@ -160,6 +160,7 @@ export const environment = { getprescribedTestDataUrl: `${TM_API}labTechnician/get/prescribedProceduresList`, labSaveWork: `${TM_API}labTechnician/save/LabTestResult`, + getEcgAbnormalFindingsUrl: `${TM_API}master/ecgAbnormalFindings`, /** * Worklist Urls diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 80dd9d5..2b4c7f4 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -156,6 +156,7 @@ export const environment = { getprescribedTestDataUrl: `${TM_API}labTechnician/get/prescribedProceduresList`, labSaveWork: `${TM_API}labTechnician/save/LabTestResult`, + getEcgAbnormalFindingsUrl: `${TM_API}master/ecgAbnormalFindings`, /** * Worklist Urls