From ba673983c325ee72c3c83e815743cab378436e6f Mon Sep 17 00:00:00 2001 From: Ancy Riju Date: Fri, 15 Mar 2024 21:47:08 +0530 Subject: [PATCH] worklist changes --- .../dashboard/dashboard.component.css | 3 + .../dashboard/dashboard.component.spec.ts | 2 +- .../dashboard/dashboard.component.ts | 2 +- .../tm-future-worklist.component.css | 90 + .../tm-future-worklist.component.html | 281 ++ .../tm-future-worklist.component.spec.ts | 46 + .../tm-future-worklist.component.ts | 303 ++ .../doctor-tm-worklist-wrapper.component.css | 3 + .../doctor-tm-worklist-wrapper.component.html | 10 + ...ctor-tm-worklist-wrapper.component.spec.ts | 46 + .../doctor-tm-worklist-wrapper.component.ts | 50 + .../doctor-worklist.component.css | 190 + .../doctor-worklist.component.html | 345 ++ .../doctor-worklist.component.spec.ts | 46 + .../doctor-worklist.component.ts | 692 +++ .../nurse-doctor-routing.module.ts | 38 +- .../nurse-doctor/nurse-doctor.module.ts | 162 +- ...rse-mmu-tm-referred-worklist.component.css | 87 + ...se-mmu-tm-referred-worklist.component.html | 265 ++ ...mmu-tm-referred-worklist.component.spec.ts | 46 + ...rse-mmu-tm-referred-worklist.component.ts} | 129 +- .../nurse-tm-future-worklist.component.css | 90 + .../nurse-tm-future-worklist.component.html | 287 ++ ...nurse-tm-future-worklist.component.spec.ts | 46 + .../nurse-tm-future-worklist.component.ts | 335 ++ .../nurse-tm-worklist.component.css | 161 + .../nurse-tm-worklist.component.html | 325 ++ .../nurse-tm-worklist.component.spec.ts | 46 + .../nurse-tm-worklist.component.ts | 498 +++ .../nurse-worklist-wrapper.component.css | 3 + .../nurse-worklist-wrapper.component.html | 16 + .../nurse-worklist-wrapper.component.spec.ts | 46 + .../nurse-worklist-wrapper.component.ts | 60 + .../nurse-worklist.component.css | 11 +- .../nurse-worklist.component.html | 8 +- .../nurse-worklist.component.spec.ts | 2 +- .../nurse-worklist.component.ts | 493 +++ .../oncologist-worklist.component.css | 33 + .../oncologist-worklist.component.html | 253 ++ .../oncologist-worklist.component.spec.ts | 46 + .../oncologist-worklist.component.ts | 268 ++ .../radiologist-worklist.component.css | 33 + .../radiologist-worklist.component.html | 253 ++ .../radiologist-worklist.component.spec.ts | 46 + .../radiologist-worklist.component.ts | 273 ++ .../services/audio-recording.service.ts | 2 +- .../shared/services/doctor.service.ts | 832 ++-- .../shared/services/idrsscore.service.spec.ts | 2 +- .../shared/services/idrsscore.service.ts | 98 +- .../nurse-doctor/shared/services/index.ts | 2 +- .../shared/services/masterdata.service.ts | 115 +- .../shared/services/nurse.service.ts | 240 +- .../services/test-in-vitals.service.spec.ts | 2 +- .../shared/services/test-in-vitals.service.ts | 4 +- .../shared/utility/cancer-utility.ts | 15 +- .../shared/utility/general-utility.ts | 88 +- .../nurse-doctor/shared/utility/index.ts | 2 +- .../shared/utility/ncd-screening-utility.ts | 4 +- .../shared/utility/quick-consult-utility.ts | 16 +- .../shared/utility/validation-utility.ts | 4 +- .../shared/utility/visit-detail-utility.ts | 79 +- ...c-specialist-future-worklist.component.css | 85 + ...-specialist-future-worklist.component.html | 325 ++ ...ecialist-future-worklist.component.spec.ts | 46 + ...tc-specialist-future-worklist.component.ts | 284 ++ ...-specialist-worklist-wrapper.component.css | 3 + ...specialist-worklist-wrapper.component.html | 12 + ...cialist-worklist-wrapper.component.spec.ts | 46 + ...c-specialist-worklist-wrapper.component.ts | 54 + .../tc-specialist-worklist.component.css | 175 + .../tc-specialist-worklist.component.html | 325 ++ .../tc-specialist-worklist.component.spec.ts | 46 + .../tc-specialist-worklist.component.ts | 571 +++ .../workarea/workarea-can-activate.service.ts | 64 + .../workarea/workarea.component.css | 107 + .../workarea/workarea.component.html | 538 +++ .../workarea/workarea.component.ts | 3864 +++++++++++++++++ .../register-personal-details.component.ts | 14 +- src/app/app-routing.module.ts | 16 +- 79 files changed, 13698 insertions(+), 850 deletions(-) create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.css create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.html create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.ts create mode 100644 src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.spec.ts rename src/app/app-modules/nurse-doctor/{nurse-worklist/nurse-worklist.component.ts => nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.ts} (73%) create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.css create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.html create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.ts rename src/app/app-modules/nurse-doctor/{ => nurse-worklist-wrapper}/nurse-worklist/nurse-worklist.component.css (90%) rename src/app/app-modules/nurse-doctor/{ => nurse-worklist-wrapper}/nurse-worklist/nurse-worklist.component.html (98%) rename src/app/app-modules/nurse-doctor/{ => nurse-worklist-wrapper}/nurse-worklist/nurse-worklist.component.spec.ts (97%) create mode 100644 src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.css create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.html create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.ts create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.css create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.html create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.spec.ts create mode 100644 src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.ts create mode 100644 src/app/app-modules/nurse-doctor/workarea/workarea-can-activate.service.ts create mode 100644 src/app/app-modules/nurse-doctor/workarea/workarea.component.css create mode 100644 src/app/app-modules/nurse-doctor/workarea/workarea.component.html create mode 100644 src/app/app-modules/nurse-doctor/workarea/workarea.component.ts diff --git a/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.css b/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.css index e69de29..f413e64 100644 --- a/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.css +++ b/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.css @@ -0,0 +1,3 @@ +/* .full-width { + height: stretch; +} */ \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.spec.ts b/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.spec.ts index bd7f10e..1b7f4ee 100644 --- a/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.spec.ts +++ b/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.spec.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" diff --git a/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.ts b/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.ts index c7bfbe7..0259d66 100644 --- a/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.ts +++ b/src/app/app-modules/nurse-doctor/dashboard/dashboard.component.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.css b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.css new file mode 100644 index 0000000..760349e --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.css @@ -0,0 +1,90 @@ +.input-full-width { + width: 100%; +} + +mat-pagination { + text-align: right; +} + +mat-input-container { + width: 60%; +} + +mat-card { + min-height: 400px; + padding: 15px; +} + +:host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + mat-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +ul { + list-style: none; + padding: 0px; +} + +ul li { + display: inline-block; + padding: 0 8px; +} + +ul li div, +ul li p { + display: inline-block; +} + +ul li div { + height: 15px; + width: 15px; +} + +.marker-s-f-t-c { + background: #0b69b2; +} + +.action { + text-align: center; +} + +.visitStatus { + position: relative; + text-align: center; +} + +.norecord { + text-align: center; +} + +.no-padding { + padding: 0 !important; +} + +.centered { + justify-content: center; + display: flex; +} + +.visitStatus.s-f-t-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; +} + +.totalCount, +.description { + padding-top: 15px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.html b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.html new file mode 100644 index 0000000..149e536 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.html @@ -0,0 +1,281 @@ +
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ current_language_set?.coreComponents?.sno }} + + {{ element.sno }} + + {{ current_language_set?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ current_language_set?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ current_language_set?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ current_language_set?.bendetails?.age }} + + {{ element.age }} + + {{ current_language_set?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} + + / + {{ element.benVisitNo }} + + {{ current_language_set?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ current_language_set?.bendetails?.tcDate }} + + {{ element.tCRequestDate }} + + {{ current_language_set?.bendetails?.image }} + + profile + +
+ {{ current_language_set?.common?.totalCount }} : + {{ dataSource.data.length }} +
+
+
+
+ {{ current_language_set?.noRecordsFound }} +
+
+
+
    +
  • +
    +

    {{ current_language_set?.common?.scheduledTC }}

    +
  • +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.spec.ts new file mode 100644 index 0000000..b5a8e74 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TmFutureWorklistComponent } from './tm-future-worklist.component'; + +describe('TmFutureWorklistComponent', () => { + let component: TmFutureWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TmFutureWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TmFutureWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.ts b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.ts new file mode 100644 index 0000000..15c7362 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-future-worklist/tm-future-worklist.component.ts @@ -0,0 +1,303 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + DoCheck, + OnDestroy, + OnInit, + ViewChild, +} from '@angular/core'; +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { DoctorService } from '../shared/services'; +import { CameraService } from '../../core/services/camera.service'; +import { MatDialog } from '@angular/material/dialog'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import * as moment from 'moment'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-tm-future-worklist', + templateUrl: './tm-future-worklist.component.html', + styleUrls: ['./tm-future-worklist.component.css'], +}) +export class TmFutureWorklistComponent implements OnInit, DoCheck, OnDestroy { + rowsPerPage = 5; + activePage = 1; + pagedList = []; + rotate = true; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + blankTable = [1, 2, 3, 4, 5]; + filterTerm: any; + current_language_set: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'district', + 'tcDate', + 'image', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private cameraService: CameraService, + private confirmationService: ConfirmationService, + public httpServiceService: HttpServiceService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private doctorService: DoctorService, + ) {} + + ngOnInit() { + localStorage.setItem('currentRole', 'Doctor'); + this.loadWorklist(); + this.assignSelectedLanguage(); + } + + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.current_language_set = getLanguageJson.currentLanguageObject; + } + + ngOnDestroy() { + localStorage.removeItem('currentRole'); + } + + pageChanged(event: any): void { + console.log('called', event); + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + console.log('list', this.pagedList); + } + + loadWorklist() { + this.filterTerm = null; + this.doctorService.getDoctorFutureWorklist().subscribe( + (data: any) => { + if (data && data.statusCode === 200 && data.data) { + console.log( + 'doctor future worklist', + JSON.stringify(data.data, null, 4), + ); + data.data.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + const benlist = this.loadDataToBenList(data.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else this.confirmationService.alert(data.errorMessage, 'error'); + }, + (err) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.arrival = false; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + (element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY HH:mm A') || + 'Not Available'), + (element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'), + (element.tCRequestDate = + moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'); + }); + return data; + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + console.log('item', JSON.stringify(item, null, 4)); + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'age' || + key === 'statusMessage' || + key === 'VisitCategory' || + key === 'benVisitNo' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' || + key === 'beneficiaryRegID' || + key === 'visitDate' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + }); + } + } + + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.current_language_set.alerts.info.imageNotFound, + ); + }); + } + + getBeneficiryStatus(beneficiary: any) { + this.confirmationService.alert(beneficiary.statusMessage); + } + + getVisitStatus(beneficiaryVisitDetials: any) { + const status = { + statusCode: 0, + statusMessage: '', + }; + status.statusMessage = this.current_language_set.alerts.info.scheduledTC; + status.statusCode = 1; + return status; + } + cancelTCRequest(beneficiary: any) { + this.confirmationService + .confirm( + 'info', + this.current_language_set.alerts.info.cancelReq, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.doctorService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.loadWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + }); + } + reSchedule(beneficiary: any) { + this.openScheduler(beneficiary); + } + openScheduler(beneficiary: any) { + // let mdDialogRef: MatDialogRef = this.dialog.open(SchedulerComponent, { + // }) + // mdDialogRef.afterClosed().subscribe((result) => { + // if (result) { + // this.scheduleTC(beneficiary, result.tmSlot); + // } + // console.log(JSON.stringify(result, null, 4)); + // }) + } + scheduleTC(beneficiary: any, tcRequest: any) { + const scedulerRequest = { + benFlowID: beneficiary.benFlowID, + beneficiaryRegID: beneficiary.beneficiaryRegID, + benVisitID: beneficiary.benVisitID, + visitCode: beneficiary.visitCode, + vanID: beneficiary.vanID, + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + tcRequest: tcRequest, + }; + this.doctorService.scheduleTC(scedulerRequest).subscribe( + (res: any) => { + if (res.statusCode === 200) { + this.confirmationService.alert( + this.current_language_set.alerts.info.beneficiaryDetails, + 'success', + ); + this.loadWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } +} diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.css b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.css new file mode 100644 index 0000000..5789cee --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.css @@ -0,0 +1,3 @@ +/* +resolving sonarqube error- Unexpected empty source +*/ \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.html b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.html new file mode 100644 index 0000000..94b9c04 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.html @@ -0,0 +1,10 @@ +
+ + + + + + + + +
diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.spec.ts b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.spec.ts new file mode 100644 index 0000000..9e115b5 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DoctorTmWorklistWrapperComponent } from './doctor-tm-worklist-wrapper.component'; + +describe('DoctorTmWorklistWrapperComponent', () => { + let component: DoctorTmWorklistWrapperComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DoctorTmWorklistWrapperComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DoctorTmWorklistWrapperComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.ts b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.ts new file mode 100644 index 0000000..598ca5d --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component.ts @@ -0,0 +1,50 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { Component, DoCheck, OnInit } from '@angular/core'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; + +@Component({ + selector: 'app-doctor-tm-worklist-wrapper', + templateUrl: './doctor-tm-worklist-wrapper.component.html', + styleUrls: ['./doctor-tm-worklist-wrapper.component.css'], +}) +export class DoctorTmWorklistWrapperComponent implements OnInit, DoCheck { + app: any; + current_language_set: any; + + constructor(public httpServiceService: HttpServiceService) {} + + ngOnInit() { + this.assignSelectedLanguage(); + } + + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.current_language_set = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.css b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.css new file mode 100644 index 0000000..2b95a6b --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.css @@ -0,0 +1,190 @@ +.input-full-width { + width: 100%; +} + +mat-pagination { + text-align: right; +} + +mat-input-container { + width: 60%; +} + +mat-card { + min-height: 400px; + padding: 15px; +} + +:host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + mat-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +ul { + list-style: none; + padding: 0px; +} + +ul li { + display: inline-block; + padding: 0 8px; +} + +ul li div, +ul li p { + display: inline-block; +} + +ul li div { + height: 15px; + width: 15px; +} + +.marker-p-f-c { + background: #0b69b2; +} + +.marker-p-f-t { + background: #e44e4f; +} + +.marker-t-d { + background: #eaaa26; +} + +.marker-c-d { + background: #43760f; +} + +.marker-p-f-t-c { + background: #9933ff; +} + +.marker-t-c-c { + background: black; +} + +.marker-a-f-t-p { + background:#9b1717; +} + +.marker-a-f-t-d { + background:#ba8212; +} + +.color-rows>td { + padding: 0; + border: 0; +} + +.norecord { + text-align: center; +} + +.visitStatus { + position: relative; + text-align: center; +} + +.no-padding { + padding: 0 !important; +} + +.centered { + justify-content: center; + display: flex; +} + +.visitStatus.p-f-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; +} + +.visitStatus.p-f-t-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #9933ff; +} + +.visitStatus.t-c-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: black; +} + +.visitStatus.a-f-t-p::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background:#9b1717; +} + +.visitStatus.a-f-t-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background:#ba8212; +} + + +.visitStatus.p-f-t::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #e44e4f; +} + +.visitStatus.t-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #eaaa26; +} + +.visitStatus.c-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #43760f; +} + +.totalCount, +.description { + padding-top: 15px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.html b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.html new file mode 100644 index 0000000..dabce4d --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.html @@ -0,0 +1,345 @@ +
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.coreComponents?.sno }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} + + / + {{ element.benVisitNo }} + + {{ currentLanguageSet?.bendetails?.visitDate }} + + {{ element.benVisitDate }} + + {{ currentLanguageSet?.bendetails?.beneficiaryArrived }} + + + + {{ currentLanguageSet?.bendetails?.image }} + + profile + + {{ currentLanguageSet?.bendetails?.action }} +
+
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+
+
+
    +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingForConsultation + }} +

    +
  • +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingforLabtestResult + }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.alerts?.info?.labtestDone }}

    +
  • +
  • +
    +

    + {{ currentLanguageSet?.alerts?.info?.consultationDone }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.common?.tmReferred }}

    +
  • +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.spec.ts new file mode 100644 index 0000000..26dc1d0 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DoctorWorklistComponent } from './doctor-worklist.component'; + +describe('DoctorWorklistComponent', () => { + let component: DoctorWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DoctorWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DoctorWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts new file mode 100644 index 0000000..ca77e7a --- /dev/null +++ b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts @@ -0,0 +1,692 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + OnInit, + OnDestroy, + Input, + ViewChild, + DoCheck, +} from '@angular/core'; +import { Router } from '@angular/router'; + +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { DoctorService, MasterdataService } from '../shared/services'; +import { CameraService } from '../../core/services/camera.service'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import * as moment from 'moment'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-doctor-worklist', + templateUrl: './doctor-worklist.component.html', + styleUrls: ['./doctor-worklist.component.css'], +}) +export class DoctorWorklistComponent implements OnInit, OnDestroy, DoCheck { + rowsPerPage = 5; + activePage = 1; + pagedList: any = []; + rotate = true; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + blankTable = [1, 2, 3, 4, 5]; + filterTerm: any; + currentLanguageSet: any; + cbacData: any = []; + beneficiaryMetaData: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'visitDate', + 'beneficiaryArrived', + 'image', + 'action', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private cameraService: CameraService, + private router: Router, + private masterdataService: MasterdataService, + private confirmationService: ConfirmationService, + public httpServiceService: HttpServiceService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private doctorService: DoctorService, + ) {} + + ngOnInit() { + localStorage.setItem('currentRole', 'Doctor'); + this.assignSelectedLanguage(); + this.loadWorklist(); + this.removeBeneficiaryDataForDoctorVisit(); + this.beneficiaryDetailsService.reset(); + this.masterdataService.reset(); + } + + ngDoCheck() { + this.assignSelectedLanguage(); + if ( + this.currentLanguageSet === undefined && + this.currentLanguageSet === null && + this.beneficiaryMetaData === undefined && + this.beneficiaryMetaData === null + ) { + this.beneficiaryMetaData.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + } + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } + + ngOnDestroy() { + localStorage.removeItem('currentRole'); + } + removeBeneficiaryDataForDoctorVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + localStorage.removeItem('specialistFlag'); + } + + pageChanged(event: any): void { + console.log('called', event); + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + console.log('list', this.pagedList); + } + + loadWorklist() { + this.filterTerm = null; + this.beneficiaryMetaData = []; + this.doctorService.getDoctorWorklist().subscribe( + (data: any) => { + if (data && data.statusCode === 200 && data.data) { + console.log('doctor worklist', JSON.stringify(data.data, null, 4)); + this.beneficiaryMetaData = data.data; + data.data.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + const benlist = this.loadDataToBenList(data.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else this.confirmationService.alert(data.errorMessage, 'error'); + }, + (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.arrival = false; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY HH:mm A') || + 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + }); + return data; + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + console.log('item', JSON.stringify(item, null, 4)); + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'age' || + key === 'statusMessage' || + key === 'VisitCategory' || + key === 'benVisitNo' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' || + key === 'beneficiaryRegID' || + key === 'visitDate' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + }); + } + } + + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + loadDoctorExaminationPage(beneficiary: any) { + console.log('beneficiary', JSON.stringify(beneficiary, null, 4)); + localStorage.setItem('visitCode', beneficiary.visitCode); + if (beneficiary.statusCode === 1) { + this.routeToWorkArea(beneficiary); + } else if (beneficiary.statusCode === 2) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 3) { + this.routeToWorkArea(beneficiary); + } else if (beneficiary.statusCode === 4) { + this.checkDoctorStatusAtTcCancelled(beneficiary); + } else if (beneficiary.statusCode === 5) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 9) { + this.viewAndPrintCaseSheet(beneficiary); + } else if (beneficiary.statusCode === 10) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 11) { + this.routeToWorkArea(beneficiary); + } + } + + viewAndPrintCaseSheet(beneficiary: any) { + this.confirmationService + .confirm('info', this.currentLanguageSet.alerts.info.consulation) + .subscribe((res) => { + if (res) { + this.routeToCaseSheet(beneficiary); + } + }); + } + + routeToCaseSheet(beneficiary: any) { + localStorage.setItem('caseSheetBenFlowID', beneficiary.benFlowID); + localStorage.setItem('caseSheetVisitCategory', beneficiary.VisitCategory); + localStorage.setItem( + 'caseSheetBeneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('caseSheetVisitID', beneficiary.benVisitID); + this.router.navigate(['/nurse-docotor/print/' + 'TM' + '/' + 'current']); + } + + routeToWorkArea(beneficiary: any) { + this.cbacData = []; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.beneficiaryDetailsService + .getCBACDetails(beneficiary.beneficiaryRegID) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if ( + res.data.benRegID !== undefined && + res.data.benRegID !== null && + ((res.data.suspectedTB !== undefined && + res.data.suspectedTB !== null) || + (res.data.suspectedNCD !== undefined && + res.data.suspectedNCD !== null) || + (res.data.suspectedHRP !== undefined && + res.data.suspectedHRP !== null) || + (res.data.suspectedNCDDiseases !== undefined && + res.data.suspectedNCDDiseases !== null)) + ) { + if ( + res.data.suspectedHRP !== undefined && + res.data.suspectedHRP !== null && + res.data.suspectedHRP.toLowerCase() === 'yes' + ) + this.cbacData.push('High Risk Pregnancy'); + if ( + res.data.suspectedTB !== undefined && + res.data.suspectedTB !== null && + res.data.suspectedTB.toLowerCase() === 'yes' + ) + this.cbacData.push('Tuberculosis'); + if ( + res.data.suspectedNCDDiseases !== undefined && + res.data.suspectedNCDDiseases !== null && + res.data.suspectedNCDDiseases.length > 0 + ) { + const diseases = res.data.suspectedNCDDiseases.split(','); + if (diseases.length > 0) { + diseases.forEach((element: any) => { + console.log(element.toLowerCase); + if (element.toLowerCase() === 'diabetes') + this.cbacData.push('Diabetes'); + if (element.toLowerCase() === 'hypertension') + this.cbacData.push('Hypertension'); + if (element.toLowerCase() === 'breast cancer') + this.cbacData.push('Breast cancer'); + if (element.toLowerCase() === 'mental health disorder') + this.cbacData.push('Mental health disorder'); + if (element.toLowerCase() === 'oral cancer') + this.cbacData.push('Oral cancer'); + }); + } + } + this.beneficiaryDetailsService.cbacData = this.cbacData; + if ( + this.cbacData !== undefined && + this.cbacData !== null && + this.cbacData.length > 0 + ) { + this.confirmationService + .confirmCBAC( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + this.cbacData, + ) + .subscribe((result) => { + if (result) { + this.updateWorkArea(beneficiary); + } + }); + } else { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + this.updateWorkArea(beneficiary); + } + }); + } + } else { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + this.updateWorkArea(beneficiary); + } + }); + } + } else { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService.alert(err, 'error'); + }, + ); + } + updateWorkArea(beneficiary: any) { + const dataSeted = this.setDataForWorkArea(beneficiary); + if (dataSeted) { + this.router.navigate([ + '/common/attendant/doctor/patient/', + beneficiary.beneficiaryRegID, + ]); + } + } + + setDataForWorkArea(beneficiary: any) { + localStorage.setItem('beneficiaryGender', beneficiary.genderName); + localStorage.setItem('benFlowID', beneficiary.benFlowID); + localStorage.setItem('visitCategory', beneficiary.VisitCategory); + localStorage.setItem('beneficiaryRegID', beneficiary.beneficiaryRegID); + localStorage.setItem('visitID', beneficiary.benVisitID); + localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); + localStorage.setItem('doctorFlag', beneficiary.doctorFlag); + localStorage.setItem('nurseFlag', beneficiary.nurseFlag); + localStorage.setItem('pharmacist_flag', beneficiary.pharmacist_flag); + + return true; + } + + checkDoctorStatusAtTcCancelled(beneficiary: any) { + if (beneficiary.doctorFlag === 2 || beneficiary.nurseFlag === 2) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.doctorFlag === 1) { + this.routeToWorkArea(beneficiary); + } else if (beneficiary.doctorFlag === 3) { + this.routeToWorkArea(beneficiary); + } else if (beneficiary.doctorFlag === 9) { + this.viewAndPrintCaseSheet(beneficiary); + } + } + + toggleArrivalStatus(evt: any, benFlowID: any, index: any) { + let message: string; + if (evt.checked) { + message = this.currentLanguageSet.alerts.info.beneficiaryArrive; + } else { + message = this.currentLanguageSet.alerts.info.cancelStatus; + } + + console.log(benFlowID, '', evt, '', this.beneficiaryList); + + let filteredBenIndex = -1; + this.confirmationService + .confirm('info', message, 'YES', 'NO') + .subscribe((res) => { + if (res) { + this.beneficiaryList.forEach((benef: any, i: any) => { + if (benef.benFlowID === benFlowID) { + filteredBenIndex = i; + } + }); + if (filteredBenIndex >= 0) { + this.beneficiaryList[filteredBenIndex].benArrivedFlag = evt.checked; + this.filteredBeneficiaryList = this.beneficiaryList; + this.dataSource.data = this.beneficiaryList; + this.dataSource.paginator = this.paginator; + if ( + this.filterTerm === null && + this.filterTerm === undefined && + this.filterTerm === '' + ) { + this.filterBeneficiaryList(this.filterTerm); + } + const arrivedBeneficiary = this.beneficiaryList[filteredBenIndex]; + this.doctorService + .updateBeneficiaryArrivalStatus({ + benflowID: arrivedBeneficiary.benFlowID, + benRegID: arrivedBeneficiary.beneficiaryRegID, + visitCode: arrivedBeneficiary.visitCode, + status: evt.checked, + userID: arrivedBeneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.confirmArrival, + 'success', + ); + } else { + this.beneficiaryList[filteredBenIndex].benArrivedFlag = + !evt.checked; + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.beneficiaryList[filteredBenIndex].benArrivedFlag = + !evt.checked; + this.confirmationService.alert(error, 'error'); + }, + ); + } + } else { + this.pagedList[index].benArrivedFlag = !evt.checked; + } + }); + + console.log(benFlowID, '', evt, '', this.beneficiaryList); + } + + getVisitStatus(beneficiaryVisitDetials: any) { + const status = { + statusCode: 0, + statusMessage: '', + }; + + if (beneficiaryVisitDetials.specialist_flag === 0) { + if (beneficiaryVisitDetials.lab_technician_flag === 2) { + status.statusCode = 10; + status.statusMessage = + this.currentLanguageSet.alerts.info.fetosenseTest_pending; + } else if ( + beneficiaryVisitDetials.nurseFlag === 2 || + beneficiaryVisitDetials.doctorFlag === 2 + ) { + status.statusCode = 2; + status.statusMessage = this.currentLanguageSet.alerts.info.pending; + } else if (beneficiaryVisitDetials.doctorFlag === 1) { + status.statusCode = 1; + status.statusMessage = + this.currentLanguageSet.common.pendingForConsultation; + } else if (beneficiaryVisitDetials.lab_technician_flag === 3) { + status.statusCode = 11; + status.statusMessage = + this.currentLanguageSet.alerts.info.fetosenseTest_done; + } else if (beneficiaryVisitDetials.doctorFlag === 3) { + status.statusCode = 3; + status.statusMessage = this.currentLanguageSet.alerts.info.labtestDone; + } else if (beneficiaryVisitDetials.doctorFlag === 9) { + status.statusCode = 9; + status.statusMessage = + this.currentLanguageSet.alerts.info.consultation_done; + } + } else { + if (beneficiaryVisitDetials.specialist_flag === 9) { + status.statusCode = 9; + status.statusMessage = + this.currentLanguageSet.alerts.info.consultation_done; + } else if (beneficiaryVisitDetials.lab_technician_flag === 2) { + status.statusCode = 10; + status.statusMessage = + this.currentLanguageSet.alerts.info.fetosenseTest_pending; + } else if ( + beneficiaryVisitDetials.doctorFlag === 2 || + beneficiaryVisitDetials.nurseFlag === 2 + ) { + status.statusCode = 2; + status.statusMessage = this.currentLanguageSet.alerts.info.pending; + } else if ( + beneficiaryVisitDetials.specialist_flag === 1 || + beneficiaryVisitDetials.specialist_flag === 2 || + beneficiaryVisitDetials.specialist_flag === 3 + ) { + status.statusCode = 5; + status.statusMessage = + this.currentLanguageSet.alerts.info.pendingForConsultation; + } else if (beneficiaryVisitDetials.specialist_flag === 4) { + status.statusCode = 4; // MMUFloW + status.statusMessage = this.currentLanguageSet.alerts.info.teleCancel; + } else if (beneficiaryVisitDetials.lab_technician_flag === 3) { + status.statusCode = 11; + status.statusMessage = + this.currentLanguageSet.alerts.info.fetosenseTest_done; + } else if (beneficiaryVisitDetials.doctorFlag === 3) { + status.statusCode = 3; + status.statusMessage = this.currentLanguageSet.alerts.info.labtestDone; + } else if (beneficiaryVisitDetials.doctorFlag === 1) { + status.statusCode = 1; + status.statusMessage = + this.currentLanguageSet.common.pendingForConsultation; + } + } + + return status; + } + cancelTCRequest(beneficiary: any) { + this.confirmationService + .confirm( + 'info', + this.currentLanguageSet.alerts.info.cancelReq, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.doctorService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.loadWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + }); + } + openScheduler(beneficiary: any) { + // let mdDialogRef: MatDialogRef = this.dialog.open(SchedulerComponent, { + // }) + // mdDialogRef.afterClosed().subscribe((result) => { + // if (result) { + // this.scheduleTC(beneficiary, result.tmSlot); + // } + // console.log(JSON.stringify(result, null, 4)); + // }) + } + scheduleTC(beneficiary: any, tcRequest: any) { + const scedulerRequest = { + benFlowID: beneficiary.benFlowID, + beneficiaryRegID: beneficiary.beneficiaryRegID, + benVisitID: beneficiary.benVisitID, + visitCode: beneficiary.visitCode, + vanID: beneficiary.vanID, + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + tcRequest: tcRequest, + }; + this.doctorService.scheduleTC(scedulerRequest).subscribe( + (res: any) => { + console.log('res', res); + + if (res.statusCode === 200) { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.beneficiaryDetails, + 'success', + ); + this.loadWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + initiateTC(beneficiary: any) { + console.log('ben', beneficiary); + + if (beneficiary.benArrivedFlag) { + this.doctorService + .invokeSwymedCall(beneficiary.tCSpecialistUserID) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data) { + window.location.href = res.data.response; + this.updateTCStartTime(beneficiary); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } else { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.benificiary, + ); + } + } + updateTCStartTime(beneficiary: any) { + const tCStartTimeObj = { + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + }; + this.doctorService + .updateTCStartTime(tCStartTimeObj) + .subscribe((res: any) => { + console.log(res); + }); + } +} diff --git a/src/app/app-modules/nurse-doctor/nurse-doctor-routing.module.ts b/src/app/app-modules/nurse-doctor/nurse-doctor-routing.module.ts index 08745e2..3401a05 100644 --- a/src/app/app-modules/nurse-doctor/nurse-doctor-routing.module.ts +++ b/src/app/app-modules/nurse-doctor/nurse-doctor-routing.module.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -22,13 +22,17 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { WorkareaComponent } from './workarea/workarea.component'; -import { WorkareaCanActivate } from './workarea/workarea-can-activate.service'; -import { CanDeactivateGuardService } from '../core/services/can-deactivate-guard.service'; -import { NurseWorklistTabsComponent } from './nurse-worklist-tabs/nurse-worklist-tabs.component'; + +import { DashboardComponent } from './dashboard/dashboard.component'; +import { NurseWorklistWrapperComponent } from './nurse-worklist-wrapper/nurse-worklist-wrapper.component'; +import { DoctorTmWorklistWrapperComponent } from './doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component'; import { RadiologistWorklistComponent } from './radiologist-worklist/radiologist-worklist.component'; import { OncologistWorklistComponent } from './oncologist-worklist/oncologist-worklist.component'; -import { DashboardComponent } from './dashboard/dashboard.component'; +import { WorkareaComponent } from './workarea/workarea.component'; +import { TcSpecialistWorklistWrapperComponent } from './tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component'; +import { CanDeactivateGuardService } from '../core/services/can-deactivate-guard.service'; + +import { WorkareaCanActivate } from './workarea/workarea-can-activate.service'; const routes: Routes = [ { @@ -42,16 +46,12 @@ const routes: Routes = [ }, { path: 'nurse-worklist', - component: NurseWorklistTabsComponent, + component: NurseWorklistWrapperComponent, + }, + { + path: 'doctor-worklist', + component: DoctorTmWorklistWrapperComponent, }, - // { - // path: 'doctor-worklist', - // component: DoctorWorklistComponent, - // }, - // { - // path: 'doctor-worklist', - // component: DoctorTmWorklistWrapperComponent - // }, { path: 'radiologist-worklist', component: RadiologistWorklistComponent, @@ -60,10 +60,10 @@ const routes: Routes = [ path: 'oncologist-worklist', component: OncologistWorklistComponent, }, - // { - // path: 'tcspecialist-worklist', - // component: TcSpecialistWorklistWrapperComponent - // }, + { + path: 'tcspecialist-worklist', + component: TcSpecialistWorklistWrapperComponent, + }, { path: 'attendant/:attendant/patient/:beneficiaryRegID', component: WorkareaComponent, diff --git a/src/app/app-modules/nurse-doctor/nurse-doctor.module.ts b/src/app/app-modules/nurse-doctor/nurse-doctor.module.ts index 411aef3..ed1a7ca 100644 --- a/src/app/app-modules/nurse-doctor/nurse-doctor.module.ts +++ b/src/app/app-modules/nurse-doctor/nurse-doctor.module.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -25,33 +25,49 @@ import { CommonModule } from '@angular/common'; import { ReactiveFormsModule, FormsModule } from '@angular/forms'; import { CoreModule } from '../core/core.module'; import { NurseDoctorRoutingModule } from './nurse-doctor-routing.module'; -import { DoctorService } from './shared/services/doctor.service'; -import { MasterdataService, NurseService } from './shared/services'; + +import { NurseWorklistComponent } from './nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component'; +import { DoctorWorklistComponent } from './doctor-worklist/doctor-worklist.component'; +import { DashboardComponent } from './dashboard/dashboard.component'; + +import { + NurseService, + DoctorService, + MasterdataService, +} from './shared/services'; +import { WorkareaComponent } from './workarea/workarea.component'; + +import { RadiologistWorklistComponent } from './radiologist-worklist/radiologist-worklist.component'; +import { OncologistWorklistComponent } from './oncologist-worklist/oncologist-worklist.component'; + import { WorkareaCanActivate } from './workarea/workarea-can-activate.service'; -import { HttpServiceService } from '../core/services/http-service.service'; -import { TestInVitalsService } from './shared/services/test-in-vitals.service'; +import { TcSpecialistWorklistComponent } from './tc-specialist-worklist/tc-specialist-worklist.component'; +import { DoctorTmWorklistWrapperComponent } from './doctor-tm-worklist-wrapper/doctor-tm-worklist-wrapper.component'; +import { TmFutureWorklistComponent } from './doctor-tm-future-worklist/tm-future-worklist.component'; +import { TcSpecialistWorklistWrapperComponent } from './tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component'; +import { TcSpecialistFutureWorklistComponent } from './tc-specialist-future-worklist/tc-specialist-future-worklist.component'; +import { NurseWorklistWrapperComponent } from './nurse-worklist-wrapper/nurse-worklist-wrapper.component'; +import { NurseTmWorklistComponent } from './nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component'; +import { NurseTmFutureWorklistComponent } from './nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component'; +import { LabService } from '../../app-modules/lab/shared/services'; import { IdrsscoreService } from './shared/services/idrsscore.service'; +import { NurseMmuTmReferredWorklistComponent } from './nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component'; +import { RegistrarService } from '../registrar/shared/services/registrar.service'; +import { TestInVitalsService } from './shared/services/test-in-vitals.service'; import { HttpClientModule } from '@angular/common/http'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; -import { MaterialModule } from '../core/material.module'; -import { NurseWorklistComponent } from './nurse-worklist/nurse-worklist.component'; import { MatTableModule } from '@angular/material/table'; -import { NurseWorklistTabsComponent } from './nurse-worklist-tabs/nurse-worklist-tabs.component'; -import { NurseRefferedWorklistComponent } from './nurse-worklist-tabs/nurse-reffered-worklist/nurse-reffered-worklist.component'; -import { WorkareaComponent } from './workarea/workarea.component'; -import { MatChipsModule } from '@angular/material/chips'; -import { MatDatepickerModule } from '@angular/material/datepicker'; -import { DoctorWorklistComponent } from './doctor-worklist/doctor-worklist.component'; -import { LabService } from '../lab/shared/services'; -import { RadiologistWorklistComponent } from './radiologist-worklist/radiologist-worklist.component'; -import { OncologistWorklistComponent } from './oncologist-worklist/oncologist-worklist.component'; import { NgxPaginationModule } from 'ngx-pagination'; +import { MaterialModule } from '../core/material.module'; @NgModule({ imports: [ CommonModule, + // ChartsModule, NurseDoctorRoutingModule, CoreModule, ReactiveFormsModule, @@ -68,12 +84,118 @@ import { NgxPaginationModule } from 'ngx-pagination'; ], declarations: [ NurseWorklistComponent, + // PrintPageSelectComponent, + // QuickConsultComponent, + // CancerExaminationComponent, + // GynecologicalExaminationComponent, + // AbdominalExaminationComponent, + // BreastExaminationComponent, + // OralExaminationComponent, + // SignsAndSymptomsComponent, + // ObstetricExaminationComponent, + // GenitoUrinarySystemComponent, + // CentralNervousSystemComponent, + // MusculoskeletalSystemComponent, + // RespiratorySystemComponent, + // GastroIntestinalSystemComponent, + // CardioVascularSystemComponent, + // SystemicExaminationComponent, + // HeadToToeExaminationComponent, + // GeneralExaminationComponent, + // GeneralOpdExaminationComponent, + // CancerPatientVitalsComponent, + // GeneralPatientVitalsComponent, + // MedicationHistoryComponent, + // DevelopmentHistoryComponent, + // FeedingHistoryComponent, + // OtherVaccinesComponent, + // ImmunizationHistoryComponent, + // PastObstericHistoryComponent, + // PerinatalHistoryComponent, + // MenstrualHistoryComponent, + // FamilyHistoryComponent, + // ComorbidityConcurrentConditionsComponent, + // GeneralPersonalHistoryComponent, + // PastHistoryComponent, + // GeneralOpdHistoryComponent, + // CancerHistoryComponent, + // ObstetricHistoryComponent, + // FamilyDiseaseHistoryComponent, + // PersonalHistoryComponent, DoctorWorklistComponent, + // AncComponent, + // AncDetailsComponent, + // AncImmunizationComponent, + // ObstetricFormulaComponent, + // VisitDetailsComponent, + // VisitCategoryComponent, + // ChiefComplaintsComponent, + // AdherenceComponent, + // TravelHistoryComponent, + // SymptomsComponent, + // ContactHistoryComponent, + // InvestigationsComponent, + // UploadFilesComponent, + // HistoryComponent, + // ExaminationComponent, + // VitalsComponent, + // CaseRecordComponent, + // AncComponent, + // PncComponent, + // NcdScreeningComponent, + DashboardComponent, WorkareaComponent, + // CancerCaseRecordComponent, + // GeneralCaseRecordComponent, + // CancerReferComponent, + // GeneralReferComponent, + // CancerCaseSheetComponent, + // GeneralCaseSheetComponent, + // ReferComponent, + // PrintPageSelectComponent, + // PreviousVisitDetailsComponent, + // FindingsComponent, + // DiagnosisComponent, + // PrescriptionComponent, + // DoctorInvestigationsComponent, + // TestAndRadiologyComponent, RadiologistWorklistComponent, OncologistWorklistComponent, - NurseWorklistTabsComponent, - NurseRefferedWorklistComponent, + // GeneralOpdDiagnosisComponent, + // AncDiagnosisComponent, + // CaseSheetComponent, + // NcdCareDiagnosisComponent, + // PncDiagnosisComponent, + // PreviousSignificiantFindingsComponent, + // ViewTestReportComponent, + // HistoryCaseSheetComponent, + // ExaminationCaseSheetComponent, + // AncCaseSheetComponent, + // PncCaseSheetComponent, + // DoctorDiagnosisCaseSheetComponent, + // ImageToCanvasComponent, + // CancerDoctorDiagnosisCaseSheetComponent, + // CancerHistoryCaseSheetComponent, + // CancerExaminationCaseSheetComponent, + // BeneficiaryMctsCallHistoryComponent, + // BeneficiaryPlatformHistoryComponent, + TcSpecialistWorklistComponent, + DoctorTmWorklistWrapperComponent, + TmFutureWorklistComponent, + // SchedulerComponent, + TcSpecialistWorklistWrapperComponent, + TcSpecialistFutureWorklistComponent, + NurseWorklistWrapperComponent, + NurseTmWorklistComponent, + NurseTmFutureWorklistComponent, + // CovidDiagnosisComponent, + // IdrsComponent, + // PhysicalActivityHistoryComponent, + // FamilyHistoryNcdscreeningComponent, + // NcdScreeningDiagnosisComponent, + NurseMmuTmReferredWorklistComponent, + // DiseaseconfirmationComponent, + // CovidVaccinationStatusComponent, ], providers: [ @@ -81,10 +203,10 @@ import { NgxPaginationModule } from 'ngx-pagination'; DoctorService, MasterdataService, WorkareaCanActivate, - HttpServiceService, + LabService, IdrsscoreService, + RegistrarService, TestInVitalsService, - LabService, ], }) export class NurseDoctorModule {} diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.css b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.css new file mode 100644 index 0000000..8123910 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.css @@ -0,0 +1,87 @@ +md2-pagination { + float: right; + } + + md-card { + min-height: 400px; + padding: 15px; + } + + .norecord { + text-align: center; + } + + md-input-container { + width: 60%; + } + + @media (max-width: 481px) { + md-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } + } + + :host /deep/ .pagination { + margin: 0; + } + + .visitStatus { + position: relative; + text-align: center; + } + + .visitStatus.first-visit::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; + } + + .visitStatus.revisit::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #ff9900; + } + + ul { + list-style: none; + padding: 0px; + } + + ul li { + display: inline-block; + padding: 0 8px; + } + + ul li div, + ul li p { + display: inline-block; + } + + ul li div { + height: 15px; + width: 15px; + } + + .first-visit-marker { + background: #43760f; + } + + .revisit-marker { + background: #ff9900; + } + + .totalCount, + .description { + padding-top: 15px; + } \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.html b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.html new file mode 100644 index 0000000..a699295 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.html @@ -0,0 +1,265 @@ +
+
+
+
+ + +
+
+
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.coreComponents?.sno }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element.age }} + + {{ currentLanguageSet?.bendetails?.status }} + + {{ element.benVisitNo === 1 ? "First visit" : "Revisit" }} + + {{ currentLanguageSet?.bendetails?.fatherName }} + + {{ element.fatherName | titlecase }} + + {{ currentLanguageSet?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ currentLanguageSet?.bendetails?.phoneNo }} + + {{ element.preferredPhoneNum }} + + {{ currentLanguageSet?.bendetails?.image }} + + image +
+
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+
+ +
    +
  • +
    +

    {{ currentLanguageSet?.common?.TCPending }}

    +
  • +
+ +
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.spec.ts new file mode 100644 index 0000000..b50ca96 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NurseMmuTmReferredWorklistComponent } from './nurse-mmu-tm-referred-worklist.component'; + +describe('NurseMmuTmReferredWorklistComponent', () => { + let component: NurseMmuTmReferredWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NurseMmuTmReferredWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NurseMmuTmReferredWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.ts similarity index 73% rename from src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.ts rename to src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.ts index 2b2e4d7..6e1ada7 100644 --- a/src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.ts +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-mmu-tm-referred-worklist/nurse-mmu-tm-referred-worklist.component.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -23,30 +23,31 @@ import { Component, DoCheck, - Input, OnDestroy, OnInit, ViewChild, } from '@angular/core'; import { Router } from '@angular/router'; -import { ConfirmationService } from '../../core/services/confirmation.service'; -import { NurseService } from '../shared/services'; -import { CameraService } from '../../core/services/camera.service'; -import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; -import { HttpServiceService } from '../../core/services/http-service.service'; -import { SetLanguageComponent } from '../../core/components/set-language.component'; +import { ConfirmationService } from '../../../core/services/confirmation.service'; +import { NurseService } from '../../shared/services'; +import { CameraService } from '../../../core/services/camera.service'; +import { BeneficiaryDetailsService } from '../../../core/services/beneficiary-details.service'; +import { HttpServiceService } from 'src/app/app-modules/core/services/http-service.service'; +import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-language.component'; import { MatPaginator } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; @Component({ - selector: 'app-nurse-worklist', - templateUrl: './nurse-worklist.component.html', - styleUrls: ['./nurse-worklist.component.css'], + selector: 'app-nurse-mmu-tm-referred-worklist', + templateUrl: './nurse-mmu-tm-referred-worklist.component.html', + styleUrls: ['./nurse-mmu-tm-referred-worklist.component.css'], }) -export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { +export class NurseMmuTmReferredWorklistComponent + implements OnInit, DoCheck, OnDestroy +{ rowsPerPage = 5; activePage = 1; - pagedList: any = []; + pagedList = []; rotate = true; blankTable = [1, 2, 3, 4, 5]; @@ -54,7 +55,7 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { filteredBeneficiaryList: any = []; filterTerm: any; currentLanguageSet: any; - currentPage = 0; + currentPage!: number; displayedColumns: any = [ 'sno', 'beneficiaryID', @@ -76,7 +77,7 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { private router: Router, private cameraService: CameraService, private beneficiaryDetailsService: BeneficiaryDetailsService, - private httpServices: HttpServiceService, + public httpServiceService: HttpServiceService, ) {} ngOnInit() { @@ -86,18 +87,14 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { this.getNurseWorklist(); this.beneficiaryDetailsService.reset(); } - /* - * JA354063 - Multilingual Changes added on 13/10/21 - */ ngDoCheck() { this.assignSelectedLanguage(); } assignSelectedLanguage() { - const getLanguageJson = new SetLanguageComponent(this.httpServices); + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); getLanguageJson.setLanguage(); this.currentLanguageSet = getLanguageJson.currentLanguageObject; } - // Ends ngOnDestroy() { localStorage.removeItem('currentRole'); } @@ -113,11 +110,14 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { localStorage.removeItem('doctorFlag'); localStorage.removeItem('nurseFlag'); localStorage.removeItem('pharmacist_flag'); - localStorage.removeItem('caseSheetTMFlag'); + localStorage.removeItem('specialistFlag'); + localStorage.removeItem('visitCat'); + localStorage.removeItem('mmuReferredVisitCode'); + localStorage.removeItem('referredVisitCode'); } getNurseWorklist() { - this.nurseService.getNurseWorklist().subscribe( + this.nurseService.getMMUNurseWorklist().subscribe( (res: any) => { if (res.statusCode === 200 && res.data !== null) { const benlist = this.loadDataToBenList(res.data); @@ -129,19 +129,11 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { this.dataSource.data.forEach((sectionCount: any, index: number) => { sectionCount.sno = index + 1; }); - // this.pageChanged({ - // page: this.activePage, - // itemsPerPage: this.rowsPerPage, - // }); - this.filterTerm = null; - // this.currentPage=1; - } else { - this.confirmationService.alert(res.errorMessage, 'error'); - this.dataSource.data = []; - this.dataSource.paginator = this.paginator; - } + } else this.confirmationService.alert(res.errorMessage, 'error'); + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; }, - (err) => { + (err: any) => { this.confirmationService.alert(err, 'error'); }, ); @@ -181,24 +173,33 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { loadNursePatientDetails(beneficiary: any) { localStorage.removeItem('visitCategory'); - //for WDF requirment - // if (beneficiary.nurseFlag === 100) { - // this.confirmationService.confirm(`info`, `Please confirm to proceed further`) - // .subscribe(result => { - // if (result) { - // localStorage.setItem('visitCode', beneficiary.visitCode); - // localStorage.setItem('beneficiaryGender', beneficiary.genderName); - // localStorage.setItem('visitCategory', "NCD screening"); - // localStorage.setItem('visitID', beneficiary.benVisitID); - // localStorage.setItem('nurseFlag', beneficiary.nurseFlag); - // localStorage.setItem('beneficiaryRegID', beneficiary.beneficiaryRegID); - // localStorage.setItem('benFlowID', beneficiary.benFlowID); - // localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); - // this.router.navigate(['/common/attendant/nurse/patient/', beneficiary.beneficiaryRegID]); - // } - // }); - // } else - { + if (beneficiary.nurseFlag === 100) { + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + localStorage.setItem('visitCode', beneficiary.visitCode); + localStorage.setItem('beneficiaryGender', beneficiary.genderName); + localStorage.setItem('visitCategory', 'NCD screening'); + localStorage.setItem('visitID', beneficiary.benVisitID); + localStorage.setItem('nurseFlag', beneficiary.nurseFlag); + localStorage.setItem( + 'beneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('benFlowID', beneficiary.benFlowID); + localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); + localStorage.setItem('specialistFlag', beneficiary.specialist_flag); + this.router.navigate([ + '/nurse-doctor/attendant/nurse/patient/', + beneficiary.beneficiaryRegID, + ]); + } + }); + } else { this.confirmationService .confirm( `info`, @@ -213,7 +214,16 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { ); localStorage.setItem('benFlowID', beneficiary.benFlowID); localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); - localStorage.setItem('benVisitNo', beneficiary.benVisitNo); + localStorage.setItem('specialistFlag', beneficiary.specialist_flag); + + localStorage.setItem('visitCode', beneficiary.referredVisitCode); + localStorage.setItem('visitCat', beneficiary.VisitCategory); + localStorage.setItem('visitID', beneficiary.referred_visit_id); + localStorage.setItem( + 'mmuReferredVisitCode', + beneficiary.referredVisitCode, + ); + this.router.navigate([ '/nurse-doctor/attendant/nurse/patient/', beneficiary.beneficiaryRegID, @@ -288,18 +298,5 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { } }); } - // this.activePage = 1; - // this.pageChanged({ - // page: 1, - // itemsPerPage: this.rowsPerPage, - // }); - // this.currentPage=1; } - - // rebash() { - // this.beneficiaryDetailsService.getCheck() - // .subscribe(data => { - // console.log(data); - // }) - // } } diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.css b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.css new file mode 100644 index 0000000..ca74cee --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.css @@ -0,0 +1,90 @@ +.input-full-width { + width: 100%; +} + +md2-pagination { + text-align: right; +} + +md-input-container { + width: 60%; +} + +md-card { + min-height: 400px; + padding: 15px; +} + +:host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + md-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +ul { + list-style: none; + padding: 0px; +} + +ul li { + display: inline-block; + padding: 0 8px; +} + +ul li div, +ul li p { + display: inline-block; +} + +ul li div { + height: 15px; + width: 15px; +} + +.marker-s-f-t-c { + background: #0b69b2; +} + +.action { + text-align: center; +} + +.visitStatus { + position: relative; + text-align: center; +} + +.norecord { + text-align: center; +} + +.no-padding { + padding: 0 !important; +} + +.centered { + justify-content: center; + display: flex; +} + +.visitStatus.s-f-t-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; +} + +.totalCount, +.description { + padding-top: 15px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.html b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.html new file mode 100644 index 0000000..54ba3df --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.html @@ -0,0 +1,287 @@ +
+
+
+
+ + +
+
+
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.coreComponents?.sno }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} + + {{ currentLanguageSet?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ currentLanguageSet?.bendetails?.tcDate }} + + {{ element.tCRequestDate }} + + {{ currentLanguageSet?.bendetails?.image }} + + image + + {{ currentLanguageSet?.bendetails?.action }} + +
    +
  • +
    +

    {{ currentLanguageSet?.common?.scheduleTC }}

    +
  • +
+
+
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.spec.ts new file mode 100644 index 0000000..a71034f --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NurseTmFutureWorklistComponent } from './nurse-tm-future-worklist.component'; + +describe('NurseTmFutureWorklistComponent', () => { + let component: NurseTmFutureWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NurseTmFutureWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NurseTmFutureWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.ts new file mode 100644 index 0000000..8a7f827 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-future-worklist/nurse-tm-future-worklist.component.ts @@ -0,0 +1,335 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + DoCheck, + OnDestroy, + OnInit, + ViewChild, +} from '@angular/core'; +import { Router } from '@angular/router'; +import { ConfirmationService } from '../../../core/services/confirmation.service'; +import { NurseService, DoctorService } from '../../shared/services'; +import { CameraService } from '../../../core/services/camera.service'; +import { BeneficiaryDetailsService } from '../../../core/services/beneficiary-details.service'; + +import * as moment from 'moment'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { HttpServiceService } from 'src/app/app-modules/core/services/http-service.service'; +import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-language.component'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; +@Component({ + selector: 'app-nurse-tm-future-worklist', + templateUrl: './nurse-tm-future-worklist.component.html', + styleUrls: ['./nurse-tm-future-worklist.component.css'], +}) +export class NurseTmFutureWorklistComponent + implements OnInit, DoCheck, OnDestroy +{ + rowsPerPage = 5; + activePage = 1; + pagedList = []; + rotate = true; + + blankTable = [1, 2, 3, 4, 5]; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + filterTerm: any; + currentLanguageSet: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'district', + 'tcDate', + 'image', + 'action', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private nurseService: NurseService, + private confirmationService: ConfirmationService, + private cameraService: CameraService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + public httpServiceService: HttpServiceService, + private doctorService: DoctorService, + ) {} + + ngOnInit() { + this.assignSelectedLanguage(); + localStorage.setItem('currentRole', 'Nurse'); + this.removeBeneficiaryDataForNurseVisit(); + this.getNurseTMFutureWorklist(); + this.beneficiaryDetailsService.reset(); + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } + ngOnDestroy() { + localStorage.removeItem('currentRole'); + } + + removeBeneficiaryDataForNurseVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + } + + getNurseTMFutureWorklist() { + this.nurseService.getNurseTMFutureWorklist().subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + res.data.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + const benlist = this.loadDataToBenList(res.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else this.confirmationService.alert(res.errorMessage, 'error'); + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + }, + (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.fatherName = element.fatherName || 'Not Available'; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.tCRequestDate = + moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + }); + return data; + } + + pageChanged(event: any): void { + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + } + getBeneficiryStatus(beneficiary: any) { + this.confirmationService.alert(beneficiary.statusMessage); + } + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + getVisitStatus(beneficiaryVisitDetials: any) { + const status = { + statusCode: 0, + statusMessage: '', + }; + status.statusMessage = 'Scheduled for TC'; + status.statusCode = 1; + return status; + } + cancelTCRequest(beneficiary: any) { + this.confirmationService + .confirm( + 'info', + this.currentLanguageSet.alerts.info.cancelReq, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.doctorService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.getNurseTMFutureWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + }); + } + reSchedule(beneficiary: any) { + this.openScheduler(beneficiary); + } + openScheduler(beneficiary: any) { + // let mdDialogRef: MatDialogRef = this.dialog.open(SchedulerComponent, { + // }) + // mdDialogRef.afterClosed().subscribe((result) => { + // if (result) { + // this.scheduleTC(beneficiary, result.tmSlot); + // } + // console.log(JSON.stringify(result, null, 4)); + // }) + } + scheduleTC(beneficiary: any, tcRequest: any) { + const scedulerRequest = { + benFlowID: beneficiary.benFlowID, + beneficiaryRegID: beneficiary.beneficiaryRegID, + benVisitID: beneficiary.benVisitID, + visitCode: beneficiary.visitCode, + vanID: beneficiary.vanID, + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + tcRequest: tcRequest, + }; + + console.log('scedulerRequest', scedulerRequest); + this.doctorService.scheduleTC(scedulerRequest).subscribe( + (res: any) => { + if (res.statusCode === 200) { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.beneficiaryDetails, + 'success', + ); + this.getNurseTMFutureWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + console.log('item', JSON.stringify(item, null, 4)); + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'fatherName' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } else { + if (key === 'benVisitNo') { + const value: string = '' + item[key]; + if (value === '1') { + const val = 'First visit'; + if (val.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } else { + const val = 'Revist'; + if (val.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + } + } + }); + } + } +} diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.css b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.css new file mode 100644 index 0000000..be78c45 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.css @@ -0,0 +1,161 @@ +.input-full-width { + width: 100%; +} + +md2-pagination { + text-align: right; +} + +md-input-container { + width: 60%; +} + +md-card { + min-height: 400px; + padding: 15px; +} + +:host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + md-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +ul { + list-style: none; + padding: 0px; +} + +ul li { + display: inline-block; + padding: 0 8px; +} + +ul li div, +ul li p { + display: inline-block; +} + +ul li div { + height: 15px; + width: 15px; +} + +.marker-p-f-c { + background: #0b69b2; +} + +.marker-p-f-t { + background: #e44e4f; +} + +.marker-t-d { + background: #eaaa26; +} + +.marker-c-d { + background: #43760f; +} + +.marker-p-f-t-c { + background: #9933ff; +} + +.marker-t-c-c { + background: black; +} + +.color-rows>td { + padding: 0; + border: 0; +} + +.norecord { + text-align: center; +} + +.visitStatus { + position: relative; + text-align: center; +} + +.no-padding { + padding: 0 !important; +} + +.centered { + justify-content: center; + display: flex; +} + +.visitStatus.p-f-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; +} + +.visitStatus.p-f-t-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #9933ff; +} + +.visitStatus.t-c-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: black; +} + +.visitStatus.p-f-t::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #e44e4f; +} + +.visitStatus.t-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #eaaa26; +} + +.visitStatus.c-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #43760f; +} + +.totalCount, +.description { + padding-top: 15px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.html b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.html new file mode 100644 index 0000000..3740567 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.html @@ -0,0 +1,325 @@ +
+
+
+
+ + +
+
+
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.coreComponents?.sno }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} + + {{ currentLanguageSet?.bendetails?.tcDate }} + + {{ element.tCRequestDate }} + + {{ currentLanguageSet?.bendetails?.beneficiaryArrived }} + + + + {{ currentLanguageSet?.bendetails?.image }} + + image + + {{ currentLanguageSet?.bendetails?.action }} +
+
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+
+
+
    +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingForConsultation + }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.alerts?.info?.teleCancel }}

    +
  • +
  • +
    +

    + {{ currentLanguageSet?.alerts?.info?.consultationDone }} +

    +
  • +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.spec.ts new file mode 100644 index 0000000..2213322 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NurseTmWorklistComponent } from './nurse-tm-worklist.component'; + +describe('NurseTmWorklistComponent', () => { + let component: NurseTmWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NurseTmWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NurseTmWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.ts new file mode 100644 index 0000000..11690f4 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-tm-worklist/nurse-tm-worklist.component.ts @@ -0,0 +1,498 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + DoCheck, + OnDestroy, + OnInit, + ViewChild, +} from '@angular/core'; +import { Router } from '@angular/router'; +import { ConfirmationService } from '../../../core/services/confirmation.service'; +import { NurseService, DoctorService } from '../../shared/services'; +import { CameraService } from '../../../core/services/camera.service'; +import { BeneficiaryDetailsService } from '../../../core/services/beneficiary-details.service'; +import * as moment from 'moment'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { HttpServiceService } from 'src/app/app-modules/core/services/http-service.service'; +import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-language.component'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-nurse-tm-worklist', + templateUrl: './nurse-tm-worklist.component.html', + styleUrls: ['./nurse-tm-worklist.component.css'], +}) +export class NurseTmWorklistComponent implements OnInit, DoCheck, OnDestroy { + rowsPerPage = 5; + activePage = 1; + pagedList: any = []; + rotate = true; + + blankTable = [1, 2, 3, 4, 5]; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + filterTerm: any; + currentLanguageSet: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'tcDate', + 'beneficiaryArrived', + 'image', + 'action', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private nurseService: NurseService, + private confirmationService: ConfirmationService, + private router: Router, + private cameraService: CameraService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + public httpServiceService: HttpServiceService, + private doctorService: DoctorService, + ) {} + + ngOnInit() { + this.assignSelectedLanguage(); + localStorage.setItem('currentRole', 'Nurse'); + this.removeBeneficiaryDataForNurseVisit(); + this.getNurseTMWorklist(); + this.beneficiaryDetailsService.reset(); + } + + ngOnDestroy() { + localStorage.removeItem('currentRole'); + } + + removeBeneficiaryDataForNurseVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + } + + getNurseTMWorklist() { + this.nurseService.getNurseTMWorklist().subscribe( + (res: any) => { + console.log('resof tmnurse', JSON.stringify(res, null, 4)); + + if (res.statusCode === 200 && res.data !== null) { + res.data.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + const benlist = this.loadDataToBenList(res.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else this.confirmationService.alert(res.errorMessage, 'error'); + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + }, + (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + getVisitStatus(beneficiaryVisitDetials: any) { + const status = { + statusCode: 0, + statusMessage: '', + }; + + if ( + beneficiaryVisitDetials.specialist_flag === 1 || + beneficiaryVisitDetials.specialist_flag === 2 || + beneficiaryVisitDetials.specialist_flag === 3 + ) { + status.statusCode = 5; + status.statusMessage = 'Pending For Tele-Consultation'; + } else if (beneficiaryVisitDetials.specialist_flag === 4) { + status.statusCode = 4; + status.statusMessage = 'Tele-Consultation Cancelled'; + } else if (beneficiaryVisitDetials.specialist_flag === 9) { + status.statusCode = 9; + status.statusMessage = 'Tele-Consultation Done'; + } + + return status; + } + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.arrival = false; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY HH:mm A') || + 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.tCRequestDate = + moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.fatherName = element.fatherName || 'Not Available'; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + }); + return data; + } + + pageChanged(event: any): void { + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + } + + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + loadNursePatientDetails(beneficiary: any) { + console.log('Beneficiary', beneficiary); + localStorage.setItem('visitCode', beneficiary.visitCode); + if (beneficiary.statusCode === 5) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 4) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 9) { + this.viewAndPrintCaseSheet(beneficiary); + } + } + viewAndPrintCaseSheet(beneficiary: any) { + this.confirmationService + .confirm('info', this.currentLanguageSet.alerts.info.consulation) + .subscribe((res) => { + if (res) { + this.routeToCaseSheet(beneficiary); + } + }); + } + + routeToCaseSheet(beneficiary: any) { + localStorage.setItem('caseSheetBenFlowID', beneficiary.benFlowID); + localStorage.setItem('caseSheetVisitCategory', beneficiary.VisitCategory); + localStorage.setItem( + 'caseSheetBeneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('caseSheetVisitID', beneficiary.benVisitID); + this.router.navigate(['/nurse-doctor/print/' + 'TM' + '/' + 'current']); + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + console.log('item', JSON.stringify(item, null, 4)); + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'fatherName' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } else { + if (key === 'benVisitNo') { + const value: string = '' + item[key]; + if (value === '1') { + const val = 'First visit'; + if (val.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } else { + const val = 'Revist'; + if (val.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + } + } + }); + } + this.activePage = 1; + this.pageChanged({ + page: 1, + itemsPerPage: this.rowsPerPage, + }); + this.currentPage = 1; + } + + toggleArrivalStatus(evt: any, benFlowID: any, index: any) { + let message: string; + if (evt.checked) { + message = this.currentLanguageSet.alerts.info.beneficiaryArrive; + } else { + message = this.currentLanguageSet.alerts.info.cancelStatus; + } + + console.log(benFlowID, '', evt, '', this.beneficiaryList); + + let filteredBenIndex = -1; + this.confirmationService + .confirm('info', message, 'YES', 'NO') + .subscribe((res) => { + if (res) { + this.beneficiaryList.forEach((benef: any, i: any) => { + if (benef.benFlowID === benFlowID) { + filteredBenIndex = i; + } + }); + if (filteredBenIndex >= 0) { + this.beneficiaryList[filteredBenIndex].benArrivedFlag = evt.checked; + this.filteredBeneficiaryList = this.beneficiaryList; + + const arrivedBeneficiary = this.beneficiaryList[filteredBenIndex]; + this.doctorService + .updateBeneficiaryArrivalStatus({ + benflowID: arrivedBeneficiary.benFlowID, + benRegID: arrivedBeneficiary.beneficiaryRegID, + visitCode: arrivedBeneficiary.visitCode, + status: evt.checked, + userID: arrivedBeneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert( + res.data.response, + 'success', + ); + } else { + this.beneficiaryList[filteredBenIndex].benArrivedFlag = + !evt.checked; + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.beneficiaryList[filteredBenIndex].benArrivedFlag = + !evt.checked; + this.confirmationService.alert(error, 'error'); + }, + ); + } + } else { + this.pagedList[index].benArrivedFlag = !evt.checked; + } + }); + + console.log(benFlowID, '', evt, '', this.beneficiaryList); + } + cancelTCRequest(beneficiary: any) { + console.log( + beneficiary.benFlowID, + beneficiary.beneficiaryRegID, + beneficiary.visitCode, + beneficiary.tCSpecialistUserID, + ); + + this.confirmationService + .confirm( + 'info', + this.currentLanguageSet.alerts.info.cancelReq, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.doctorService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.getNurseTMWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + }); + } + + openScheduler(beneficiary: any) { + // let mdDialogRef: MatDialogRef = this.dialog.open(SchedulerComponent, { + // }) + // mdDialogRef.afterClosed().subscribe((result) => { + // if (result) { + // this.scheduleTC(beneficiary, result.tmSlot); + // } + // console.log(JSON.stringify(result, null, 4)); + // }) + } + scheduleTC(beneficiary: any, tcRequest: any) { + const scedulerRequest = { + benFlowID: beneficiary.benFlowID, + beneficiaryRegID: beneficiary.beneficiaryRegID, + benVisitID: beneficiary.benVisitID, + visitCode: beneficiary.visitCode, + vanID: beneficiary.vanID, + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + tcRequest: tcRequest, + }; + this.doctorService.scheduleTC(scedulerRequest).subscribe( + (res: any) => { + console.log('res', res); + + if (res.statusCode === 200) { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.beneficiaryDetails, + 'success', + ); + this.getNurseTMWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + + initiateTC(beneficiary: any) { + console.log('ben', beneficiary); + if (beneficiary.benArrivedFlag) { + this.doctorService + .invokeSwymedCall(beneficiary.tCSpecialistUserID) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data) { + window.location.href = res.data.response; + this.updateTCStartTime(beneficiary); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } else { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.benificiary, + ); + } + } + updateTCStartTime(beneficiary: any) { + const tCStartTimeObj = { + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + }; + this.doctorService + .updateTCStartTime(tCStartTimeObj) + .subscribe((res: any) => { + console.log(res); + }); + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.css b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.css new file mode 100644 index 0000000..5789cee --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.css @@ -0,0 +1,3 @@ +/* +resolving sonarqube error- Unexpected empty source +*/ \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.html b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.html new file mode 100644 index 0000000..599803f --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.html @@ -0,0 +1,16 @@ +
+ + + + + + + + + + + + + + +
diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.spec.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.spec.ts new file mode 100644 index 0000000..3547eb1 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NurseWorklistWrapperComponent } from './nurse-worklist-wrapper.component'; + +describe('NurseWorklistWrapperComponent', () => { + let component: NurseWorklistWrapperComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NurseWorklistWrapperComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NurseWorklistWrapperComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.ts new file mode 100644 index 0000000..9a8fd88 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist-wrapper.component.ts @@ -0,0 +1,60 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { Component, DoCheck, OnInit } from '@angular/core'; +import { NurseService } from '../shared/services'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import { MatTabChangeEvent } from '@angular/material/tabs'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; + +@Component({ + selector: 'app-nurse-worklist-wrapper', + templateUrl: './nurse-worklist-wrapper.component.html', + styleUrls: ['./nurse-worklist-wrapper.component.css'], +}) +export class NurseWorklistWrapperComponent implements OnInit, DoCheck { + currentLanguageSet: any; + + constructor( + public httpServiceService: HttpServiceService, + private nurseService: NurseService, + ) {} + + ngOnInit() { + this.assignSelectedLanguage(); + this.nurseService.setIsMMUTC('no'); + } + + public tabChanged(tabChangeEvent: MatTabChangeEvent): void { + console.log('changedtab', tabChangeEvent.index); + if (tabChangeEvent.index === 3) this.nurseService.setIsMMUTC('yes'); + else this.nurseService.setIsMMUTC('no'); + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.css b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.css similarity index 90% rename from src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.css rename to src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.css index cc56977..9c1a0ab 100644 --- a/src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.css +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.css @@ -1,8 +1,8 @@ -md2-pagination { +mat-pagination { float: right; } -md-card { +mat-card { min-height: 400px; padding: 15px; } @@ -11,21 +11,20 @@ md-card { text-align: center; } -md-input-container { +mat-input-container { width: 60%; } @media (max-width: 481px) { - md-input-container { + mat-input-container { width: 100%; } - #caseSheetButton { width: 100%; } } -::ng-deep.pagination { +:host /deep/ .pagination { margin: 0; } diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.html b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.html similarity index 98% rename from src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.html rename to src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.html index 6b2dc3a..8a3d8a6 100644 --- a/src/app/app-modules/nurse-doctor/nurse-worklist/nurse-worklist.component.html +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.html @@ -18,7 +18,7 @@
+
+ +
+ + +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.coreComponents?.sno }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element?.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element?.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} / + {{ element.benVisitNo }} + + {{ currentLanguageSet?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ currentLanguageSet?.bendetails?.phoneNo }} + + {{ element.preferredPhoneNum }} + + {{ currentLanguageSet?.bendetails?.visitDate }} + + {{ element.benVisitDate }} + + {{ currentLanguageSet?.bendetails?.image }} + + profile +
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+ + +
+
+
+
+ diff --git a/src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.spec.ts new file mode 100644 index 0000000..eae00a6 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OncologistWorklistComponent } from './oncologist-worklist.component'; + +describe('OncologistWorklistComponent', () => { + let component: OncologistWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [OncologistWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OncologistWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.ts b/src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.ts new file mode 100644 index 0000000..77e2624 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/oncologist-worklist/oncologist-worklist.component.ts @@ -0,0 +1,268 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { Component, DoCheck, OnInit, ViewChild } from '@angular/core'; +import { Router } from '@angular/router'; +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { DoctorService } from '../shared/services/doctor.service'; +import { CameraService } from '../../core/services/camera.service'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import * as moment from 'moment'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-oncologist-worklist', + templateUrl: './oncologist-worklist.component.html', + styleUrls: ['./oncologist-worklist.component.css'], +}) +export class OncologistWorklistComponent implements OnInit, DoCheck { + rowsPerPage = 5; + activePage = 1; + pagedList = []; + rotate = true; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + blankTable = [1, 2, 3, 4, 5]; + filterTerm: any; + currentLanguageSet: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'district', + 'phoneNo', + 'visitDate', + 'image', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private cameraService: CameraService, + private router: Router, + private confirmationService: ConfirmationService, + public httpServiceService: HttpServiceService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private doctorService: DoctorService, + ) {} + + ngOnInit() { + this.assignSelectedLanguage(); + localStorage.setItem('currentRole', 'Oncologist'); + this.removeBeneficiaryDataForVisit(); + this.loadWorklist(); + } + + removeBeneficiaryDataForVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + localStorage.removeItem('specialistFlag'); + } + + pageChanged(event: any): void { + console.log('called', event); + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + console.log('list', this.pagedList); + } + + loadWorklist() { + this.doctorService.getOncologistWorklist().subscribe( + (data: any) => { + if (data.statusCode === 200 && data.data !== null) { + console.log('worklist', data.data); + const benlist = this.loadDataToBenList(data.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else { + this.confirmationService.alert(data.errorMessage, 'error'); + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + } + }, + (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + }); + return data; + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'age' || + key === 'VisitCategory' || + key === 'benVisitNo' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' || + key === 'beneficiaryRegID' || + key === 'visitDate' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + }); + } + this.activePage = 1; + this.pageChanged({ + page: 1, + itemsPerPage: this.rowsPerPage, + }); + this.currentPage = 1; + } + + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + loadDoctorExaminationPage(beneficiary: any) { + localStorage.setItem('visitCode', beneficiary.visitCode); + if (beneficiary.visitFlowStatusFlag === 'N') { + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + localStorage.setItem('benFlowID', beneficiary.benFlowID); + localStorage.setItem('visitID', beneficiary.benVisitID); + localStorage.setItem('doctorFlag', beneficiary.doctorFlag); + localStorage.setItem('nurseFlag', beneficiary.nurseFlag); + localStorage.setItem( + 'pharmacist_flag', + beneficiary.pharmacist_flag, + ); + localStorage.setItem( + 'beneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); + localStorage.setItem('visitCategory', beneficiary.VisitCategory); + this.router.navigate([ + '/nurse-doctor/patient', + beneficiary.beneficiaryRegID, + ]); + } + }); + } else { + this.confirmationService + .confirm('info', this.currentLanguageSet.alerts.info.consulation) + .subscribe((res) => { + if (res) { + localStorage.setItem('caseSheetBenFlowID', beneficiary.benFlowID); + localStorage.setItem( + 'caseSheetVisitCategory', + beneficiary.VisitCategory, + ); + localStorage.setItem( + 'caseSheetBeneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('caseSheetVisitID', beneficiary.benVisitID); + this.router.navigate([ + '/nurse-doctor/print/' + 'TM' + '/' + 'current', + ]); + } + }); + } + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.css b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.css new file mode 100644 index 0000000..6a6626e --- /dev/null +++ b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.css @@ -0,0 +1,33 @@ +.input-full-width { + width: 100%; +} + +md2-pagination { + text-align: right; +} + +md-input-container { + width: 60%; +} + +md-card { + min-height: 400px; + padding: 15px; +} + +:host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + md-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +.norecord { + text-align: center; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.html b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.html new file mode 100644 index 0000000..5138f34 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.html @@ -0,0 +1,253 @@ +
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.casesheet?.serialNo }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element?.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element?.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} / + {{ element.benVisitNo }} + + {{ currentLanguageSet?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ currentLanguageSet?.bendetails?.phoneNo }} + + {{ element.preferredPhoneNum }} + + {{ currentLanguageSet?.bendetails?.visitDate }} + + {{ element.benVisitDate }} + + {{ currentLanguageSet?.bendetails?.image }} + + profile +
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+ + +
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.spec.ts new file mode 100644 index 0000000..3bd3129 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RadiologistWorklistComponent } from './radiologist-worklist.component'; + +describe('RadiologistWorklistComponent', () => { + let component: RadiologistWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [RadiologistWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RadiologistWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.ts b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.ts new file mode 100644 index 0000000..c4352f7 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/radiologist-worklist/radiologist-worklist.component.ts @@ -0,0 +1,273 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + DoCheck, + OnDestroy, + OnInit, + ViewChild, +} from '@angular/core'; +import { Router } from '@angular/router'; +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { DoctorService } from '../shared/services/doctor.service'; +import { CameraService } from '../../core/services/camera.service'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import * as moment from 'moment'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-radiologist-worklist', + templateUrl: './radiologist-worklist.component.html', + styleUrls: ['./radiologist-worklist.component.css'], +}) +export class RadiologistWorklistComponent + implements OnInit, DoCheck, OnDestroy +{ + rowsPerPage = 5; + activePage = 1; + pagedList = []; + rotate = true; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + blankTable = [1, 2, 3, 4, 5]; + filterTerm: any; + currentLanguageSet: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'district', + 'phoneNo', + 'visitDate', + 'image', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private cameraService: CameraService, + private router: Router, + private confirmationService: ConfirmationService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private doctorService: DoctorService, + public httpServiceService: HttpServiceService, + ) {} + + ngOnInit() { + this.assignSelectedLanguage(); + localStorage.setItem('currentRole', 'Radiologist'); + this.removeBeneficiaryDataForVisit(); + this.loadWorklist(); + } + + removeBeneficiaryDataForVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + localStorage.removeItem('specialistFlag'); + } + + ngOnDestroy() { + localStorage.removeItem('currentRole'); + } + + loadWorklist() { + this.doctorService.getRadiologistWorklist().subscribe( + (data: any) => { + if (data.statusCode === 200 && data.data !== null) { + console.log('radiologist worklist', data.data); + + const benlist = this.loadDataToBenList(data.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else { + this.confirmationService.alert(data.errorMessage, 'error'); + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + } + }, + (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + }); + return data; + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'age' || + key === 'VisitCategory' || + key === 'benVisitNo' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' || + key === 'beneficiaryRegID' || + key === 'visitDate' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + }); + } + } + pageChanged(event: any): void { + console.log('called', event); + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + console.log('list', this.pagedList); + } + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + loadDoctorExaminationPage(beneficiary: any) { + localStorage.setItem('benFlowID', beneficiary.benFlowID); + localStorage.setItem('visitCode', beneficiary.visitCode); + if (beneficiary.visitFlowStatusFlag === 'N') { + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + localStorage.setItem('visitID', beneficiary.benVisitID); + localStorage.setItem('doctorFlag', beneficiary.doctorFlag); + localStorage.setItem('nurseFlag', beneficiary.nurseFlag); + localStorage.setItem( + 'pharmacist_flag', + beneficiary.pharmacist_flag, + ); + localStorage.setItem( + 'beneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); + localStorage.setItem('visitCategory', beneficiary.VisitCategory); + this.router.navigate([ + '/nurse-doctor/patient', + beneficiary.beneficiaryRegID, + ]); + } + }); + } else { + this.confirmationService + .confirm('info', this.currentLanguageSet.alerts.info.consulation) + .subscribe((res) => { + if (res) { + localStorage.setItem('caseSheetBenFlowID', beneficiary.benFlowID); + localStorage.setItem( + 'caseSheetVisitCategory', + beneficiary.VisitCategory, + ); + localStorage.setItem( + 'caseSheetBeneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('caseSheetVisitID', beneficiary.benVisitID); + this.router.navigate([ + '/nurse-doctor/print/' + 'TM' + '/' + 'current', + ]); + } + }); + } + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/shared/services/audio-recording.service.ts b/src/app/app-modules/nurse-doctor/shared/services/audio-recording.service.ts index 50aba23..393e5dd 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/audio-recording.service.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/audio-recording.service.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" diff --git a/src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts b/src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts index 4149345..e0f06fd 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/doctor.service.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -22,17 +22,17 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { FormGroup, FormArray, FormControl } from '@angular/forms'; -import { BehaviorSubject, Observable, map } from 'rxjs'; +import { FormGroup, FormArray } from '@angular/forms'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { map, shareReplay } from 'rxjs/operators'; import { environment } from 'src/environments/environment'; @Injectable() export class DoctorService { fileIDs: any; // To store fileIDs - enableCovidVaccinationButton = false; - prescribedDrugData: any; + enableCovidVaccinationButton!: boolean; + enableButton: any = false; covidVaccineAgeGroup: any; - constructor(private http: HttpClient) {} getDoctorWorklist() { @@ -47,11 +47,83 @@ export class DoctorService { `/${localStorage.getItem('serviceID')}/${vanID}`; return this.http.get(environment.doctorWorkList + fetchUrl); } + postNCDscreeningCaseRecordDiagnosis(diagnosisForm: any, otherDetails: any) { + const diagnosisFormData = Object.assign( + {}, + diagnosisForm.value, + otherDetails, + ); + return diagnosisFormData; + } + postDoctorNCDScreeningDetails( + patientMedicalForm: any, + otherDetails: any, + tcRequest: any, + isSpecialist: any, + ) { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; + const findingForm = (( + patientMedicalForm.controls['patientCaseRecordForm'] + )).controls['generalFindingsForm']; + const investigationForm = (( + patientMedicalForm.controls['patientCaseRecordForm'] + )).controls['generalDoctorInvestigationForm']; + const prescriptionForm = (( + patientMedicalForm.controls['patientCaseRecordForm'] + )).controls['drugPrescriptionForm']; + const diagnosisForm = (( + patientMedicalForm.controls['patientCaseRecordForm'] + )).controls['generalDiagnosisForm']; + const referForm = patientMedicalForm.controls['patientReferForm']; + + const NCDScreeningDetails = { + findings: this.postGeneralCaseRecordFindings(findingForm, otherDetails), + diagnosis: this.postNCDscreeningCaseRecordDiagnosis( + diagnosisForm, + otherDetails, + ), + investigation: this.postGeneralCaseRecordInvestigation( + investigationForm, + otherDetails, + ), + prescription: this.postGeneralCaseRecordPrescription( + prescriptionForm, + otherDetails, + ), + refer: this.postGeneralRefer(referForm, otherDetails), + benFlowID: localStorage.getItem('benFlowID'), + beneficiaryID: localStorage.getItem('beneficiaryID'), + doctorFlag: localStorage.getItem('doctorFlag'), + nurseFlag: localStorage.getItem('nurseFlag'), + pharmacist_flag: localStorage.getItem('pharmacist_flag'), + sessionID: localStorage.getItem('sessionID'), + parkingPlaceID: parkingPlaceID, + vanID: vanID, + beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + visitCode: localStorage.getItem('visitCode'), + benVisitID: localStorage.getItem('visitID'), + serviceID: localStorage.getItem('serviceID'), + createdBy: localStorage.getItem('userName'), + tcRequest: tcRequest, + isSpecialist: isSpecialist, + }; + + console.log( + 'Doctor Covid CARE Visit Details', + JSON.stringify(NCDScreeningDetails, null, 4), + ); + return this.http.post( + environment.saveDoctorNCDScreeningDetails, + NCDScreeningDetails, + ); + } getServiceOnState() { return this.http.post(environment.getServiceOnStateUrl, {}); } - updateBeneficiaryArrivalStatus(arrivalStatusDetails: any) { return this.http.post( environment.updateBeneficiaryArrivalStatusUrl, @@ -74,11 +146,12 @@ export class DoctorService { } getDoctorFutureWorklist() { - return this.http.get( - environment.doctorFutureWorkList + - localStorage.getItem('providerServiceID') + - `/${localStorage.getItem('serviceID')}`, - ); + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const fetchUrl = + localStorage.getItem('providerServiceID') + + `/${localStorage.getItem('serviceID')}/${vanID}`; + return this.http.get(environment.doctorFutureWorkList + fetchUrl); } getSpecialistFutureWorklist() { @@ -147,7 +220,11 @@ export class DoctorService { ****************************CANCER SCREENING*********************************** */ - postDoctorCancerVisitDetails(cancerForm: any, tcRequest: any) { + postDoctorCancerVisitDetails( + cancerForm: any, + tcRequest: any, + isSpecialist: any, + ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; @@ -176,6 +253,7 @@ export class DoctorService { diagnosisDetails, referDetails, otherDetails, + { isSpecialist: isSpecialist }, ); const cancerRequest = Object.assign({ tcRequest: tcRequest, @@ -233,9 +311,6 @@ export class DoctorService { if (cancerExaminationForm.controls.signsForm.dirty) { const signsForm = cancerExaminationForm.controls.signsForm as FormGroup; - // let lymphsArray = (signsForm.controls.lymphNodes).controls.filter(item => { - // return item.dirty; - // }) const lymphsArray = (signsForm.controls['lymphNodes']) .controls; @@ -334,7 +409,6 @@ export class DoctorService { gynecologicalDetails, }); } - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; @@ -371,8 +445,6 @@ export class DoctorService { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; - const serviceID = localStorage.getItem('serviceID'); - const createdBy = localStorage.getItem('userName'); const updateDetails = { beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), benVisitID: localStorage.getItem('visitID'), @@ -427,7 +499,6 @@ export class DoctorService { for (let i = 0; i < diseases.length; i++) { diseases[i].cancerDiseaseType = diseases[i].cancerDiseaseType.cancerDiseaseType; - if (diseases[i].cancerDiseaseType === 'Any other Cancer') diseases[i].cancerDiseaseType = diseases[i].otherDiseaseType; @@ -473,7 +544,11 @@ export class DoctorService { **************************GENERAL OPD QUICK CONSULT************************** */ - postQuickConsultDetails(consultationData: any, tcRequest: any) { + postQuickConsultDetails( + consultationData: any, + tcRequest: any, + isSpecialist: any, + ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; @@ -493,6 +568,7 @@ export class DoctorService { parkingPlaceID: parkingPlaceID, vanID: vanID, tcRequest: tcRequest, + isSpecialist: isSpecialist, }; const quickConsultation = Object.assign( {}, @@ -504,7 +580,6 @@ export class DoctorService { return this.http.post(environment.saveDoctorGeneralQuickConsult, { quickConsultation, }); - // return Observable.of({statusCode: 5000, data:{ response: 'furrrr'} , errorMessage: 'furrrr'}); } updateQuickConsultDetails( @@ -545,7 +620,9 @@ export class DoctorService { ); return this.http.post( environment.updateGeneralOPDQuickConsultDoctorDetails, - { quickConsultation }, + { + quickConsultation, + }, ); } @@ -575,6 +652,7 @@ export class DoctorService { providerServiceMapID: localStorage.getItem('providerServiceID'), modifiedBy: localStorage.getItem('userName'), visitCode: localStorage.getItem('visitCode'), + serviceID: localStorage.getItem('serviceID'), }; const postNCDScreeningFormValue = JSON.parse( JSON.stringify(ncdScreeningFormValue), @@ -648,6 +726,7 @@ export class DoctorService { patientMedicalForm: any, otherDetails: any, tcRequest: any, + isSpecialist: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -694,14 +773,13 @@ export class DoctorService { serviceID: localStorage.getItem('serviceID'), createdBy: localStorage.getItem('userName'), tcRequest: tcRequest, + isSpecialist: isSpecialist, }; console.log( 'ANC Doctor Visit Details', JSON.stringify(ancVisitDetails, null, 4), ); - - // return Observable.of(null); return this.http.post(environment.saveDoctorANCDetails, ancVisitDetails); } @@ -772,6 +850,7 @@ export class DoctorService { patientMedicalForm: any, otherDetails: any, tcRequest: any, + isSpecialist: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -820,6 +899,7 @@ export class DoctorService { serviceID: localStorage.getItem('serviceID'), createdBy: localStorage.getItem('userName'), tcRequest: tcRequest, + isSpecialist: isSpecialist, }; console.log( @@ -845,6 +925,7 @@ export class DoctorService { patientMedicalForm: any, otherDetails: any, tcRequest: any, + isSpecialist: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -893,6 +974,7 @@ export class DoctorService { serviceID: localStorage.getItem('serviceID'), createdBy: localStorage.getItem('userName'), tcRequest: tcRequest, + isSpecialist: isSpecialist, }; console.log( @@ -905,79 +987,15 @@ export class DoctorService { ncdCareVisitDetails, ); } - /** **************************END OF NCD CARE************************** */ - postDoctorCovidCareDetails( - patientMedicalForm: any, - otherDetails: any, - tcRequest: any, - ) { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - const vanID = JSON.parse(serviceLineDetails).vanID; - const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; - const findingForm = (( - patientMedicalForm.controls['patientCaseRecordForm'] - )).controls['generalFindingsForm']; - const investigationForm = (( - patientMedicalForm.controls['patientCaseRecordForm'] - )).controls['generalDoctorInvestigationForm']; - const prescriptionForm = (( - patientMedicalForm.controls['patientCaseRecordForm'] - )).controls['drugPrescriptionForm']; - const diagnosisForm = (( - patientMedicalForm.controls['patientCaseRecordForm'] - )).controls['generalDiagnosisForm']; - const referForm = patientMedicalForm.controls['patientReferForm']; - - const covidCareVisitDetails = { - findings: this.postGeneralCaseRecordFindings(findingForm, otherDetails), - diagnosis: this.postCovidCareCaseRecordDiagnosis( - diagnosisForm, - otherDetails, - ), - investigation: this.postGeneralCaseRecordInvestigation( - investigationForm, - otherDetails, - ), - prescription: this.postGeneralCaseRecordPrescription( - prescriptionForm, - otherDetails, - ), - refer: this.postGeneralRefer(referForm, otherDetails), - benFlowID: localStorage.getItem('benFlowID'), - beneficiaryID: localStorage.getItem('beneficiaryID'), - doctorFlag: localStorage.getItem('doctorFlag'), - nurseFlag: localStorage.getItem('nurseFlag'), - pharmacist_flag: localStorage.getItem('pharmacist_flag'), - sessionID: localStorage.getItem('sessionID'), - parkingPlaceID: parkingPlaceID, - vanID: vanID, - beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), - providerServiceMapID: localStorage.getItem('providerServiceID'), - visitCode: localStorage.getItem('visitCode'), - benVisitID: localStorage.getItem('visitID'), - serviceID: localStorage.getItem('serviceID'), - createdBy: localStorage.getItem('userName'), - tcRequest: tcRequest, - }; - - console.log( - 'Doctor Covid CARE Visit Details', - JSON.stringify(covidCareVisitDetails, null, 4), - ); - - // return this.http.post( - // environment.saveDoctorCovidCareDetails, - // covidCareVisitDetails - // ); - } - postDoctorNCDScreeningDetails( + postDoctorCovidDetails( patientMedicalForm: any, otherDetails: any, tcRequest: any, + isSpecialist: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -996,12 +1014,9 @@ export class DoctorService { )).controls['generalDiagnosisForm']; const referForm = patientMedicalForm.controls['patientReferForm']; - const NCDScreeningDetails = { + const covidVisitDetails = { findings: this.postGeneralCaseRecordFindings(findingForm, otherDetails), - diagnosis: this.postNCDscreeningCaseRecordDiagnosis( - diagnosisForm, - otherDetails, - ), + diagnosis: this.postCovidCaseRecordDiagnosis(diagnosisForm, otherDetails), investigation: this.postGeneralCaseRecordInvestigation( investigationForm, otherDetails, @@ -1026,21 +1041,26 @@ export class DoctorService { serviceID: localStorage.getItem('serviceID'), createdBy: localStorage.getItem('userName'), tcRequest: tcRequest, + isSpecialist: isSpecialist, }; console.log( - 'Doctor Covid CARE Visit Details', - JSON.stringify(NCDScreeningDetails, null, 4), + 'Doctor Covid-19 Screening Visit Details', + JSON.stringify(covidVisitDetails, null, 4), ); return this.http.post( - environment.saveDoctorNCDScreeningDetails, - NCDScreeningDetails, + environment.saveDoctorCovidDetails, + covidVisitDetails, ); } /** - **************************END OF Covid CARE************************** + **************************END OF COVID************************** + */ + + /** + **************************END OF Covid************************** */ /** @@ -1097,42 +1117,15 @@ export class DoctorService { return this.http.post(environment.getPNCVisitDetailsUrl, otherDetails); } if (visitCategory === 'COVID-19 Screening') { - // return this.http.post( - // environment.getCovidCareVisitDetailsUrl, - // otherDetails - // ); + this.getVisitComplaint = this.http.post( + environment.getCovidVisitDetails, + otherDetails, + ); } } return this.getVisitComplaint; } - getPregVisitComplaint: any; - getPregVisitComplaintDetails( - beneficiaryID: string, - visitID: string, - visitCategory: string, - ) { - // let visitCategory = "NCD screening"; - const otherDetails = Object.assign({ - benRegID: beneficiaryID, - benVisitID: visitID, - visitCode: localStorage.getItem('visitCode'), - }); - - // if (!this.getPregVisitComplaint) { - - // if (visitCategory === 'NCD screening') { - this.getPregVisitComplaint = this.http.post( - environment.getNCDScreeningVisitDetails, - otherDetails, - ); - // - // } - - // } - return this.getPregVisitComplaint; - } - generalHistory: any; getGeneralHistoryDetails(benRegID: any, visitID: any) { const visitCategory = localStorage.getItem('visitCategory'); @@ -1160,18 +1153,18 @@ export class DoctorService { otherDetails, ); } + if (visitCategory === 'COVID-19 Screening') { + this.generalHistory = this.http.post( + environment.getCovidHistoryDetailsUrl, + otherDetails, + ); + } if (visitCategory === 'PNC') { this.generalHistory = this.http.post( environment.getPNCHistoryDetailsUrl, otherDetails, ); } - if (visitCategory === 'COVID-19 Screening') { - // this.generalHistory = this.http.post( - // environment.getCovidCareHistoryDetailsUrl, - // otherDetails - // ); - } if (visitCategory === 'NCD screening') { this.generalHistory = this.http.post( environment.getNCDScreeningHistoryDetails, @@ -1209,15 +1202,14 @@ export class DoctorService { otherDetails, ); } + + if (visitCategory === 'COVID-19 Screening') { + return this.http.post(environment.getCovidVitalDetailsUrl, otherDetails); + } + if (visitCategory === 'PNC') { return this.http.post(environment.getPNCVitalsDetailsUrl, otherDetails); } - if (visitCategory === 'COVID-19 Screening') { - // return this.http.post( - // environment.getCovidCareVitalDetailsUrl, - // otherDetails - // ); - } if (visitCategory === 'NCD screening') { return this.http.post( environment.getNCDSceeriningVitalDetails, @@ -1229,44 +1221,101 @@ export class DoctorService { observer.complete(); }); } - - getGeneralExamintionData( - beneficiaryID: string, - visitID: string, - ): Observable { + getRBSPreviousVitals(beneficiary: any): Observable { const visitCategory = localStorage.getItem('visitCategory'); - const otherDetails = Object.assign({ - benRegID: beneficiaryID, - benVisitID: visitID, - visitCode: localStorage.getItem('visitCode'), + if (visitCategory === 'NCD screening') { + return this.http.post( + environment.getNCDSceeriningVitalDetails, + beneficiary, + ); + } + // Return an observable that emits no value and completes + return new Observable((observer) => { + observer.complete(); }); + } + getGenericVitalsForMMULabReport(beneficiary: any): Observable { + const otherDetails = Object.assign({}, beneficiary, { + visitCode: localStorage.getItem('referredVisitCode'), + }); + const visitCategory = localStorage.getItem('visitCategory'); + if (visitCategory === 'General OPD (QC)') { + return this.http.post( + environment.getGeneralOPDQuickConsultVitalDetails, + otherDetails, + ); + } if (visitCategory === 'ANC') { - return this.http.post(environment.getANCExaminationDataUrl, otherDetails); + return this.http.post(environment.getANCVitalsDetailsUrl, otherDetails); } if (visitCategory === 'General OPD') { return this.http.post( - environment.getGeneralOPDExaminationDetailsUrl, + environment.getGeneralOPDVitalDetailsUrl, otherDetails, ); } - if (visitCategory === 'PNC') { - return this.http.post(environment.getPNCExaminationDataUrl, otherDetails); + + if (visitCategory === 'NCD care') { + return this.http.post( + environment.getNCDCareVitalDetailsUrl, + otherDetails, + ); } - return new Observable((observer) => { - observer.complete(); - }); - } - updateGeneralHistory( - generalHistoryForm: any, - temp: any, - beneficiaryAge: any, - ): Observable { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - const visitCategory = localStorage.getItem('visitCategory'); - const vanID = JSON.parse(serviceLineDetails).vanID; - const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; + if (visitCategory === 'COVID-19 Screening') { + return this.http.post(environment.getCovidVitalDetailsUrl, otherDetails); + } + + if (visitCategory === 'PNC') { + return this.http.post(environment.getPNCVitalsDetailsUrl, otherDetails); + } + if (visitCategory === 'NCD screening') { + return this.http.post( + environment.getNCDSceeriningVitalDetails, + otherDetails, + ); + } + // Return an observable that emits no value and completes + return new Observable((observer) => { + observer.complete(); + }); + } + + getGeneralExamintionData( + beneficiaryID: string, + visitID: string, + ): Observable { + const visitCategory = localStorage.getItem('visitCategory'); + const otherDetails = Object.assign({ + benRegID: beneficiaryID, + benVisitID: visitID, + visitCode: localStorage.getItem('visitCode'), + }); + + if (visitCategory === 'ANC') { + return this.http.post(environment.getANCExaminationDataUrl, otherDetails); + } + if (visitCategory === 'General OPD') { + return this.http.post( + environment.getGeneralOPDExaminationDetailsUrl, + otherDetails, + ); + } + if (visitCategory === 'PNC') { + return this.http.post(environment.getPNCExaminationDataUrl, otherDetails); + } + // Return an observable that emits no value and completes + return new Observable((observer) => { + observer.complete(); + }); + } + + updateGeneralHistory(generalHistoryForm: any, temp: any): Observable { + const visitCategory = localStorage.getItem('visitCategory'); + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; const updatedHistoryDetails = { pastHistory: this.updateGeneralPastHistory( generalHistoryForm.controls.pastHistory, @@ -1355,6 +1404,13 @@ export class DoctorService { ); } + if (visitCategory === 'COVID-19 Screening') { + return this.http.post( + environment.updateCovidHistoryDetailsUrl, + updatedHistoryDetails, + ); + } + if (visitCategory === 'PNC') { delete updatedHistoryDetails.feedingHistory; delete updatedHistoryDetails.developmentHistory; @@ -1365,14 +1421,7 @@ export class DoctorService { updatedHistoryDetails, ); } - - if (visitCategory === 'COVID-19 Screening') { - // return this.http.post( - // environment.updateCovidCareHistoryDetailsUrl, - // updatedHistoryDetails - // ); - } - + // Return an observable that emits no value and completes return new Observable((observer) => { observer.complete(); }); @@ -1479,9 +1528,12 @@ export class DoctorService { if (temp) { item.comorbidConditions = undefined; item.comorbidCondition = temp.comorbidCondition; - if (temp.comorbidConditionID) + if (temp.comorbidConditionID) { item.comorbidConditionID = '' + temp.comorbidConditionID; - // item.isForHistory = !item.isForHistory; + } + if (item.isForHistory !== true) { + item.isForHistory = !item.isForHistory; + } } }); const comorbidityData = Object.assign( @@ -1542,7 +1594,8 @@ export class DoctorService { temp, { riskySexualPracticesStatus: - personalHistoryFormValue.riskySexualPracticesStatus !== undefined + personalHistoryFormValue.riskySexualPracticesStatus !== undefined && + personalHistoryFormValue.riskySexualPracticesStatus !== null ? +personalHistoryFormValue.riskySexualPracticesStatus : null, tobaccoList: tobaccoList, @@ -1550,6 +1603,8 @@ export class DoctorService { allergicList: allergyList, }, ); + console.log('docrisky', personalHistoryFormValue); + console.log('docriskyyy', personalHistoryForm); return personalHistoryData; } @@ -1678,7 +1733,7 @@ export class DoctorService { updateGeneralVitals( patientVitalsForm: any, visitCategory: any, - ): Observable { + ): Observable { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; @@ -1697,6 +1752,7 @@ export class DoctorService { benVisitID: localStorage.getItem('visitID'), }, ); + console.log('Vitals Form', patientVitalData); if (visitCategory === 'ANC') { return this.http.post( environment.updateANCVitalsDetailsUrl, @@ -1716,66 +1772,36 @@ export class DoctorService { ); } + if (visitCategory === 'COVID-19 Screening') { + return this.http.post( + environment.updateCovidVitalsDetailsUrl, + patientVitalData, + ); + } + if (visitCategory === 'PNC') { return this.http.post( environment.updatePNCVitalsDetailsUrl, patientVitalData, ); } - if (visitCategory === 'COVID-19 Screening') { - // return this.http.post( - // environment.updateCovidCareVitalsDetailsUrl, - // patientVitalData - // ); - } if (visitCategory === 'NCD screening') { return this.http.post( environment.updateNCDVitalsDetailsUrl, patientVitalData, ); } - + // Return an observable that emits no value and completes return new Observable((observer) => { observer.complete(); }); } - updateIDRSDetails( - idrsScreeningForm: any, - visitCategory: any, - ): Observable { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - const vanID = JSON.parse(serviceLineDetails).vanID; - const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; - const patientIDRSData = Object.assign({}, idrsScreeningForm.value, { - providerServiceMapID: localStorage.getItem('providerServiceID'), - modifiedBy: localStorage.getItem('userName'), - sessionID: localStorage.getItem('sessionID'), - parkingPlaceID: parkingPlaceID, - vanID: vanID, - createdBy: localStorage.getItem('userName'), - beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), - visitCode: localStorage.getItem('visitCode'), - benVisitID: localStorage.getItem('visitID'), - deleted: false, - }); - - const idrsDetails = { idrsDetails: patientIDRSData }; - if (visitCategory === 'NCD screening') { - return this.http.post( - environment.updateNCDScreeningIDRSDetailsUrl, - idrsDetails, - ); - } - return new Observable((observer) => { - observer.complete(); - }); - } updatePatientExamination( patientExaminationForm: any, visitCategory: any, updateDetails: any, - ): Observable { + ): Observable { let updatedExaminationDetails; const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -1956,7 +1982,7 @@ export class DoctorService { updatedExaminationDetails, ); } - + // Return an observable that emits no value and completes return new Observable((observer) => { observer.complete(); }); @@ -2110,35 +2136,36 @@ export class DoctorService { return diagnosisFormData; } + postCovidCaseRecordDiagnosis(diagnosisForm: any, otherDetails: any) { + const diagnosisFormData = Object.assign( + {}, + diagnosisForm.value, + otherDetails, + ); + return diagnosisFormData; + } + postNCDCareCaseRecordDiagnosis(diagnosisForm: any, otherDetails: any) { const diagnosisFormData = JSON.parse(JSON.stringify(diagnosisForm.value)); + if (diagnosisFormData.ncdScreeningCondition) { + diagnosisFormData.ncdScreeningConditionID = + diagnosisFormData.ncdScreeningCondition.ncdScreeningConditionID; + diagnosisFormData.ncdScreeningCondition = + diagnosisFormData.ncdScreeningCondition.screeningCondition; + } + if (diagnosisFormData.ncdCareType) { diagnosisFormData.ncdCareTypeID = diagnosisFormData.ncdCareType.ncdCareTypeID; diagnosisFormData.ncdCareType = diagnosisFormData.ncdCareType.ncdCareType; } + console.log('NCD Doc', diagnosisForm.value); const diagnosisData = Object.assign({}, diagnosisFormData, otherDetails); return diagnosisData; } - postCovidCareCaseRecordDiagnosis(diagnosisForm: any, otherDetails: any) { - const diagnosisFormData = Object.assign( - {}, - diagnosisForm.value, - otherDetails, - ); - return diagnosisFormData; - } - postNCDscreeningCaseRecordDiagnosis(diagnosisForm: any, otherDetails: any) { - const diagnosisFormData = Object.assign( - {}, - diagnosisForm.value, - otherDetails, - ); - return diagnosisFormData; - } postGeneralCaseRecordInvestigation( investigationForm: any, otherDetails: any, @@ -2150,10 +2177,15 @@ export class DoctorService { if ( !!investigationFormValue.labTest && !!investigationFormValue.radiologyTest - ) - labTest = investigationFormValue.labTest.concat( - investigationFormValue.radiologyTest, - ); + ) { + if (investigationFormValue.radiologyTest === null) { + labTest = investigationFormValue.labTest; + } else { + labTest = investigationFormValue.labTest.concat( + investigationFormValue.radiologyTest, + ); + } + } const temp = labTest.filter((test: any) => { return !test.disabled; @@ -2184,6 +2216,7 @@ export class DoctorService { } postGeneralRefer(referForm: any, otherDetails: any) { + console.log('testt1279' + referForm); const referFormData = JSON.parse(JSON.stringify(referForm.value)); if (referFormData.referredToInstituteName) { referFormData.referredToInstituteID = @@ -2200,12 +2233,12 @@ export class DoctorService { ); referFormData.refrredToAdditionalServiceList = temp.slice(); } - if (referFormData.revisitDate) { - referFormData.revisitDate = referForm.controls['revisitDate'].value; - } if (referFormData.referralReason) { referFormData.referralReason = referForm.controls['referralReason'].value; } + if (referFormData.revisitDate) { + referFormData.revisitDate = referForm.controls['revisitDate'].value; + } const referData = Object.assign({}, referFormData, otherDetails); return referData; @@ -2229,16 +2262,20 @@ export class DoctorService { }); } + getHistoricalTrends() {} + clearCache() { this.generalHistory = null; this.getVisitComplaint = null; this.caseRecordAndReferDetails = null; + this.caseRecordAndReferDetails1 = null; } postDoctorPNCDetails( patientMedicalForm: any, otherDetails: any, tcRequest: any, + isSpecialist: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -2284,6 +2321,7 @@ export class DoctorService { serviceID: localStorage.getItem('serviceID'), createdBy: localStorage.getItem('userName'), tcRequest: tcRequest, + isSpecialist: isSpecialist, }; console.log( @@ -2302,6 +2340,14 @@ export class DoctorService { }); } + getCovidDetails(beneficiaryID: string, visitID: string) { + return this.http.post(environment.getPNCDetailsUrl, { + benRegID: beneficiaryID, + benVisitID: visitID, + visitCode: localStorage.getItem('visitCode'), + }); + } + updatePNCDetails(patientPNCForm: any, otherDetails: any) { const temp = JSON.parse(JSON.stringify(patientPNCForm.value)); if (temp.deliveryPlace) { @@ -2412,28 +2458,92 @@ export class DoctorService { otherDetails, ); } - if (visitCategory === 'PNC') { + if (visitCategory === 'COVID-19 Screening') { this.caseRecordAndReferDetails = this.http.post( - environment.getPNCDoctorDetails, + environment.getCovidDoctorDetails, otherDetails, ); } - if (visitCategory === 'COVID-19 Screening') { + if (visitCategory === 'PNC') { this.caseRecordAndReferDetails = this.http.post( - environment.getCovidDoctorDetails, + environment.getPNCDoctorDetails, otherDetails, ); } } return this.caseRecordAndReferDetails; } + caseRecordAndReferDetails1: any; + getMMUCaseRecordAndReferDetails( + beneficiaryRegID: any, + visitID: any, + visitCategory: any, + visitcode: any, + ) { + const otherDetails = Object.assign({ + benRegID: beneficiaryRegID, + benVisitID: visitID, + visitCode: visitcode, + }); + + if (visitCategory === 'Cancer Screening') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getCancerScreeningDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'General OPD (QC)') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getGeneralOPDQuickConsultDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'ANC') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getANCDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'General OPD') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getGeneralOPDDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'NCD screening') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getNCDScreeningDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'NCD care') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getNCDCareDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'COVID-19 Screening') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getCovidDoctorDetails, + otherDetails, + ); + } + if (visitCategory === 'PNC') { + this.caseRecordAndReferDetails1 = this.http.post( + environment.getPNCDoctorDetails, + otherDetails, + ); + } + + return this.caseRecordAndReferDetails1; + } updateDoctorDiagnosisDetails( patientMedicalForm: any, visitCategory: any, otherDetails: any, tcRequest: any, - ): Observable { + ): Observable { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; @@ -2450,7 +2560,7 @@ export class DoctorService { patientMedicalForm.controls['patientCaseRecordForm'] )).controls['generalDiagnosisForm']; const referForm = patientMedicalForm.controls['patientReferForm']; - + console.log('Revisit Value' + referForm.controls['revisitDate'].value); const updatedDoctorDiagnosis = { findings: this.postGeneralCaseRecordFindings(findingForm, otherDetails), diagnosis: this.postGeneralCaseRecordDiagnosis( @@ -2526,7 +2636,6 @@ export class DoctorService { updatedDoctorDiagnosis, ); } - // Return an observable that emits no value and completes return new Observable((observer) => { observer.complete(); @@ -2558,14 +2667,14 @@ export class DoctorService { otherDetails, ); } - if (visitCategory === 'PNC') { - diagnosisDetails = this.postANCCaseRecordDiagnosis( + if (visitCategory === 'COVID-19 Screening') { + diagnosisDetails = this.postCovidCaseRecordDiagnosis( diagnosisForm, otherDetails, ); } - if (visitCategory === 'COVID-19 Screening') { - diagnosisDetails = this.postCovidCareCaseRecordDiagnosis( + if (visitCategory === 'PNC') { + diagnosisDetails = this.postANCCaseRecordDiagnosis( diagnosisForm, otherDetails, ); @@ -2576,7 +2685,6 @@ export class DoctorService { otherDetails, ); } - return diagnosisDetails; } @@ -2595,6 +2703,9 @@ export class DoctorService { getArchivedReports(ArchivedReports: any) { return this.http.post(environment.archivedReportsUrl, ArchivedReports); } + getReportsBase64(obj: any) { + return this.http.post(environment.ReportsBase64Url, obj); + } getPatientMCTSCallHistory(callDetailID: any) { return this.http.post(environment.patientMCTSCallHistoryUrl, callDetailID); @@ -2630,9 +2741,7 @@ export class DoctorService { return this.http.get(environment.getSwymedMailUrl + `/${vanID}`); } - // getCancerScreeningDoctorDetails() { - // return this.http.post(environment.getCancerScreeningDoctorDetailsUrl, {}) - // } + saveSpecialistCancerObservation( specialistDiagonosis: any, otherDetails: any, @@ -2657,10 +2766,84 @@ export class DoctorService { diagnosis, }); } + + updateTCStartTime(tCStartTimeObj: any) { + return this.http.post(environment.updateTCStartTimeUrl, tCStartTimeObj); + } + + invokeSwymedCall(specialistID: any) { + const userID = localStorage.getItem('userID'); + return this.http.get( + environment.invokeSwymedCallUrl + userID + '/' + specialistID, + ); + } + + invokeSwymedCallSpecialist() { + const userID = localStorage.getItem('userID'); + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + return this.http.get( + environment.invokeSwymedCallSpecialistUrl + userID + '/' + vanID, + ); + } + /* Doctor Signature download */ + downloadSign(userID: any) { + return this.http + .get(environment.downloadSignUrl + userID, { responseType: 'blob' }) + .pipe(map((res: any) => res.blob())); + } + getIDRSDetails(beneficiaryID: string, visitID: string): Observable { + const visitCategory = localStorage.getItem('visitCategory'); + const otherDetails = Object.assign({ + benRegID: beneficiaryID, + benVisitID: visitID, + visitCode: localStorage.getItem('visitCode'), + }); + + if (visitCategory === 'NCD screening') { + return this.http.post( + environment.getNCDScreeningIDRSDetails, + otherDetails, + ); + } + return new Observable((observer) => { + observer.complete(); + }); + } + updateIDRSDetails( + idrsScreeningForm: any, + visitCategory: any, + ): Observable { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; + const patientIDRSData = Object.assign({}, idrsScreeningForm.value, { + providerServiceMapID: localStorage.getItem('providerServiceID'), + modifiedBy: localStorage.getItem('userName'), + sessionID: localStorage.getItem('sessionID'), + parkingPlaceID: parkingPlaceID, + vanID: vanID, + createdBy: localStorage.getItem('userName'), + beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), + visitCode: localStorage.getItem('visitCode'), + benVisitID: localStorage.getItem('visitID'), + deleted: false, + }); + + const idrsDetails = { idrsDetails: patientIDRSData }; + if (visitCategory === 'NCD screening') { + return this.http.post( + environment.updateNCDScreeningIDRSDetailsUrl, + idrsDetails, + ); + } + return new Observable((observer) => { + observer.complete(); + }); + } updateNCDScreeningHistory( NCDScreeningHistoryForm: any, temp: any, - beneficiaryAge: any, ): Observable { const visitCategory = localStorage.getItem('visitCategory'); const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); @@ -2699,6 +2882,7 @@ export class DoctorService { updatedHistoryDetails, ); } + // Return an observable that emits no value and completes return new Observable((observer) => { observer.complete(); }); @@ -2714,107 +2898,10 @@ export class DoctorService { ); return physicalActivityHistoryForm; } - - getIDRSDetails(beneficiaryID: string, visitID: string): Observable { - const visitCategory = localStorage.getItem('visitCategory'); - const otherDetails = Object.assign({ - benRegID: beneficiaryID, - benVisitID: visitID, - visitCode: localStorage.getItem('visitCode'), - }); - if (visitCategory === 'NCD screening') { - return this.http.post( - environment.getNCDScreeningIDRSDetails, - otherDetails, - ); - } - - return new Observable((observer) => { - observer.complete(); - }); - } - - postTMReferedNurseDetails( - patientMedicalForm: any, - otherDetails: any, - tcRequest: any, - ) { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - const vanID = JSON.parse(serviceLineDetails).vanID; - const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; - const referForm = (( - patientMedicalForm.controls['patientVisitForm'] - )).controls['tmcConfirmationForm']; - const isTMCDone = referForm.value.tmcConfirmed; - const benData: any = localStorage.getItem('beneficiaryData'); - const beneficiaryData = JSON.parse(benData); - const generalVisitDetails = { - prescription: this.prescribedDrugData ? this.prescribedDrugData : null, - refer: this.postTMVisitDatilsRefer( - referForm, - otherDetails, - beneficiaryData, - ), - benFlowID: localStorage.getItem('benFlowID'), - beneficiaryID: localStorage.getItem('beneficiaryID'), - doctorFlag: String(beneficiaryData.doctorFlag), - nurseFlag: String(beneficiaryData.nurseFlag), - pharmacist_flag: - beneficiaryData.pharmacist_flag === 'Not Available' ? 0 : 1, - isSpecialist: false, - sessionID: localStorage.getItem('sessionID'), - parkingPlaceID: parkingPlaceID, - vanID: vanID, - beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), - providerServiceMapID: localStorage.getItem('providerServiceID'), - visitCode: localStorage.getItem('visitCode'), - benVisitID: String(beneficiaryData.benVisitID), - serviceID: localStorage.getItem('serviceID'), - createdBy: localStorage.getItem('userName'), - isTMCDone: isTMCDone, - }; - console.log( - 'TM Nurse Details', - JSON.stringify(generalVisitDetails, null, 4), - ); - - return this.http.post( - environment.postNCDScreeningDetails, - generalVisitDetails, - ); - // return Observable.of({errorMessage: 'furrrr'}); + getMMUData(loadMMUData: any) { + return this.http.post(environment.loadMMUDataUrl, loadMMUData); } - postTMVisitDatilsRefer( - referForm: any, - otherDetails: any, - beneficiaryData: any, - ) { - const referFormData = JSON.parse(JSON.stringify(referForm.value)); - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - let temp = {}; - if (referFormData.refrredToAdditionalServiceList) { - temp = { - referredToInstituteID: - referFormData.refrredToAdditionalServiceList.institutionID, - referredToInstituteName: - referFormData.refrredToAdditionalServiceList.institutionName, - refrredToAdditionalServiceList: null, - revisitDate: null, - referralReason: null, - vanID: beneficiaryData.vanID, - parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, - sessionID: localStorage.getItem('sessionID'), - beneficiaryID: String(beneficiaryData.beneficiaryID), - serviceID: localStorage.getItem('serviceID'), - benFlowID: String(beneficiaryData.benFlowID), - isSpecialist: false, - }; - } - otherDetails.benVisitID = String(beneficiaryData.benVisitID); - const referData = Object.assign({}, temp, otherDetails); - return referData; - } HRPDetails: any; getHRPDetails(beneficiaryRegID: any, visitCode: any) { const reqObj = Object.assign({ @@ -2823,31 +2910,16 @@ export class DoctorService { }); this.HRPDetails = this.http.post(environment.loadHRPUrl, reqObj); - return this.HRPDetails; - } - /* Doctor Signature download */ - downloadSign(userID: any) { - return this.http - .get(environment.downloadSignUrl + userID, { responseType: 'blob' }) - .pipe(map((res: any) => res.blob())); + return this.HRPDetails; } - enableButton: any = false; enableVitalsUpdateButton = new BehaviorSubject(this.enableButton); enableVitalsUpdateButton$ = this.enableVitalsUpdateButton.asObservable(); setValueToEnableVitalsUpdateButton(value: any) { this.enableVitalsUpdateButton.next(value); } - getAssessment(benRegID: any) { - return this.http.get(environment.getAssessmentIdUrl + '/' + benRegID); - } - - getAssessmentDet(assessmentId: any) { - return this.http.get(environment.getAssessmentUrl + '/' + assessmentId); - } - historyResponse: any = []; populateHistoryResponse = new BehaviorSubject(this.historyResponse); populateHistoryResponse$ = this.populateHistoryResponse.asObservable(); @@ -2855,4 +2927,12 @@ export class DoctorService { setCapturedHistoryByNurse(historyResponse: any) { this.populateHistoryResponse.next(historyResponse); } + + getAssessment(benRegID: any) { + return this.http.get(environment.getAssessmentIdUrl + '/' + benRegID); + } + + getAssessmentDet(assessmentId: any) { + return this.http.get(environment.getAssessmentUrl + '/' + assessmentId); + } } diff --git a/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.spec.ts b/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.spec.ts index f45ddf7..9c319d8 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.spec.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.spec.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" diff --git a/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.ts b/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.ts index d6fba63..5894c0f 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/idrsscore.service.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -27,6 +27,14 @@ import { BehaviorSubject, Observable, Subject } from 'rxjs'; @Injectable() export class IdrsscoreService { private _listners = new Subject(); + enableDiagnosis: any = null; + diseaseConfirmation: any = null; + hyperConfirm: any = null; + finalHypertension: any = false; + diabetesPresentInList!: number; + visualAcuityTestInMMU = 1; + diabetesNotPresentInMMU = 0; + rbsResult: any = null; listen(): Observable { return this._listners.asObservable(); @@ -36,15 +44,11 @@ export class IdrsscoreService { this._listners.next(filterBy); } - dummuy: any = false; - dummyValue = new BehaviorSubject(this.dummuy); - dummyValue$ = this.dummyValue.asObservable(); - IRDSscore: any = null; IDRSFamilyScore = new BehaviorSubject(this.IRDSscore); IDRSFamilyScore$ = this.IDRSFamilyScore.asObservable(); - confirmedValue: any = true; + confirmedValue: any = null; confirmed = new BehaviorSubject(this.confirmedValue); confirmed$ = this.confirmed.asObservable(); @@ -70,12 +74,12 @@ export class IdrsscoreService { IDRSSuspectedFlag = new BehaviorSubject(this.IDRSSuspected); IDRSSuspectedFlag$ = this.IDRSSuspectedFlag.asObservable(); - diabetesSelected: any = false; + diabetesSelected: any = null; diabetesSelectedFlag = new BehaviorSubject(this.diabetesSelected); diabetesSelectedFlag$ = this.diabetesSelectedFlag.asObservable(); - VisualAcuityTestMandatory: any = false; + VisualAcuityTestMandatory: any = null; VisualAcuityTestMandatoryFlag = new BehaviorSubject( this.VisualAcuityTestMandatory, @@ -93,7 +97,7 @@ export class IdrsscoreService { diastolicBpValue = new BehaviorSubject(this.diastolicBp); diastolicBpValue$ = this.diastolicBpValue.asObservable(); - rBSPresent: any = false; + rBSPresent: any = null; rBSPresentFlag = new BehaviorSubject(this.rBSPresent); rBSPresentFlag$ = this.rBSPresentFlag.asObservable(); @@ -108,11 +112,6 @@ export class IdrsscoreService { heamoglobinPresentFlag = new BehaviorSubject(this.heamoglobinPresent); heamoglobinPresentFlag$ = this.heamoglobinPresentFlag.asObservable(); - tmcSuggested: any = null; - - tmcSuggestedFlag = new BehaviorSubject(this.tmcSuggested); - tmcSuggestedFlag$ = this.tmcSuggestedFlag.asObservable(); - referralSuggested: any = null; referralSuggestedFlag = new BehaviorSubject(this.referralSuggested); @@ -133,17 +132,24 @@ export class IdrsscoreService { visitDiseases = new BehaviorSubject(null); visitDiseases$ = this.visitDiseases.asObservable(); + uncheckedDiseases = new BehaviorSubject(null); uncheckedDiseases$ = this.uncheckedDiseases.asObservable(); - tmc = true; - tmcSubmitDisable = new BehaviorSubject(this.tmc); - tmcSubmitDisable$ = this.tmcSubmitDisable.asObservable(); - constructor(private http: HttpClient) {} - setdymmyvalue(disease: any) { - this.dummyValue.next(disease); - console.log('testing'); - } + finalDiagnosisDiseaseconfirm = new BehaviorSubject(this.diseaseConfirmation); + finalDiagnosisDiseaseconfirm$ = + this.finalDiagnosisDiseaseconfirm.asObservable(); + + finalDiagnosisHypertensionConfirmation = new BehaviorSubject( + this.hyperConfirm, + ); + finalDiagnosisHypertensionConfirmation$ = + this.finalDiagnosisHypertensionConfirmation.asObservable(); + + rbsResultsFromVitals = new BehaviorSubject(this.rbsResult); + rbsResultsFromVitals$ = this.rbsResultsFromVitals.asObservable(); + + constructor(private http: HttpClient) {} setIDRSFamilyScore(score: any) { this.IRDSscore = score; @@ -160,11 +166,8 @@ export class IdrsscoreService { clearMessage() { this.IDRSFamilyScore.next(0); - // this.IDRSScoreFlagCheck.next(0); this.IDRSWaistScore.next(0); this.IDRSPhysicalActivityScore.next(0); - // this.IRDSscorePhysicalActivity.next(""); - // this.IDRSWaistScore.next(""); } setIDRSScoreWaist(score: any) { @@ -222,15 +225,11 @@ export class IdrsscoreService { this.systolicBp = value; this.systolicBpValue.next(value); } - // setSystolicBpForFlag(value) { - // this.systolicBpFlag = value; - // this.systolicBpValueForFlag.next(value); - // } clearSystolicBp() { this.systolicBp = 0; this.systolicBpValue.next(0); } - + //change in diastolic bp setDiastolicBp(value: any) { this.diastolicBp = value; this.diastolicBpValue.next(value); @@ -254,15 +253,6 @@ export class IdrsscoreService { this.heamoglobinPresent = 1; this.heamoglobinPresentFlag.next(1); } - //TMC suggested - setTMCSuggested() { - this.tmcSuggested = 1; - this.tmcSuggestedFlag.next(1); - } - clearTMCSuggested() { - this.tmcSuggested = 1; - this.tmcSuggestedFlag.next(0); - } //Referral Reason suggestion setReferralSuggested() { this.referralSuggested = 1; @@ -280,16 +270,23 @@ export class IdrsscoreService { clearDiseaseSelected() { this.visitDiseases.next(null); } - setUnchecked(disease: any) { - this.uncheckedDiseases.next(disease); - } clearUnchecked() { this.uncheckedDiseases.next(null); } - setTMCSubmit(disease: any) { - this.tmcSubmitDisable.next(disease); + setUnchecked(disease: any) { + this.uncheckedDiseases.next(disease); } + enableDiseaseConfirmationOnCaseRecord = new BehaviorSubject( + this.enableDiagnosis, + ); + enableDiseaseConfirmationOnCaseRecord$ = + this.enableDiseaseConfirmationOnCaseRecord.asObservable(); + + enableDiseaseConfirmation(arg0: boolean) { + this.enableDiagnosis = arg0; + this.enableDiseaseConfirmationOnCaseRecord.next(arg0); + } setHypertensionSelected() { this.hypertensionSelected = 1; this.hypertensionSelectedFlag.next(1); @@ -299,7 +296,13 @@ export class IdrsscoreService { this.hypertensionSelectedFlag.next(0); } - isHypertensionConfirmed = false; + finalDiagnosisDiabetesConfirm(diabetesConfirmation: any) { + this.finalDiagnosisDiseaseconfirm.next(diabetesConfirmation); + } + finalDiagnosisHypertensionConfirm(hyperConfirmation: any) { + this.finalHypertension = hyperConfirmation; + this.finalDiagnosisHypertensionConfirmation.next(hyperConfirmation); + } setConfirmedDiabeticSelected() { this.confirmedDiabeticSelected = 1; @@ -309,6 +312,7 @@ export class IdrsscoreService { this.confirmedDiabeticSelected = 0; this.confirmedDiabeticSelectedFlag.next(0); } - - isDiabeticsConfirmed = false; + rbsTestResultsInVitals(rbsTestResult: any) { + this.rbsResultsFromVitals.next(rbsTestResult); + } } diff --git a/src/app/app-modules/nurse-doctor/shared/services/index.ts b/src/app/app-modules/nurse-doctor/shared/services/index.ts index fe6206d..032e0c9 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/index.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/index.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" 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 eb1d32e..5010425 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 @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -46,8 +46,9 @@ export class MasterdataService { nurseMasterDataUrl = environment.nurseMasterDataUrl; doctorMasterDataUrl = environment.doctorMasterDataUrl; snoMedDataURL = environment.snomedCTRecordURL; - // diagnosisSnomedCTRecordUrl = environment.diagnosisSnomedCTRecordUrl; - // diagnosisSnomedCTRecordUrl1 = environment.diagnosisSnomedCTRecordUrl1; + diagnosisSnomedCTRecordUrl = environment.snomedCTRecordListURL; + diagnosisSnomedCTRecordUrl1 = environment.snomedCTRecordListURL1; + getCalibrationStrips = environment.getCalibrationStrips; vaccinationTypeAndDoseMasterUrl = environment.vaccinationTypeAndDoseMasterUrl; previousCovidVaccinationUrl = environment.previousCovidVaccinationUrl; @@ -69,8 +70,6 @@ export class MasterdataService { doctorMasterDataSource = new BehaviorSubject(null); doctorMasterData$ = this.doctorMasterDataSource.asObservable(); - getCalibrationStrips = environment.getCalibrationStrips; - constructor(private http: HttpClient) {} /** @@ -89,21 +88,18 @@ export class MasterdataService { */ getNurseMasterData(visitID: string, providerServiceID: any) { const gender = localStorage.getItem('beneficiaryGender'); - return ( - this.http - .get( - this.nurseMasterDataUrl + - visitID + - '/' + - providerServiceID + - '/' + - gender, - ) - // return this.http.get(this.nurseMasterDataUrl+visitID) - .subscribe((res: any) => { - this.nurseMasterDataSource.next(res.data); - }) - ); + return this.http + .get( + this.nurseMasterDataUrl + + visitID + + '/' + + providerServiceID + + '/' + + gender, + ) + .subscribe((res: any) => { + this.nurseMasterDataSource.next(res.data); + }); } /** @@ -142,79 +138,42 @@ export class MasterdataService { vanID, ) .subscribe((res: any) => { - console.log('res.data', res.data); + console.log('res.json().data', res.data); this.doctorMasterDataSource.next(res.data); }); } - getDoctorMasterDataForNurse(visitID: string, providerServiceID: any) { - let facilityID = 0; - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - if ( - JSON.parse(serviceLineDetails).facilityID !== undefined && - JSON.parse(serviceLineDetails).facilityID !== null - ) { - facilityID = JSON.parse(serviceLineDetails).facilityID; - } - let vanID = 0; - if ( - JSON.parse(serviceLineDetails).vanID !== undefined && - JSON.parse(serviceLineDetails).vanID !== null - ) { - vanID = JSON.parse(serviceLineDetails).vanID; - } - const gender = localStorage.getItem('beneficiaryGender'); - console.log('facility', facilityID); - - return this.http.get( - this.doctorMasterDataUrl + - visitID + - '/' + - providerServiceID + - '/' + - gender + - '/' + - facilityID + - '/' + - vanID, - ); - } - getSnomedCTRecord(term: any) { return this.http.post(this.snoMedDataURL, { term: term }); } - // getVanMaster() { - // const providerServiceID = localStorage.getItem('providerServiceID'); - // return this.http.get(environment.getVanMasterUrl + providerServiceID); - // } - - // getReportData(reportRequst: any) { - // return this.http.post(environment.getReportDataUrl, reportRequst); - // } - - // searchDiagnosisBasedOnPageNo(searchTerm: any, pageNo: any) { - // const body = { - // term: searchTerm, - // pageNo: pageNo, - // }; - // return this.http.post(this.diagnosisSnomedCTRecordUrl, body); - // } - reset() { this.visitDetailMasterDataSource.next(null); this.nurseMasterDataSource.next(null); this.doctorMasterDataSource.next(null); } - // searchDiagnosisBasedOnPageNo1(searchTerm: any, pageNo: any) { - // const body = { - // term: searchTerm, - // pageNo: pageNo, - // }; - // return this.http.post(this.diagnosisSnomedCTRecordUrl1, body); - // } + getJSON(_jsonURL: any) { + return this.http.get(_jsonURL); + } + + searchDiagnosisBasedOnPageNo(searchTerm: any, pageNo: any) { + const body = { + term: searchTerm, + pageNo: pageNo, + }; + return this.http.post(this.diagnosisSnomedCTRecordUrl, body); + } + + searchDiagnosisBasedOnPageNo1(searchTerm: any, pageNo: any) { + const body = { + term: searchTerm, + pageNo: pageNo, + }; + return this.http.post(this.diagnosisSnomedCTRecordUrl1, body); + } + fetchCalibrationStrips(providerServiceID: any, pageNo: any) { const body = { providerServiceMapID: providerServiceID, diff --git a/src/app/app-modules/nurse-doctor/shared/services/nurse.service.ts b/src/app/app-modules/nurse-doctor/shared/services/nurse.service.ts index 2f5b702..0e984ce 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/nurse.service.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/nurse.service.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -24,7 +24,7 @@ import { Injectable } from '@angular/core'; import { FormGroup, FormArray } from '@angular/forms'; import { SpinnerService } from '../../../core/services/spinner.service'; import { shareReplay } from 'rxjs/operators'; -import { BehaviorSubject, Observable, Subject, of } from 'rxjs'; +import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { environment } from 'src/environments/environment'; @@ -34,6 +34,7 @@ export class NurseService { private _listners = new Subject(); ncdTemp = new BehaviorSubject(this.temp); ncdTemp$ = this.ncdTemp.asObservable(); + rbsSelectedInvestigation = false; rbsSelectedInInvestigation = new BehaviorSubject( this.rbsSelectedInvestigation, @@ -43,9 +44,14 @@ export class NurseService { rbsCurrentTestResult: any = null; rbsTestResultCurrent = new BehaviorSubject(this.rbsCurrentTestResult); rbsTestResultCurrent$ = this.rbsTestResultCurrent.asObservable(); + + ismmutc = new BehaviorSubject('no'); + ismmutc$ = this.ismmutc.asObservable(); + mmuVisitData = false; isAssessmentDone = false; enableLAssessment = new BehaviorSubject(this.temp); enableLAssessment$ = this.enableLAssessment.asObservable(); + enableProvisionalDiag = new BehaviorSubject(this.temp); enableProvisionalDiag$ = this.enableProvisionalDiag.asObservable(); @@ -56,9 +62,16 @@ export class NurseService { filter(filterBy: string) { this._listners.next(filterBy); } - + contactfilter(filterBy: string) { + this._listners.next(filterBy); + } fileData: any; // To store fileIDs + lmpFetosenseTest: any = null; + + lmpFetosenseTestValue = new BehaviorSubject(this.lmpFetosenseTest); + lmpFetosenseTestValue$ = this.lmpFetosenseTestValue.asObservable(); + constructor( private http: HttpClient, private spinnerService: SpinnerService, @@ -76,30 +89,36 @@ export class NurseService { `/${localStorage.getItem('serviceID')}/${vanID}`; return this.http.get(environment.nurseWorklist + fetchUrl); } - getPreviousDiabetesHistory(benRegID: string, visitCategory: any) { - return this.http.post(environment.previousDiabetesHistoryUrl, { - benRegID: benRegID, - }); + + getNurseTMFutureWorklist() { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const fetchUrl = + localStorage.getItem('providerServiceID') + + `/${localStorage.getItem('serviceID')}/${vanID}`; + return this.http.get(environment.getNurseTMFutureWorklistUrl + fetchUrl); } - getPreviousVisitData(obj: any) { - return this.http.post(environment.previousVisitDataUrl, obj); + getNurseTMWorklist() { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const fetchUrl = + localStorage.getItem('providerServiceID') + + `/${localStorage.getItem('serviceID')}/${vanID}`; + return this.http.get(environment.getNurseTMWorklistUrl + fetchUrl); } - getNurseWorklistTMreferred() { - console.log( - 'getNurseWorklistUrl', - localStorage.getItem('providerServiceID'), - ); + getMMUNurseWorklist() { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const fetchUrl = localStorage.getItem('providerServiceID') + `/${localStorage.getItem('serviceID')}/${vanID}`; - // return this.http.get(environment.nurseWorklistTMreferred + fetchUrl); + return this.http.get(environment.mmuNurseWorklist + fetchUrl); } postNurseCancerVisitForm( medicalForm: any, imageCoordinates: any, sendToDoctorWorklist: any, + tcRequest: any, ) { const temp = { beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), @@ -155,7 +174,6 @@ export class NurseService { } const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; const serviceID = localStorage.getItem('serviceID'); @@ -172,6 +190,9 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }, ); @@ -184,6 +205,7 @@ export class NurseService { environment.saveNurseCancerScreeningDetails, cancerVisitDetails, ); + // return Observable.of({}); } @@ -359,7 +381,9 @@ export class NurseService { // console.log("Nurse examination Details", JSON.stringify(examinationDetails, null, 4)); return examinationDetails; } - + getPreviousVisitData(obj: any) { + return this.http.post(environment.previousVisitDataUrl, obj); + } getPreviousCancerFamilyHistory(benRegID: string) { return this.http.post(environment.previousCancerFamilyHistoryUrl, { benRegID: benRegID, @@ -384,7 +408,7 @@ export class NurseService { }); } - postNurseGeneralQCVisitForm(medicalForm: any) { + postNurseGeneralQCVisitForm(medicalForm: any, tcRequest: any) { const temp = { beneficiaryRegID: '' + localStorage.getItem('beneficiaryRegID'), providerServiceMapID: localStorage.getItem('providerServiceID'), @@ -420,6 +444,9 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }, ); @@ -439,6 +466,7 @@ export class NurseService { benVisitID: any, visitCategory: any, benAge: any, + tcRequest: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -476,6 +504,9 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }; console.log( @@ -499,7 +530,7 @@ export class NurseService { visitCategory: any, ): Observable { if (visitCategory === 'ANC') { - const visitDeatilsData: any = { + const visitDetailsData: any = { visitDetails: this.postPatientVisitDetails( patientVisitForm.controls.patientVisitDetailsForm.value, patientVisitForm.controls.patientFileUploadDetailsForm.value, @@ -517,10 +548,10 @@ export class NurseService { benVisitID, ), }; - return visitDeatilsData; + return visitDetailsData; } if (visitCategory === 'General OPD') { - const visitDeatilsData: any = { + const visitDetailsData: any = { visitDetails: this.postPatientVisitDetails( patientVisitForm.controls.patientVisitDetailsForm.value, patientVisitForm.controls.patientFileUploadDetailsForm.value, @@ -530,10 +561,10 @@ export class NurseService { benVisitID, ), }; - return visitDeatilsData; + return visitDetailsData; } if (visitCategory === 'PNC') { - const visitDeatilsData: any = { + const visitDetailsData: any = { visitDetails: this.postPatientVisitDetails( patientVisitForm.controls.patientVisitDetailsForm.value, patientVisitForm.controls.patientFileUploadDetailsForm.value, @@ -543,10 +574,10 @@ export class NurseService { benVisitID, ), }; - return visitDeatilsData; + return visitDetailsData; } if (visitCategory === 'NCD care') { - const visitDeatilsData: any = { + const visitDetailsData: any = { visitDetails: this.postPatientVisitDetails( patientVisitForm.controls.patientVisitDetailsForm.value, patientVisitForm.controls.patientFileUploadDetailsForm.value, @@ -560,10 +591,10 @@ export class NurseService { benVisitID, ), }; - return visitDeatilsData; + return visitDetailsData; } if (visitCategory === 'COVID-19 Screening') { - const visitDeatilsData: any = { + const visitDetailsData: any = { visitDetails: this.postPatientVisitDetails( patientVisitForm.controls.patientVisitDetailsForm.value, patientVisitForm.controls.patientFileUploadDetailsForm.value, @@ -573,10 +604,10 @@ export class NurseService { benVisitID, ), }; - return visitDeatilsData; + return visitDetailsData; } if (visitCategory === 'NCD screening') { - const visitDeatilsData: any = { + const visitDetailsData: any = { visitDetails: this.postPatientVisitDetails( patientVisitForm.controls.patientVisitDetailsForm.value, patientVisitForm.controls.patientFileUploadDetailsForm.value, @@ -586,7 +617,7 @@ export class NurseService { benVisitID, ), }; - return visitDeatilsData; + return visitDetailsData; } return new Observable((observer) => { observer.complete(); @@ -599,7 +630,7 @@ export class NurseService { providerServiceMapID: localStorage.getItem('providerServiceID'), createdBy: localStorage.getItem('userName'), }); - console.log('visit details', JSON.stringify(patientVisitDetails, null, 4)); + // console.log('visit details', JSON.stringify(patientVisitDetails, null, 4)); return patientVisitDetails; } @@ -1423,10 +1454,11 @@ export class NurseService { personalHistoryFormValue, otherDetails, { - riskySexualPracticesStatus: personalHistoryForm.value - .riskySexualPracticesStatus - ? +personalHistoryForm.value.riskySexualPracticesStatus - : null, + riskySexualPracticesStatus: + personalHistoryForm.value.riskySexualPracticesStatus !== undefined && + personalHistoryForm.value.riskySexualPracticesStatus !== null + ? +personalHistoryForm.value.riskySexualPracticesStatus + : null, tobaccoList: tobaccoList, alcoholList: alcoholList, allergicList: allergyList, @@ -1519,13 +1551,28 @@ export class NurseService { benRegID: benRegID, }); } - getPreviousPhysicalActivityHistory(benRegID: string, visitCategory: any) { return this.http.post(environment.previousPhyscialactivityHistoryUrl, { benRegID: benRegID, }); } - postNCDScreeningForm(medicalForm: any, visitCategory: any) { + getPreviousDiabetesHistory(benRegID: string, visitCategory: any) { + return this.http.post(environment.previousDiabetesHistoryUrl, { + benRegID: benRegID, + }); + } + getPreviousReferredHistory(benRegID: string, visitCategory: any) { + return this.http.post(environment.previousReferredHistoryUrl, { + benRegID: benRegID, + }); + } + + postNCDScreeningForm( + medicalForm: any, + visitCategory: any, + beneficiary: any, + tcRequest: any, + ) { const serviceDetails = { beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), benVisitID: null, @@ -1574,41 +1621,15 @@ export class NurseService { // postNCDScreeningFormValue.isBPPrescribed = bP; // } - const laboratoryList = [ - { - procedureID: 31, - procedureName: 'BP Measurement', - }, - { - procedureID: 31, - procedureName: 'Blood Glucose Measurement', - }, - ]; - - // postNCDScreeningFormValue.labTestOrders = postNCDScreeningFormValue.screeningTestList; - // postNCDScreeningFormValue.screeningTestList = undefined; - // ncdScreeningVisitDetails const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; - // let visitDetails = Object.assign({}, medicalForm.controls.patientVisitForm.controls.patientVisitDetailsForm.value, medicalForm.controls.patientVisitForm.controls.patientFileUploadDetailsForm.value, serviceDetails); - // let ncdScreeningDetails = Object.assign({}, postNCDScreeningFormValue, serviceDetails); - const ncdScreeningVitalDetails = Object.assign( - {}, - medicalForm.controls.patientVitalsForm.value, - ); const ncdScreeningidrsDetails = Object.assign( {}, medicalForm.controls.idrsScreeningForm.value, serviceDetails, ); - // let ncdScreeningVisitDetails = Object.assign({}, { 'visitDetails': visitDetails }, { 'ncdScreeningDetails': ncdScreeningDetails }, { - // benFlowID: localStorage.getItem('benFlowID'), beneficiaryID: localStorage.getItem('beneficiaryID'), sessionID: localStorage.getItem('sessionID'), - // parkingPlaceID: parkingPlaceID, vanID: vanID - // }); - - // let chiefComplaints= Object.assign({}, medicalForm.controls.patientVisitForm.controls.patientChiefComplaintsForm.value); const ncdScreeningVisitDetails = Object.assign( {}, @@ -1628,7 +1649,7 @@ export class NurseService { { historyDetails: this.postNCDScreeningHistoryForm( medicalForm.controls.patientHistoryForm, - null, + beneficiary, visitCategory, ), }, @@ -1638,14 +1659,16 @@ export class NurseService { beneficiaryID: localStorage.getItem('beneficiaryID'), sessionID: localStorage.getItem('sessionID'), parkingPlaceID: parkingPlaceID, + createdBy: localStorage.getItem('userName'), + tcRequest: tcRequest, vanID: vanID, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + benVisitID: null, + providerServiceMapID: localStorage.getItem('providerServiceID'), }, ); - console.log( - 'postNCDScreeningFormData', - JSON.stringify(ncdScreeningVisitDetails, null, 4), - ); + //console.log('postNCDScreeningFormData', JSON.stringify(ncdScreeningVisitDetails, null, 4)); return this.http.post( environment.postNCDScreeningDetails, @@ -1657,6 +1680,7 @@ export class NurseService { medicalForm: any, visitCategory: any, beneficiary: any, + tcRequest: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -1689,6 +1713,9 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }; console.log( @@ -1789,6 +1816,7 @@ export class NurseService { medicalForm: any, visitCategory: any, beneficiary: any, + tcRequest: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -1816,6 +1844,9 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }; console.log( @@ -1829,10 +1860,11 @@ export class NurseService { ); } - postNurseCovidCareVisitForm( + postNurseCovidVisitForm( medicalForm: any, visitCategory: any, beneficiary: any, + tcRequest: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -1860,23 +1892,27 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }; console.log( - 'Nurse Covid CARE Visit Details', + 'Nurse Covid-19 Visit Details', JSON.stringify(nurseGeneralOPDVisitDetails, null, 4), ); - // return this.http.post( - // environment.saveNurseCovidCareDetails, - // nurseGeneralOPDVisitDetails - // ); + return this.http.post( + environment.saveNurseCovidDetails, + nurseGeneralOPDVisitDetails, + ); } postNursePNCVisitForm( medicalForm: any, visitCategory: any, beneficiary: any, + tcRequest: any, ) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); const vanID = JSON.parse(serviceLineDetails).vanID; @@ -1914,6 +1950,9 @@ export class NurseService { vanID: vanID, serviceID: serviceID, createdBy: createdBy, + tcRequest: tcRequest, + beneficiaryRegID: localStorage.getItem('beneficiaryRegID'), + providerServiceMapID: localStorage.getItem('providerServiceID'), }; console.log( @@ -1984,12 +2023,6 @@ export class NurseService { environment.getNcdScreeningVisitCountUrl + beneficiaryRegID, ); } - getCountryName() { - return this.http.get(environment.getCountryName); - } - getCityName(countryID: any) { - return this.http.get(environment.getCityName + countryID + '/'); - } getStateName(value: any) { return this.http.get(environment.getStateName + value); } @@ -1999,7 +2032,12 @@ export class NurseService { getSubDistrictName(districtID: any) { return this.http.get(environment.getSubDistrictName + districtID); } - + getCountryName() { + return this.http.get(environment.getCountryName); + } + getCityName(countryID: any) { + return this.http.get(environment.getCityName + countryID + countryID + '/'); + } postNCDScreeningHistoryForm( medicalForm: any, beneficiary: any, @@ -2037,29 +2075,47 @@ export class NurseService { // console.log('General examination', JSON.stringify(generalExaminationForm, null, 4)); return physicalActivityHistoryForm; } - - getPreviousReferredHistory(benRegID: string, visitCategory: any) { - return this.http.post(environment.previousReferredHistoryUrl, { - benRegID: benRegID, - }); - } - setNCDTemp(score: any) { this.temp = score; this.ncdTemp.next(score); } - - clearMessage() { + clearNCDTemp() { this.temp = false; this.ncdTemp.next(false); } - getTMReferredCasesheetData(reqObj: any) { - // return this.http.post(environment.getTMCasesheetData, reqObj); + setIsMMUTC(isMMUTC: any) { + this.ismmutc.next(isMMUTC); + } + + /** + * (C) + * DE40034072 + *25-06-21 + */ + + /*ANC Fetosense Test service*/ + + sendTestDetailsToFetosense(reqObj: any) { + return this.http.post(environment.savefetosenseTestDetailsUrl, reqObj); + } + + fetchPrescribedFetosenseTests(benFlowId: any) { + return this.http.get(environment.getPrescribedFetosenseTests + benFlowId); } + setLMPForFetosenseTest(value: any) { + this.lmpFetosenseTest = value; + this.lmpFetosenseTestValue.next(value); + } + + clearLMPForFetosenseTest() { + this.lmpFetosenseTest = null; + this.lmpFetosenseTestValue.next(null); + } calculateBmiStatus(obj: any) { return this.http.post(environment.calculateBmiStatus, obj); } + /*END*/ setRbsSelectedInInvestigation(score: any) { this.rbsSelectedInvestigation = score; diff --git a/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.spec.ts b/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.spec.ts index 33207ab..de923d1 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.spec.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.spec.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" diff --git a/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.ts b/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.ts index 770ce6d..0b9051e 100644 --- a/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.ts +++ b/src/app/app-modules/nurse-doctor/shared/services/test-in-vitals.service.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -36,7 +36,7 @@ export class TestInVitalsService { vitalRBSTestResultInUpdate = new BehaviorSubject(this.vitalRBSTestUpdate); vitalRBSTestResultInUpdate$ = this.vitalRBSTestResultInUpdate.asObservable(); - //change in systolic Bp + //Change in Vitals RBS Test result during fetch setVitalsRBSValueInReports(value: any) { this.vitalRBSTest = value; this.vitalRBSTestResult.next(value); diff --git a/src/app/app-modules/nurse-doctor/shared/utility/cancer-utility.ts b/src/app/app-modules/nurse-doctor/shared/utility/cancer-utility.ts index f5409db..dca1c41 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/cancer-utility.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/cancer-utility.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -23,13 +23,8 @@ import { FormBuilder, FormGroup } from '@angular/forms'; export class CancerUtils { - // serviceLineDetails: any = null; constructor(private fb: FormBuilder) {} - ngOnInIt() { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - } - createCancerPatientFamilyMedicalHistoryForm() { return this.fb.group({ diseases: this.fb.array([this.initDiseases()]), @@ -332,11 +327,7 @@ export class CancerUtils { vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, lymphNodes: this.fb.array( - this.lymphNodesArray.map((item) => ({ - ...item, - vanID: JSON.parse(serviceLineDetails).vanID, - parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, - })), + this.lymphNodesArray.map((item) => this.fb.group(item)), ), }); } @@ -347,8 +338,8 @@ export class CancerUtils { referredToInstituteID: null, refrredToAdditionalServiceList: null, referredToInstituteName: null, - revisitDate: null, referralReason: null, + revisitDate: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); diff --git a/src/app/app-modules/nurse-doctor/shared/utility/general-utility.ts b/src/app/app-modules/nurse-doctor/shared/utility/general-utility.ts index 9ec022d..f3289ac 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/general-utility.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/general-utility.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -47,13 +47,13 @@ export class GeneralUtils { sPO2: null, systolicBP_1stReading: null, diastolicBP_1stReading: null, - rbsTestResult: null, - rbsTestRemarks: null, - rbsCheckBox: true, bloodGlucose_Fasting: null, bloodGlucose_Random: null, bloodGlucose_2hr_PP: null, respiratoryRate: null, + rbsTestResult: null, + rbsTestRemarks: null, + rbsCheckBox: true, frequentCoughChecked: null, sputumChecked: null, coughAtNightChecked: null, @@ -82,7 +82,6 @@ export class GeneralUtils { **/ createGeneralExaminationForm() { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - return this.fb.group({ consciousness: null, coherence: null, @@ -300,6 +299,7 @@ export class GeneralUtils { expDelDt: null, duration: null, trimesterNumber: null, + bloodGroup: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); @@ -508,10 +508,6 @@ export class GeneralUtils { pregOutcomeID: null, pregOutcome: null, - // postNatalComplicationID: null, - // postNatalComplication: null, - // otherPostNatalComplication: null, - newBornComplicationID: null, newBornComplication: null, otherNewBornComplication: null, @@ -572,7 +568,7 @@ export class GeneralUtils { clinicalObservation: null, otherSymptoms: null, significantFindings: null, - isForHistory: false, + isForHistory: null, complaints: this.fb.array([this.initChiefComplaints()]), createdBy: null, vanID: JSON.parse(serviceLineDetails).vanID, @@ -597,13 +593,13 @@ export class GeneralUtils { createGeneralDiagnosisForm() { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); return this.fb.group({ - provisionalDiagnosisList: this.fb.array([ - this.initProvisionalDiagnosisList(), - ]), instruction: null, prescriptionID: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + provisionalDiagnosisList: this.fb.array([ + this.initProvisionalDiagnosisList(), + ]), }); } @@ -611,14 +607,14 @@ export class GeneralUtils { return this.fb.group({ conceptID: [null, Validators.required], term: [null, Validators.required], - provisionalDiagnosis: [null], + viewProvisionalDiagnosisProvided: [null], }); } initConfirmatoryDiagnosisList() { return this.fb.group({ conceptID: [null, Validators.required], term: [null, Validators.required], - confirmatoryDiagnosis: [null], + viewConfirmatoryDiagnosisProvided: [null], }); } @@ -636,6 +632,7 @@ export class GeneralUtils { dateOfDeath: null, causeOfDeath: null, prescriptionID: null, + specialistDiagnosis: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); @@ -651,6 +648,7 @@ export class GeneralUtils { ncdCareType: null, ncdComplication: null, prescriptionID: null, + specialistDiagnosis: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, provisionalDiagnosisList: this.fb.array([ @@ -659,7 +657,7 @@ export class GeneralUtils { }); } - createCovidCareDiagnosisForm() { + createCovidDiagnosisForm() { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); return this.fb.group({ prescriptionID: null, @@ -669,28 +667,6 @@ export class GeneralUtils { parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); } - // createNCDScreeningDiagnosisForm() { - // return this.fb.group({ - // prescriptionID : null, - // specialistDiagnosis: null, - // doctorDiagnosis: null, - // vanID: JSON.parse(serviceLineDetails).vanID, - // parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, - // }); - // } - - createNCDScreeningDiagnosisForm() { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); - return this.fb.group({ - provisionalDiagnosisList: this.fb.array([ - this.initProvisionalDiagnosisList(), - ]), - instruction: null, - prescriptionID: null, - vanID: JSON.parse(serviceLineDetails).vanID, - parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, - }); - } createPNCDiagnosisForm() { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); @@ -706,6 +682,7 @@ export class GeneralUtils { dateOfDeath: null, causeOfDeath: null, prescriptionID: null, + specialistDiagnosis: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); @@ -771,45 +748,59 @@ export class GeneralUtils { drugPrescriptionForm: this.createDrugPrescriptionForm(), }); } - - createANCCaseRecord() { + createNCDScreeningCaseRecord() { return this.fb.group({ generalFindingsForm: this.createGeneralFindingsForm(), - generalDiagnosisForm: this.createANCDiagnosisForm(), + generalDiagnosisForm: this.createNCDScreeningDiagnosisForm(), generalDoctorInvestigationForm: this.createGeneraldoctorinvestigationForm(), drugPrescriptionForm: this.createDrugPrescriptionForm(), }); } - - createNCDCareCaseRecord() { + createNCDScreeningDiagnosisForm() { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + return this.fb.group({ + instruction: null, + prescriptionID: null, + vanID: JSON.parse(serviceLineDetails).vanID, + parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + provisionalDiagnosisList: this.fb.array([ + this.initProvisionalDiagnosisList(), + ]), + diabetesConfirmed: null, + hypertensionConfirmed: null, + }); + } + createANCCaseRecord() { return this.fb.group({ generalFindingsForm: this.createGeneralFindingsForm(), - generalDiagnosisForm: this.createNCDCareDiagnosisForm(), + generalDiagnosisForm: this.createANCDiagnosisForm(), generalDoctorInvestigationForm: this.createGeneraldoctorinvestigationForm(), drugPrescriptionForm: this.createDrugPrescriptionForm(), }); } - createCovidCareCaseRecord() { + createNCDCareCaseRecord() { return this.fb.group({ generalFindingsForm: this.createGeneralFindingsForm(), - generalDiagnosisForm: this.createCovidCareDiagnosisForm(), + generalDiagnosisForm: this.createNCDCareDiagnosisForm(), generalDoctorInvestigationForm: this.createGeneraldoctorinvestigationForm(), drugPrescriptionForm: this.createDrugPrescriptionForm(), }); } - createNCDScreeningCaseRecord() { + + createCovidCaseRecord() { return this.fb.group({ generalFindingsForm: this.createGeneralFindingsForm(), - generalDiagnosisForm: this.createNCDScreeningDiagnosisForm(), + generalDiagnosisForm: this.createCovidDiagnosisForm(), generalDoctorInvestigationForm: this.createGeneraldoctorinvestigationForm(), drugPrescriptionForm: this.createDrugPrescriptionForm(), }); } + createPNCCaseRecord() { return this.fb.group({ generalFindingsForm: this.createGeneralFindingsForm(), @@ -839,7 +830,6 @@ export class GeneralUtils { parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); } - /** * NCD Screening History Forms */ diff --git a/src/app/app-modules/nurse-doctor/shared/utility/index.ts b/src/app/app-modules/nurse-doctor/shared/utility/index.ts index 9fabe9c..ba73329 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/index.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/index.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" diff --git a/src/app/app-modules/nurse-doctor/shared/utility/ncd-screening-utility.ts b/src/app/app-modules/nurse-doctor/shared/utility/ncd-screening-utility.ts index f172099..7264121 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/ncd-screening-utility.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/ncd-screening-utility.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -20,7 +20,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ -import { FormBuilder, FormGroup, Validators, FormArray } from '@angular/forms'; +import { FormBuilder } from '@angular/forms'; export class NCDScreeningUtils { constructor(private fb: FormBuilder) {} diff --git a/src/app/app-modules/nurse-doctor/shared/utility/quick-consult-utility.ts b/src/app/app-modules/nurse-doctor/shared/utility/quick-consult-utility.ts index af06873..feddebb 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/quick-consult-utility.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/quick-consult-utility.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -20,7 +20,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ -import { FormBuilder, FormGroup, Validators, FormArray } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; export class QuickConsultUtils { constructor(private fb: FormBuilder) {} @@ -59,13 +59,13 @@ export class QuickConsultUtils { } initMedicineWithData(prescription: any, id?: null): FormGroup { - const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); let unit; if (prescription.drugUnit) { unit = `${prescription.drugStrength}${prescription.drugUnit}`; } else { unit = prescription.drugStrength; } + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); return this.fb.group({ id: id, drugID: prescription.drugID, @@ -114,27 +114,25 @@ export class QuickConsultUtils { rbsTestResult: { value: null, disabled: false }, rbsTestRemarks: { value: null, disabled: false }, clinicalObservation: [null, Validators.required], - provisionalDiagnosisList: this.fb.array([ - this.initProvisionalDiagnosisList(), - ]), labTestOrders: [], radiology: [], test: [], externalInvestigation: null, - diagnosisProvided: [null, Validators.required], instruction: null, prescription: this.createDrugPrescriptionForm(), prescriptionID: null, vanID: JSON.parse(serviceLineDetails).vanID, parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + provisionalDiagnosisList: this.fb.array([ + this.initProvisionalDiagnosisList(), + ]), }); } - initProvisionalDiagnosisList() { return this.fb.group({ conceptID: [null, Validators.required], term: [null, Validators.required], - provisionalDiagnosis: [null, Validators.required], + viewProvisionalDiagnosisProvided: [null, Validators.required], }); } } diff --git a/src/app/app-modules/nurse-doctor/shared/utility/validation-utility.ts b/src/app/app-modules/nurse-doctor/shared/utility/validation-utility.ts index a56af3d..f44a499 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/validation-utility.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/validation-utility.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -56,7 +56,7 @@ export class ValidationUtils { getAgeValue(age: any) { if (!age) return 0; - const arr = age.trim().split(' '); + const arr = age !== undefined && age !== null ? age.trim().split(' ') : age; const ageUnit = arr[1]; if (ageUnit.toLowerCase() === 'years') return parseInt(arr[0]) * 365; else if (ageUnit.toLowerCase() === 'months') return parseInt(arr[0]) * 30; diff --git a/src/app/app-modules/nurse-doctor/shared/utility/visit-detail-utility.ts b/src/app/app-modules/nurse-doctor/shared/utility/visit-detail-utility.ts index d4f1436..e252eb4 100644 --- a/src/app/app-modules/nurse-doctor/shared/utility/visit-detail-utility.ts +++ b/src/app/app-modules/nurse-doctor/shared/utility/visit-detail-utility.ts @@ -1,5 +1,5 @@ /* - * AMRIT – Accessible Medical Records via Integrated Technology + * AMRIT � Accessible Medical Records via Integrated Technology * Integrated EHR (Electronic Health Records) Solution * * Copyright (C) "Piramal Swasthya Management and Research Institute" @@ -20,7 +20,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ -import { FormBuilder, FormGroup, FormArray, Validators } from '@angular/forms'; +import { FormBuilder, FormGroup } from '@angular/forms'; export class VisitDetailUtils { constructor(private fb: FormBuilder) {} @@ -37,7 +37,6 @@ export class VisitDetailUtils { patientFileUploadDetailsForm: this.createPatientFileUploadDetailsForm(diasableFlag), patientDiseaseForm: this.createPatientDiseaseForm(diasableFlag), - tmcConfirmationForm: this.createPatientTmcConfirmationForm(diasableFlag), covidVaccineStatusForm: this.createCovidVaccineStatusForm(diasableFlag), }); } @@ -117,12 +116,47 @@ export class VisitDetailUtils { parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); } + createPatientFileUploadDetailsForm(disableFlag = false) { return this.fb.group({ fileIDs: null, }); } + createPatientDiseaseForm(disableFlag = false) { + return this.fb.group({ + diseaseFormsArray: this.fb.array([]), + }); + } + + createPatientDiseaseArrayForm(data: any) { + if (!data) { + data = { + diseaseName: null, + flag: null, + selected: null, + }; + } + return this.fb.group({ + diseaseName: data.disease, + flag: data.flag, + selected: data.selected, + }); + } + + createPatientSymptomsForm(disableFlag = false) { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + return this.fb.group({ + beneficiaryRegID: null, + benVisitID: null, + providerServiceMapID: null, + conceptID: null, + symptoms: { value: null, disabled: disableFlag }, + createdBy: null, + vanID: JSON.parse(serviceLineDetails).vanID, + parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + }); + } createPatientCovidForm(disableFlag = false) { const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); return this.fb.group({ @@ -130,11 +164,8 @@ export class VisitDetailUtils { benVisitID: null, providerServiceMapID: null, conceptID: null, - symptom: [{ value: null, disabled: disableFlag }, Validators.required], - contactStatus: [ - { value: null, disabled: disableFlag }, - Validators.required, - ], + symptom: { value: null, disabled: disableFlag }, + contactStatus: { value: null, disabled: disableFlag }, travelStatus: { value: null, disabled: disableFlag }, travelList: this.fb.array([]), modeOfTravelDomestic: { value: null, disabled: disableFlag }, @@ -156,22 +187,7 @@ export class VisitDetailUtils { parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, }); } - createPatientDiseaseForm(disableFlag = false) { - return this.fb.group({ - diseaseFormsArray: this.fb.array([]), - }); - } - - createPatientTmcConfirmationForm(disableFlag = false) { - return this.fb.group({ - tmcConfirmed: null, - refrredToAdditionalServiceList: null, - isDiabetic: null, - isHypertensionConfirmed: null, - }); - } - - createCovidVaccineStatusForm(disableFlag: any): FormGroup { + createCovidVaccineStatusForm(disableFlag = false): FormGroup { return this.fb.group({ covidVSID: null, ageGroup: null, @@ -184,19 +200,4 @@ export class VisitDetailUtils { boosterDoseDate: null, }); } - - createPatientDiseaseArrayForm(data: any) { - if (!data) { - data = { - diseaseName: null, - flag: null, - selected: null, - }; - } - return this.fb.group({ - diseaseName: data.disease, - flag: data.flag, - selected: data.selected, - }); - } } diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.css b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.css new file mode 100644 index 0000000..d81136d --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.css @@ -0,0 +1,85 @@ +.input-full-width { + width: 100%; +} + +mat-pagination { + text-align: right; +} + +mat-input-container { + width: 60%; +} +.norecord { + text-align: center; +} + +mat-card { + min-height: 400px; + padding: 15px; +} + + :host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + mat-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +ul { + list-style: none; + padding: 0px; +} + +ul li { + display: inline-block; + padding: 0 8px; +} + +ul li div, +ul li p { + display: inline-block; +} + +ul li div { + height: 15px; + width: 15px; +} + +.marker-s-f-c { + background: #0b69b2; +} + +.visitStatus { + position: relative; + text-align: center; +} + +.no-padding { + padding: 0 !important; +} + +.centered { + justify-content: center; + display: flex; +} + +.visitStatus.s-f-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; +} + +.totalCount, +.description { + padding-top: 15px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.html b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.html new file mode 100644 index 0000000..1521c83 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.html @@ -0,0 +1,325 @@ +
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.casesheet?.serialNo }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} + + / + {{ element.benVisitNo }} + + {{ currentLanguageSet?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ currentLanguageSet?.bendetails?.visitDate }} + + {{ element.benVisitDate }} + + {{ currentLanguageSet?.bendetails?.image }} + + profile + +
+ {{ currentLanguageSet?.common?.totalCount }} : + {{ dataSource.data.length }} +
+
+
    +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingForConsultation + }} +

    +
  • +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info + ?.pendingforLabtestResult + }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.alerts?.info?.labtestDone }}

    +
  • +
  • +
    +

    + {{ currentLanguageSet?.alerts?.info?.consultationDone }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.common?.tmReferred }}

    +
  • +
+
+
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+
+
+
    +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingForConsultation + }} +

    +
  • +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingforLabtestResult + }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.alerts?.info?.labtestDone }}

    +
  • +
  • +
    +

    + {{ currentLanguageSet?.alerts?.info?.consultationDone }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.common?.tmReferred }}

    +
  • +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.spec.ts new file mode 100644 index 0000000..86768a6 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TcSpecialistFutureWorklistComponent } from './tc-specialist-future-worklist.component'; + +describe('TcSpecialistFutureWorklistComponent', () => { + let component: TcSpecialistFutureWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TcSpecialistFutureWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TcSpecialistFutureWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.ts b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.ts new file mode 100644 index 0000000..eb123dc --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-future-worklist/tc-specialist-future-worklist.component.ts @@ -0,0 +1,284 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + OnInit, + DoCheck, + ViewChild, + OnDestroy, +} from '@angular/core'; +import { Router } from '@angular/router'; + +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { DoctorService, MasterdataService } from '../shared/services'; +import { CameraService } from '../../core/services/camera.service'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import * as moment from 'moment'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-tc-specialist-future-worklist', + templateUrl: './tc-specialist-future-worklist.component.html', + styleUrls: ['./tc-specialist-future-worklist.component.css'], +}) +export class TcSpecialistFutureWorklistComponent + implements OnInit, DoCheck, OnDestroy +{ + rowsPerPage = 5; + activePage = 1; + pagedList = []; + rotate = true; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + blankTable = [1, 2, 3, 4, 5]; + filterTerm: any; + currentLanguageSet: any; + currentPage!: number; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'district', + 'visitDate', + 'image', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private cameraService: CameraService, + private masterdataService: MasterdataService, + private confirmationService: ConfirmationService, + public httpServiceService: HttpServiceService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private doctorService: DoctorService, + ) {} + + ngOnInit() { + this.assignSelectedLanguage(); + localStorage.setItem('currentRole', 'Doctor'); + this.removeBeneficiaryDataForDoctorVisit(); + this.loadWorklist(); + this.beneficiaryDetailsService.reset(); + this.masterdataService.reset(); + } + + ngOnDestroy() { + localStorage.removeItem('currentRole'); + } + + removeBeneficiaryDataForDoctorVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + } + + pageChanged(event: any): void { + console.log('called', event); + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + console.log('list', this.pagedList); + } + loadWorklist() { + this.filterTerm = null; + this.doctorService.getSpecialistFutureWorklist().subscribe( + (data: any) => { + if (data && data.statusCode === 200 && data.data) { + console.log( + 'doctor future worklist', + JSON.stringify(data.data, null, 4), + ); + data.data.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + const benlist = this.loadDataToBenList(data.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + } else this.confirmationService.alert(data.errorMessage, 'error'); + }, + (err: any) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.arrival = false; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY HH:mm A') || + 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.tCRequestDate = + moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + }); + return data; + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + console.log('item', JSON.stringify(item, null, 4)); + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'age' || + key === 'statusMessage' || + key === 'VisitCategory' || + key === 'benVisitNo' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' || + key === 'beneficiaryRegID' || + key === 'visitDate' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + }); + } + } + + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + getBeneficiryStatus(beneficiary: any) { + this.confirmationService.alert(beneficiary.statusMessage); + } + + getVisitStatus(beneficiaryVisitDetials: any) { + const status = { + statusCode: 0, + statusMessage: '', + }; + + status.statusMessage = + this.currentLanguageSet.alerts.info.scheduleForConsultation; + status.statusCode = 1; + + return status; + } + + cancelTCRequest(beneficiary: any) { + this.confirmationService + .confirm( + 'info', + this.currentLanguageSet.alerts.info.cancelReq, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.doctorService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.loadWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error: any) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + }); + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.css b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.css new file mode 100644 index 0000000..5789cee --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.css @@ -0,0 +1,3 @@ +/* +resolving sonarqube error- Unexpected empty source +*/ \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.html b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.html new file mode 100644 index 0000000..456f9d0 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.html @@ -0,0 +1,12 @@ +
+ + + + + + + + +
diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.spec.ts b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.spec.ts new file mode 100644 index 0000000..da320c7 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TcSpecialistWorklistWrapperComponent } from './tc-specialist-worklist-wrapper.component'; + +describe('TcSpecialistWorklistWrapperComponent', () => { + let component: TcSpecialistWorklistWrapperComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TcSpecialistWorklistWrapperComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TcSpecialistWorklistWrapperComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.ts b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.ts new file mode 100644 index 0000000..4387455 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist-wrapper/tc-specialist-worklist-wrapper.component.ts @@ -0,0 +1,54 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { Component, DoCheck, OnInit } from '@angular/core'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import { MatTabChangeEvent } from '@angular/material/tabs'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; + +@Component({ + selector: 'app-tc-specialist-worklist-wrapper', + templateUrl: './tc-specialist-worklist-wrapper.component.html', + styleUrls: ['./tc-specialist-worklist-wrapper.component.css'], +}) +export class TcSpecialistWorklistWrapperComponent implements OnInit, DoCheck { + currentLanguageSet: any; + constructor(public httpServiceService: HttpServiceService) {} + + ngOnInit() { + this.assignSelectedLanguage(); + } + getChangedTab: any; + public tabChanged(tabChangeEvent: MatTabChangeEvent): void { + console.log('changedtab', tabChangeEvent.index); + if (tabChangeEvent.index === 0) this.getChangedTab = 'current'; + else this.getChangedTab = 'future'; + } + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.css b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.css new file mode 100644 index 0000000..32f2e5d --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.css @@ -0,0 +1,175 @@ +.input-full-width { + width: 100%; +} + +mat-pagination { + text-align: right; +} + +mat-input-container { + width: 60%; +} +.norecord { + text-align: center; +} + +mat-card { + min-height: 400px; + padding: 15px; +} + +#refresh, +#manageTimesheet { + margin-left: 5px; +} + +:host /deep/ .pagination { + margin: 0; +} + +@media (max-width: 481px) { + mat-input-container { + width: 100%; + } + #caseSheetButton { + width: 100%; + } +} + +ul { + list-style: none; + padding: 0px; +} + +ul li { + display: inline-block; + padding: 0 8px; +} + +ul li div, +ul li p { + display: inline-block; +} + +ul li div { + height: 15px; + width: 15px; +} + +.marker-p-f-c { + background: #0b69b2; +} + +.marker-p-f-d-u { + background: brown; +} + +.marker-p-f-t { + background: #e44e4f; +} + +.marker-t-d { + background: #eaaa26; +} + +.marker-c-d { + background: #43760f; +} + +.marker-a-f-t-p { + background:#9b1717; +} + +.marker-a-f-t-d { + background:#ba8212; +} + +.visitStatus { + position: relative; + text-align: center; +} + +.no-padding { + padding: 0 !important; +} + +.centered { + justify-content: center; + display: flex; +} + +.visitStatus.p-f-c::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #0b69b2; +} + +.visitStatus.p-f-d-u::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: brown; +} + +.visitStatus.p-f-t::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #e44e4f; +} + +.visitStatus.t-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #eaaa26; +} + +.visitStatus.c-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background: #43760f; +} + +.visitStatus.a-f-t-p::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background:#9b1717; +} + +.visitStatus.a-f-t-d::before { + content: ""; + position: absolute; + left: 0; + top: 0; + bottom: 1px; + width: 4px; + background:#ba8212; +} + + +.totalCount, +.description { + padding-top: 15px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.html b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.html new file mode 100644 index 0000000..749049a --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.html @@ -0,0 +1,325 @@ +
+
+
+
+ + +
+
+
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {{ currentLanguageSet?.casesheet?.serialNo }} + + {{ element.sno }} + + {{ currentLanguageSet?.bendetails?.beneficiaryID }} + + {{ element?.beneficiaryID }} + + {{ currentLanguageSet?.bendetails?.beneficiaryName }} + + {{ element?.benName | titlecase }} + + {{ currentLanguageSet?.bendetails?.gender }} + + {{ element.genderName | titlecase }} + + {{ currentLanguageSet?.bendetails?.age }} + + {{ element.age }} + + {{ currentLanguageSet?.bendetails?.visitCategory }} + + {{ element.VisitCategory }} + + / + {{ element.benVisitNo }} + + {{ currentLanguageSet?.bendetails?.district }} + + {{ element.districtName | titlecase }} / + {{ element.villageName | titlecase }} + + {{ currentLanguageSet?.bendetails?.visitDate }} + + {{ element.benVisitDate }} + + {{ currentLanguageSet?.bendetails?.image }} + + profile + +
+ {{ currentLanguageSet?.common?.totalCount }} : + {{ dataSource.data.length }} +
+
+
    +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingForConsultation + }} +

    +
  • +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info + ?.pendingforLabtestResult + }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.alerts?.info?.labtestDone }}

    +
  • +
  • +
    +

    + {{ currentLanguageSet?.alerts?.info?.consultationDone }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.common?.tmReferred }}

    +
  • +
+
+
+
+ {{ currentLanguageSet?.noRecordsFound }} +
+
+
+
    +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingForConsultation + }} +

    +
  • +
  • +
    +

    + {{ + currentLanguageSet?.alerts?.info?.pendingforLabtestResult + }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.alerts?.info?.labtestDone }}

    +
  • +
  • +
    +

    + {{ currentLanguageSet?.alerts?.info?.consultationDone }} +

    +
  • +
  • +
    +

    {{ currentLanguageSet?.common?.tmReferred }}

    +
  • +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.spec.ts b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.spec.ts new file mode 100644 index 0000000..e0cd64f --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.spec.ts @@ -0,0 +1,46 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TcSpecialistWorklistComponent } from './tc-specialist-worklist.component'; + +describe('TcSpecialistWorklistComponent', () => { + let component: TcSpecialistWorklistComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TcSpecialistWorklistComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TcSpecialistWorklistComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.ts b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.ts new file mode 100644 index 0000000..aadc034 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/tc-specialist-worklist/tc-specialist-worklist.component.ts @@ -0,0 +1,571 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + OnInit, + OnDestroy, + Input, + OnChanges, + DoCheck, + ViewChild, +} from '@angular/core'; +import { Router } from '@angular/router'; +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { DoctorService, MasterdataService } from '../shared/services'; +import { CameraService } from '../../core/services/camera.service'; +import { TelemedicineService } from '../../core/services/telemedicine.service'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import * as moment from 'moment'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-tc-specialist-worklist', + templateUrl: './tc-specialist-worklist.component.html', + styleUrls: ['./tc-specialist-worklist.component.css'], +}) +export class TcSpecialistWorklistComponent + implements OnInit, OnDestroy, OnChanges, DoCheck +{ + rowsPerPage = 5; + activePage = 1; + pagedList = []; + rotate = true; + beneficiaryList: any; + filteredBeneficiaryList: any = []; + blankTable = [1, 2, 3, 4, 5]; + filterTerm: any; + currentLanguageSet: any; + cbacData: any = []; + diseases: any; + currentPage!: number; + beneficiaryMetaData: any; + displayedColumns: any = [ + 'sno', + 'beneficiaryID', + 'beneficiaryName', + 'gender', + 'age', + 'visitCategory', + 'district', + 'visitDate', + 'image', + ]; + @ViewChild(MatPaginator) paginator: MatPaginator | null = null; + dataSource = new MatTableDataSource(); + + constructor( + private cameraService: CameraService, + private router: Router, + private masterdataService: MasterdataService, + private confirmationService: ConfirmationService, + private telemedicineService: TelemedicineService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private doctorService: DoctorService, + public httpServiceService: HttpServiceService, + ) {} + intervalref: any; + @Input() + getChangedTab: any; + ngOnInit() { + this.assignSelectedLanguage(); + localStorage.setItem('currentRole', 'Doctor'); + this.removeBeneficiaryDataForDoctorVisit(); + this.reLoadWorklist(); + this.beneficiaryDetailsService.reset(); + this.masterdataService.reset(); + this.setTimer(); + } + + ngOnChanges() { + console.log('this.getChangedTab', this.getChangedTab); + if (this.getChangedTab === 'current') this.setTimer(); + + if (this.getChangedTab === 'future') clearInterval(this.intervalref); + } + + setTimer() { + this.intervalref = setInterval( + () => { + this.loadWorklist(); + }, + 1 * 60 * 1000, + ); + } + + ngOnDestroy() { + localStorage.removeItem('currentRole'); + clearInterval(this.intervalref); + } + + removeBeneficiaryDataForDoctorVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + localStorage.removeItem('referredVisitCode'); + localStorage.removeItem('referredVisitID'); + } + + pageChanged(event: any): void { + console.log('called', event); + const startItem = (event.page - 1) * event.itemsPerPage; + const endItem = event.page * event.itemsPerPage; + this.pagedList = this.filteredBeneficiaryList.slice(startItem, endItem); + console.log('list', this.pagedList); + } + reLoadWorklist() { + this.filterTerm = null; + this.loadWorklist(); + } + loadWorklist() { + this.beneficiaryMetaData = []; + this.doctorService.getSpecialistWorklist().subscribe( + (data: any) => { + if (data && data.statusCode === 200 && data.data) { + console.log('doctor worklist', JSON.stringify(data.data, null, 4)); + this.beneficiaryMetaData = data.data; + data.data.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + const benlist = this.loadDataToBenList(data.data); + this.beneficiaryList = benlist; + this.filteredBeneficiaryList = benlist; + this.dataSource.data = []; + this.dataSource.data = benlist; + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach((sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }); + this.filterTerm = null; + this.filterBeneficiaryList(this.filterTerm); + } else this.confirmationService.alert(data.errorMessage, 'error'); + }, + (err) => { + this.confirmationService.alert(err, 'error'); + }, + ); + } + + loadDataToBenList(data: any) { + data.forEach((element: any) => { + element.genderName = element.genderName || 'Not Available'; + element.age = element.age || 'Not Available'; + element.statusMessage = element.statusMessage || 'Not Available'; + element.VisitCategory = element.VisitCategory || 'Not Available'; + element.benVisitNo = element.benVisitNo || 'Not Available'; + element.districtName = element.districtName || 'Not Available'; + element.villageName = element.villageName || 'Not Available'; + element.arrival = false; + element.preferredPhoneNum = element.preferredPhoneNum || 'Not Available'; + element.visitDate = + moment(element.visitDate).format('DD-MM-YYYY') || 'Not Available'; + element.tCRequestDate = + moment(element.tCRequestDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + element.benVisitDate = + moment(element.benVisitDate).format('DD-MM-YYYY HH:mm A ') || + 'Not Available'; + }); + return data; + } + + filterBeneficiaryList(searchTerm: string) { + if (!searchTerm) this.filteredBeneficiaryList = this.beneficiaryList; + else { + this.filteredBeneficiaryList = []; + this.dataSource.data = []; + this.dataSource.paginator = this.paginator; + this.beneficiaryList.forEach((item: any) => { + console.log('item', JSON.stringify(item, null, 4)); + for (const key in item) { + if ( + key === 'beneficiaryID' || + key === 'benName' || + key === 'genderName' || + key === 'age' || + key === 'statusMessage' || + key === 'VisitCategory' || + key === 'benVisitNo' || + key === 'districtName' || + key === 'preferredPhoneNum' || + key === 'villageName' || + key === 'beneficiaryRegID' || + key === 'visitDate' + ) { + const value: string = '' + item[key]; + if (value.toLowerCase().indexOf(searchTerm.toLowerCase()) >= 0) { + this.filteredBeneficiaryList.push(item); + this.dataSource.data.push(item); + this.dataSource.paginator = this.paginator; + this.dataSource.data.forEach( + (sectionCount: any, index: number) => { + sectionCount.sno = index + 1; + }, + ); + break; + } + } + } + }); + } + } + + patientImageView(benregID: any) { + this.beneficiaryDetailsService + .getBeneficiaryImage(benregID) + .subscribe((data: any) => { + if (data && data.benImage) this.cameraService.viewImage(data.benImage); + else + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.imageNotFound, + ); + }); + } + + loadTcConsultation(beneficiary: any) { + localStorage.setItem('visitCode', beneficiary.visitCode); + console.log('benficiary', beneficiary); + if (beneficiary.statusCode === 1) { + this.redirectToWorkArea(beneficiary); + } else if (beneficiary.statusCode === 2) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 3) { + this.redirectToWorkArea(beneficiary); + } else if (beneficiary.statusCode === 5) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 9) { + this.viewAndPrintCaseSheet(beneficiary); + } else if (beneficiary.statusCode === 10) { + this.confirmationService.alert(beneficiary.statusMessage); + } else if (beneficiary.statusCode === 11) { + this.redirectToWorkArea(beneficiary); + } + } + + viewAndPrintCaseSheet(beneficiary: any) { + this.confirmationService + .confirm('info', this.currentLanguageSet.alerts.info.consulation) + .subscribe((res) => { + if (res) { + localStorage.setItem('caseSheetBenFlowID', beneficiary.benFlowID); + localStorage.setItem( + 'caseSheetVisitCategory', + beneficiary.VisitCategory, + ); + localStorage.setItem( + 'caseSheetBeneficiaryRegID', + beneficiary.beneficiaryRegID, + ); + localStorage.setItem('caseSheetVisitID', beneficiary.benVisitID); + this.router.navigate(['/common/print/' + 'TM' + '/' + 'current']); + } + }); + } + + checkBeneficiaryStatus(beneficiary: any) { + this.redirectToWorkArea(beneficiary); + } + + beneficiaryTCRequestStatus(benficiary: any) { + const beneficiaryTCRequest = { + benflowID: benficiary.benFlowID, + benRegID: benficiary.beneficiaryRegID, + visitCode: benficiary.visitCode, + userID: localStorage.getItem('userID'), + }; + this.doctorService + .beneficiaryTCRequestStatus(beneficiaryTCRequest) + .subscribe((res: any) => { + if (res.statusCode === 200) { + this.loadTcConsultation(benficiary); + } else { + this.confirmationService.alert( + this.currentLanguageSet.alerts.info.beneficiaryNotArrived, + ); + } + }); + } + + redirectToWorkArea(beneficiary: any) { + this.cbacData = []; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.beneficiaryDetailsService + .getCBACDetails(beneficiary.beneficiaryRegID) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if ( + res.data.benRegID !== undefined && + res.data.benRegID !== null && + ((res.data.suspectedTB !== undefined && + res.data.suspectedTB !== null) || + (res.data.suspectedNCD !== undefined && + res.data.suspectedNCD !== null) || + (res.data.suspectedHRP !== undefined && + res.data.suspectedHRP !== null) || + (res.data.suspectedNCDDiseases !== undefined && + res.data.suspectedNCDDiseases !== null)) + ) { + if ( + res.data.suspectedHRP !== undefined && + res.data.suspectedHRP !== null && + res.data.suspectedHRP.toLowerCase() === 'yes' + ) + this.cbacData.push('High Risk Pregnancy'); + if ( + res.data.suspectedTB !== undefined && + res.data.suspectedTB !== null && + res.data.suspectedTB.toLowerCase() === 'yes' + ) + this.cbacData.push('Tuberculosis'); + if ( + res.data.suspectedNCDDiseases !== undefined && + res.data.suspectedNCDDiseases !== null && + res.data.suspectedNCDDiseases.length > 0 + ) { + const diseases = res.data.suspectedNCDDiseases.split(','); + if (diseases.length > 0) { + diseases.forEach((element: any) => { + console.log(element.toLowerCase); + if (element.toLowerCase() === 'diabetes') + this.cbacData.push('Diabetes'); + if (element.toLowerCase() === 'hypertension') + this.cbacData.push('Hypertension'); + if (element.toLowerCase() === 'breast cancer') + this.cbacData.push('Breast cancer'); + if (element.toLowerCase() === 'mental health disorder') + this.cbacData.push('Mental health disorder'); + if (element.toLowerCase() === 'oral cancer') + this.cbacData.push('Oral cancer'); + }); + } + } + this.beneficiaryDetailsService.cbacData = this.cbacData; + if ( + this.cbacData !== undefined && + this.cbacData !== null && + this.cbacData.length > 0 + ) { + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + const dataSetted = this.setDataForWorkArea(beneficiary); + if (dataSetted) { + this.router.navigate([ + '/common/attendant/tcspecialist/patient/', + beneficiary.beneficiaryRegID, + ]); + } + } + }); + } else { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + const dataSetted = this.setDataForWorkArea(beneficiary); + if (dataSetted) { + this.router.navigate([ + '/common/attendant/tcspecialist/patient/', + beneficiary.beneficiaryRegID, + ]); + } + } + }); + } + } else { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService + .confirm( + `info`, + this.currentLanguageSet.alerts.info.confirmtoProceedFurther, + ) + .subscribe((result) => { + if (result) { + const dataSetted = this.setDataForWorkArea(beneficiary); + if (dataSetted) { + this.router.navigate([ + '/common/attendant/tcspecialist/patient/', + beneficiary.beneficiaryRegID, + ]); + } + } + }); + } + } else { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.cbacData = null; + this.beneficiaryDetailsService.cbacData = this.cbacData; + this.confirmationService.alert(err, 'error'); + }, + ); + } + + setDataForWorkArea(beneficiary: any) { + const serviceLineDetails = { + vanID: beneficiary.vanID, + parkingPlaceID: beneficiary.parkingPlaceID, + }; + localStorage.setItem( + 'serviceLineDetails', + JSON.stringify(serviceLineDetails), + ); + localStorage.setItem('beneficiaryGender', beneficiary.genderName); + localStorage.setItem('benFlowID', beneficiary.benFlowID); + localStorage.setItem('visitCategory', beneficiary.VisitCategory); + localStorage.setItem('specialist_flag', beneficiary.specialist_flag); + localStorage.setItem('beneficiaryRegID', beneficiary.beneficiaryRegID); + localStorage.setItem('visitID', beneficiary.benVisitID); + localStorage.setItem('beneficiaryID', beneficiary.beneficiaryID); + localStorage.setItem('doctorFlag', beneficiary.doctorFlag); + localStorage.setItem('nurseFlag', beneficiary.nurseFlag); + localStorage.setItem('pharmacist_flag', beneficiary.pharmacist_flag); + localStorage.setItem('referredVisitCode', beneficiary.referredVisitCode); + localStorage.setItem('referredVisitID', beneficiary.referred_visit_id); + + return true; + } + getVisitStatus(beneficiaryVisitDetials: any) { + const status = { + statusCode: 0, + statusMessage: '', + }; + + if (beneficiaryVisitDetials.lab_technician_flag === 2) { + status.statusCode = 10; + status.statusMessage = + this.currentLanguageSet.alerts.info.fetosenseTest_pending; + } else if ( + beneficiaryVisitDetials.doctorFlag === 2 || + beneficiaryVisitDetials.nurseFlag === 2 + ) { + status.statusMessage = + this.currentLanguageSet.alerts.info.pendingforLabtestResult; + status.statusCode = 2; + } else if (beneficiaryVisitDetials.specialist_flag === 1) { + status.statusMessage = + this.currentLanguageSet.common.pendingForConsultation; + status.statusCode = 1; + } else if (beneficiaryVisitDetials.specialist_flag === 2) { + status.statusMessage = + this.currentLanguageSet.alerts.info.pendingforLabtestResult; + status.statusCode = 2; + } else if (beneficiaryVisitDetials.lab_technician_flag === 3) { + status.statusCode = 11; + status.statusMessage = + this.currentLanguageSet.alerts.info.fetosenseTest_done; + } else if (beneficiaryVisitDetials.specialist_flag === 3) { + status.statusMessage = this.currentLanguageSet.alerts.info.labtestDone; + status.statusCode = 3; + } else if (beneficiaryVisitDetials.specialist_flag === 9) { + status.statusMessage = 'Consultation done'; + status.statusCode = 9; + } + return status; + } + + navigateToTeleMedicine() { + this.telemedicineService.routeToTeleMedecine(); + } + + cancelTCRequest(beneficiary: any) { + this.confirmationService + .confirm( + 'info', + this.currentLanguageSet.alerts.info.cancelReq, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.doctorService + .cancelBeneficiaryTCRequest({ + benflowID: beneficiary.benFlowID, + benRegID: beneficiary.beneficiaryRegID, + visitCode: beneficiary.visitCode, + userID: beneficiary.tCSpecialistUserID, + modifiedBy: localStorage.getItem('userName'), + }) + .subscribe( + (res: any) => { + if (res && res.statusCode && res.data) { + this.confirmationService.alert(res.data.response, 'success'); + this.reLoadWorklist(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + }); + } + ngDoCheck() { + this.assignSelectedLanguage(); + if ( + this.currentLanguageSet !== undefined && + this.currentLanguageSet !== null && + this.beneficiaryMetaData !== undefined && + this.beneficiaryMetaData !== null + ) { + this.beneficiaryMetaData.map((item: any) => { + const temp = this.getVisitStatus(item); + item.statusMessage = temp.statusMessage; + item.statusCode = temp.statusCode; + }); + } + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.currentLanguageSet = getLanguageJson.currentLanguageObject; + } +} diff --git a/src/app/app-modules/nurse-doctor/workarea/workarea-can-activate.service.ts b/src/app/app-modules/nurse-doctor/workarea/workarea-can-activate.service.ts new file mode 100644 index 0000000..d915dda --- /dev/null +++ b/src/app/app-modules/nurse-doctor/workarea/workarea-can-activate.service.ts @@ -0,0 +1,64 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { Injectable } from '@angular/core'; +import { CanActivate } from '@angular/router'; + +@Injectable() +export class WorkareaCanActivate implements CanActivate { + constructor() {} + + canActivate() { + const visitCategory = localStorage.getItem('visitCategory'); + if (visitCategory) { + if ( + !( + localStorage.getItem('visitCode') && + localStorage.getItem('beneficiaryGender') && + localStorage.getItem('benFlowID') && + localStorage.getItem('visitCategory') && + localStorage.getItem('beneficiaryRegID') && + localStorage.getItem('visitID') && + localStorage.getItem('beneficiaryID') && + localStorage.getItem('nurseFlag') + ) + ) { + return false; + } else { + return true; + } + } else { + if ( + !( + localStorage.getItem('beneficiaryGender') && + localStorage.getItem('beneficiaryRegID') && + localStorage.getItem('beneficiaryID') && + localStorage.getItem('benFlowID') + ) + ) { + return false; + } else { + return true; + } + } + } +} diff --git a/src/app/app-modules/nurse-doctor/workarea/workarea.component.css b/src/app/app-modules/nurse-doctor/workarea/workarea.component.css new file mode 100644 index 0000000..0cd1b7a --- /dev/null +++ b/src/app/app-modules/nurse-doctor/workarea/workarea.component.css @@ -0,0 +1,107 @@ +.stepper { + margin-bottom: 100px; +} + +.mat-stepper-horizontal { + padding: 0px; + background: #f2f2f0 !important; +} + +.mat-horizontal-stepper-header-container { + background: #f2f2f0 !important; +} + +.step-btn button { + float: right; + margin-left: 5px; +} + +mat-card { + min-height: 425px; +} + +.example-sidenav-fab-container { + width: 100%; + overflow: auto; +} + +.example-sidenav-fab-container mat-sidenav { + max-width: 250px; +} + +.example-sidenav-fab-container .mat-sidenav-content, .example-sidenav-fab-container mat-sidenav { + display: flex; +} + +.example-scrolling-content { + flex: auto; + /* overflow: auto; */ + background: #f2f2f0 !important; + min-height: 500px; +} + +.sidenav { + padding: 20px; +} + +.content { + padding: 20px 0px; +} + +.example-fab.mat-mini-fab { + position: fixed; + left: 20px; + bottom: 50px; + z-index: 3; +} + +.previousIcon { + position: fixed; + left: 65px; + bottom: 50px; + z-index: 3; + height: 40px; + width: 40px; +} +@media only screen and (max-width: 700px) { + .container-fluid { + padding: 0px !important; + } + + .example-sidenav-fab-container{ + height: stretch; + } + + .example-sidenav-fab-container mat-sidenav { + max-width: unset; + width: 50%; + } + + .example-sidenav-fab-container .content { + height: stretch; + } +} + +.m-b-40{ + margin-bottom: 40px; +} + +.overlay { + height: 100%; + width: 100%; + display: flex; + align-items: center; + justify-content: center; + position: fixed; + z-index: 1001; + /* Sit on top */ + left: 0; + top: 0; + background-color: rgb(0, 0, 0); + /* Black fallback color */ + background-color: rgba(0, 0, 0, 0.3); + /* Black w/opacity */ +} +.overlay:root { + padding: 0px; +} \ No newline at end of file diff --git a/src/app/app-modules/nurse-doctor/workarea/workarea.component.html b/src/app/app-modules/nurse-doctor/workarea/workarea.component.html new file mode 100644 index 0000000..209aa63 --- /dev/null +++ b/src/app/app-modules/nurse-doctor/workarea/workarea.component.html @@ -0,0 +1,538 @@ +
+
+
+ +
+
+ + + + +
+ +
+
+
+
+ + + +
+
+
+
diff --git a/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts b/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts new file mode 100644 index 0000000..9771e7f --- /dev/null +++ b/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts @@ -0,0 +1,3864 @@ +/* + * AMRIT � Accessible Medical Records via Integrated Technology + * Integrated EHR (Electronic Health Records) Solution + * + * Copyright (C) "Piramal Swasthya Management and Research Institute" + * + * This file is part of AMRIT. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/. + */ + +import { + Component, + OnInit, + ViewChild, + ChangeDetectorRef, + DoCheck, + OnDestroy, + AfterViewChecked, +} from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { FormGroup, FormBuilder, FormArray } from '@angular/forms'; + +import { + NurseService, + DoctorService, + MasterdataService, +} from '../shared/services'; +import { ConfirmationService } from '../../core/services/confirmation.service'; +import { BeneficiaryDetailsService } from '../../core/services/beneficiary-details.service'; +import { + CancerUtils, + GeneralUtils, + QuickConsultUtils, + VisitDetailUtils, + NCDScreeningUtils, +} from '../shared/utility'; +import { CanComponentDeactivate } from '../../core/services/can-deactivate-guard.service'; +import { SpecialistLoginComponent } from '../../core/components/specialist-login/specialist-login.component'; +import { IdrsscoreService } from '../shared/services/idrsscore.service'; +import { RegistrarService } from '../../registrar/shared/services/registrar.service'; +import { Observable, Subscription, of } from 'rxjs'; +import { HttpServiceService } from '../../core/services/http-service.service'; +import { MatSnackBar, MatSnackBarRef } from '@angular/material/snack-bar'; +import { MatDialog } from '@angular/material/dialog'; +import { SetLanguageComponent } from '../../core/components/set-language.component'; +import { environment } from 'src/environments/environment'; +import { HealthIdDisplayModalComponent } from '../../core/components/health-id-display-modal/health-id-display-modal.component'; +import { OpenPreviousVisitDetailsComponent } from '../../core/components/open-previous-visit-details/open-previous-visit-details.component'; + +@Component({ + selector: 'app-workarea', + templateUrl: './workarea.component.html', + styleUrls: ['./workarea.component.css'], +}) +export class WorkareaComponent + implements + OnInit, + CanComponentDeactivate, + DoCheck, + OnDestroy, + AfterViewChecked +{ + @ViewChild('sidenav') + sidenav: any; + + visitMode!: string; + ancMode!: string; + pncMode!: string; + vitalsMode!: string; + historyMode!: string; + examinationMode!: string; + caseRecordMode!: string; + referMode!: string; + ncdScreeningMode!: string; + quickConsultMode!: string; + newLookupMode!: boolean; + + visitCategory: any; + visitCategoryList: any; + enableIDRSUpdate = true; + findings: any; + currentVitals: any; + imageCords: Array = []; + pregnancyStatus: any; + primeGravidaStatus: any; + beneficiary: any; + beneficiaryRegID: any; + visitID: any; + + showHistory = false; + showVitals = false; + showQuickConsult = false; + showAnc = false; + showExamination = false; + showNCDScreening = false; + showPNC = false; + showCaseRecord = false; + showRefer = false; + + doctorFlag: any; + nurseFlag: any; + specialistFlag: any; + patientMedicalForm!: FormGroup; + + tm = false; + current_language_set: any; + attendant: any; + designation: any; + scoreFlag: any; + diabetesSelected: any = 0; + visualAcuityMandatory: any; + rbsPresent: any = 0; + visualAcuityPresent: any = 0; + heamoglobinPresent: any = 0; + ncdTemperature = false; + ismmutc!: string; + beneficiaryAge!: number; + confirmedDiseases: any; + vitalsRBSTestResults!: boolean; + rbsPresentSubscription: Subscription = new Subscription(); + visualAcuitySubscription: Subscription = new Subscription(); + hemoglobinSubscription: Subscription = new Subscription(); + diabetesSubscription: Subscription = new Subscription(); + ncdTemperatureSubscription: Subscription = new Subscription(); + visualAcuityMandatorySubscription: Subscription = new Subscription(); + mmuReferredSubscription: Subscription = new Subscription(); + enableVitalsButtonSubscription: Subscription = new Subscription(); + enableUpdateButtonInVitals = false; + enableCovidVaccinationSaveButton = false; + testsPrescribed: any; + disableSubmitButton = false; + showProgressBar = false; + enableLungAssessment = false; + enableProvisionalDiag = false; + + constructor( + private router: Router, + private fb: FormBuilder, + private changeDetectorRef: ChangeDetectorRef, + private masterdataService: MasterdataService, + private nurseService: NurseService, + private confirmationService: ConfirmationService, + private doctorService: DoctorService, + private route: ActivatedRoute, + public httpServiceService: HttpServiceService, + private beneficiaryDetailsService: BeneficiaryDetailsService, + private mdDialog: MatDialog, + private snackBar: MatSnackBar, + private idrsScoreService: IdrsscoreService, + private registrarService: RegistrarService, + ) {} + isSpecialist = false; + doctorSaveAndTCSave: any; + doctorUpdateAndTCSubmit: any; + isDoctorUpdate = false; + isDoctorSave = false; + serviceType: any; + ngOnInit() { + this.enableUpdateButtonInVitals = false; + this.enableCovidVaccinationSaveButton = false; + this.ncdTemperature = false; + this.enableProvisionalDiag = false; + this.enableLungAssessment = false; + this.nurseService.clearNCDTemp(); + this.nurseService.clearEnableLAssessment(); + this.nurseService.clearNCDScreeningProvision(); + this.ncdTemperatureSubscription = this.nurseService.ncdTemp$.subscribe( + (response) => + response === undefined + ? (this.ncdTemperature = false) + : (this.ncdTemperature = response), + ); + this.nurseService.enableLAssessment$.subscribe((response) => { + if (response === true) { + this.enableLungAssessment = true; + } else { + this.enableLungAssessment = false; + } + }); + this.nurseService.enableProvisionalDiag$.subscribe((response) => { + if (response === true) { + this.enableProvisionalDiag = true; + } else { + this.enableProvisionalDiag = false; + } + }); + this.attendant = this.route.snapshot.params['attendant']; + this.designation = localStorage.getItem('designation'); + this.visitCategory = localStorage.getItem('visitCategory'); + this.serviceType = localStorage.getItem('serviceName'); + + this.schedulerFormData = null; + this.tm = true; + const disableFlag = this.visitCategory ? true : false; + this.beneficiaryRegID = localStorage.getItem('beneficiaryRegID'); + this.visitID = localStorage.getItem('visitID'); + this.nurseFlag = localStorage.getItem('nurseFlag'); + this.doctorFlag = localStorage.getItem('doctorFlag'); + this.specialistFlag = localStorage.getItem('specialist_flag'); + this.rbsPresentSubscription = + this.idrsScoreService.rBSPresentFlag$.subscribe( + (response) => (this.rbsPresent = response), + ); + this.visualAcuitySubscription = + this.idrsScoreService.visualAcuityPresentFlag$.subscribe( + (response) => (this.visualAcuityPresent = response), + ); + this.hemoglobinSubscription = + this.idrsScoreService.heamoglobinPresentFlag$.subscribe( + (response) => (this.heamoglobinPresent = response), + ); + this.diabetesSubscription = + this.idrsScoreService.diabetesSelectedFlag$.subscribe( + (response) => (this.diabetesSelected = response), + ); + this.visualAcuityMandatorySubscription = + this.idrsScoreService.VisualAcuityTestMandatoryFlag$.subscribe( + (response) => (this.visualAcuityMandatory = response), + ); // if rbs test value > 200 + this.assignSelectedLanguage(); + this.patientMedicalForm = this.fb.group({ + patientVisitForm: new VisitDetailUtils(this.fb).createPatientVisitForm( + disableFlag, + ), + }); + this.setVitalsUpdateButtonValue(); + this.getBeneficiaryDetails(); + this.getVisitReasonAndCategory(); + this.getVisitType(); + this.getPregnancyStatus(); + } + setVitalsUpdateButtonValue() { + this.enableVitalsButtonSubscription = + this.doctorService.enableVitalsUpdateButton$.subscribe((response) => + response === undefined + ? (this.enableUpdateButtonInVitals = false) + : (this.enableUpdateButtonInVitals = response), + ); + } + + ngDoCheck() { + this.assignSelectedLanguage(); + } + assignSelectedLanguage() { + const getLanguageJson = new SetLanguageComponent(this.httpServiceService); + getLanguageJson.setLanguage(); + this.current_language_set = getLanguageJson.currentLanguageObject; + if ( + this.current_language_set !== undefined && + this.current_language_set !== null + ) { + this.setValues(); + } + } + + setValues() { + if (this.schedulerButton !== 'View ' + this.serviceType + ' Schedule') { + this.schedulerButton = + this.current_language_set.common.scheduleforTM + ' ' + this.serviceType; + } + if (this.attendant === 'tcspecialist') { + this.isSpecialist = true; + if (this.doctorFlag === 1) { + if (this.specialistFlag === 1) { + this.doctorSaveAndTCSave = this.current_language_set.common.submit; + this.isDoctorSave = true; + console.log( + 'here for submit' + this.current_language_set.common.submit, + ); + } else if (this.specialistFlag === 3) { + this.doctorUpdateAndTCSubmit = + this.current_language_set.common.update; + this.isDoctorUpdate = true; + console.log( + 'here for update' + this.current_language_set.common.update, + ); + } + } else { + this.isDoctorUpdate = true; + if (this.specialistFlag === 1) { + this.doctorUpdateAndTCSubmit = + this.current_language_set.common.submit; + } else { + this.doctorUpdateAndTCSubmit = + this.current_language_set.common.update; + console.log( + 'here for update' + this.current_language_set.common.update, + ); + } + } + } else { + this.isSpecialist = false; + if (this.doctorFlag === 1) { + this.isDoctorSave = true; + this.doctorSaveAndTCSave = this.current_language_set.common.submit; + } else { + this.doctorUpdateAndTCSubmit = this.current_language_set.common.update; + console.log( + 'here for update' + this.current_language_set.common.update, + ); + this.isDoctorUpdate = true; + } + } + } + + checkMandatory() { + if (this.visitCategory === null || this.visitCategory === undefined) { + this.confirmationService.alert( + this.current_language_set.alerts.info.proceedFurther, + ); + } + if ( + this.nurseService.fileData !== undefined && + this.nurseService.fileData.length > 0 + ) { + this.confirmationService.alert( + this.current_language_set.common.Kindlyuploadthefiles, + ); + this.nurseService.fileData = null; + } + } + + getVisitType() { + if (this.visitCategory) { + this.handleVisitType(this.visitCategory, 'view'); + this.newLookupMode = false; + } else { + this.newLookupMode = true; + const fG: FormGroup = ( + this.patientMedicalForm.controls['patientVisitForm'] + ); + (fG.controls['patientVisitDetailsForm']).controls[ + 'visitCategory' + ].valueChanges.subscribe((categoryValue) => { + if (categoryValue) { + console.log(categoryValue, 'categoryValue'); + this.schedulerData = null; + this.schedulerFormData = null; + + this.schedulerButton = + this.current_language_set.common.scheduleforTM + + ' ' + + this.serviceType; + this.masterdataService.reset(); + this.visitCategory = categoryValue; + this.getNurseMasterData(categoryValue); + this.handleVisitType(categoryValue); + } + }); + } + } + + handleVisitType(categoryValue: any, mode?: string) { + if (categoryValue) { + this.hideAll(); + + if (categoryValue === 'General OPD (QC)') { + if (mode) { + this.patientMedicalForm.addControl( + 'patientQuickConsultForm', + new QuickConsultUtils(this.fb).createQuickConsultForm(), + ); + this.visitMode = String(mode); + this.showQuickConsult = true; + this.quickConsultMode = String(mode); + } else { + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + this.showVitals = true; + } + } else if (categoryValue === 'Cancer Screening') { + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new CancerUtils(this.fb).createNurseCancerHistoryForm(), + ); + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new CancerUtils(this.fb).createNurseCancerPatientVitalsForm(), + ); + this.patientMedicalForm.addControl( + 'patientExaminationForm', + new CancerUtils(this.fb).createCancerExaminationForm(), + ); + + this.getCurrentVitals(); + + this.showHistory = true; + this.showVitals = true; + this.showExamination = true; + + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new CancerUtils(this.fb).createCancerDiagnosisForm(), + ); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + + this.patchCancerFindings(); + + this.visitMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + this.examinationMode = String(mode); + + this.showCaseRecord = true; + this.showRefer = true; + } + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } else if (categoryValue === 'General OPD') { + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new GeneralUtils(this.fb).createGeneralHistoryForm(false), + ); + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + this.patientMedicalForm.addControl( + 'patientExaminationForm', + new GeneralUtils(this.fb).createPatientExaminationForm(), + ); + + this.getCurrentVitals(); + + this.showHistory = true; + this.showVitals = true; + this.showExamination = true; + + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new GeneralUtils(this.fb).createGeneralCaseRecord(), + ); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + + this.patchGeneralFinding(); + + this.visitMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + this.examinationMode = String(mode); + + this.showCaseRecord = true; + this.showRefer = true; + } + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } else if (categoryValue === 'NCD screening') { + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new GeneralUtils(this.fb).createNCDScreeningHistoryForm(), + ); + + this.getCurrentVitals(); + this.showNCDScreening = true; + this.showHistory = true; + this.showVitals = true; + + this.patientMedicalForm.addControl( + 'idrsScreeningForm', + new NCDScreeningUtils(this.fb).createIDRSForm(), + ); + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new GeneralUtils(this.fb).createNCDScreeningCaseRecord(), + ); + this.patchGeneralFinding(); + this.showCaseRecord = true; + this.visitMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + this.caseRecordMode = String(mode); + this.ncdScreeningMode = String(mode); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + this.showCaseRecord = true; + this.showRefer = true; + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } + } else if (categoryValue === 'PNC') { + this.patientMedicalForm.addControl( + 'patientPNCForm', + new GeneralUtils(this.fb).createPatientPNCForm(), + ); + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new GeneralUtils(this.fb).createGeneralHistoryForm(), + ); + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + this.patientMedicalForm.addControl( + 'patientExaminationForm', + new GeneralUtils(this.fb).createPatientExaminationForm(), + ); + + this.getCurrentVitals(); + + this.showPNC = true; + this.showHistory = true; + this.showVitals = true; + this.showExamination = true; + + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new GeneralUtils(this.fb).createPNCCaseRecord(), + ); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + + this.patchGeneralFinding(); + + this.visitMode = String(mode); + this.pncMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + this.examinationMode = String(mode); + + this.showCaseRecord = true; + this.showRefer = true; + } + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } else if (categoryValue === 'ANC') { + this.patientMedicalForm.addControl( + 'patientANCForm', + new GeneralUtils(this.fb).createPatientANCForm(), + ); + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new GeneralUtils(this.fb).createGeneralHistoryForm(), + ); + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + this.patientMedicalForm.addControl( + 'patientExaminationForm', + new GeneralUtils(this.fb).createPatientExaminationForm(), + ); + + this.getCurrentVitals(); + this.patchLMPDate(); + this.getPrimeGravidaStatus(); + this.patchGravidaValue(); + + this.showAnc = true; + this.showHistory = true; + this.showVitals = true; + this.showExamination = true; + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new GeneralUtils(this.fb).createANCCaseRecord(), + ); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + + this.patchGeneralFinding(); + this.getANCDiagnosis(); + + this.visitMode = String(mode); + this.ancMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + this.examinationMode = String(mode); + + this.showCaseRecord = true; + this.showRefer = true; + } + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } else if (categoryValue === 'COVID-19 Screening') { + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new GeneralUtils(this.fb).createGeneralHistoryForm(false), + ); + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + + this.getCurrentVitals(); + + this.showHistory = true; + this.showVitals = true; + + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new GeneralUtils(this.fb).createCovidCaseRecord(), + ); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + + this.patchGeneralFinding(); + + this.visitMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + + this.showCaseRecord = true; + this.showRefer = true; + } + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } else if (categoryValue === 'NCD care') { + this.patientMedicalForm.addControl( + 'patientHistoryForm', + new GeneralUtils(this.fb).createGeneralHistoryForm(false), + ); + this.patientMedicalForm.addControl( + 'patientVitalsForm', + new GeneralUtils(this.fb).createGeneralVitalDetailsForm(), + ); + + this.getCurrentVitals(); + + this.showHistory = true; + this.showVitals = true; + + if (mode) { + this.patientMedicalForm.addControl( + 'patientCaseRecordForm', + new GeneralUtils(this.fb).createNCDCareCaseRecord(), + ); + this.patientMedicalForm.addControl( + 'patientReferForm', + new CancerUtils(this.fb).createCancerReferForm(), + ); + + this.patchGeneralFinding(); + + this.visitMode = String(mode); + this.vitalsMode = String(mode); + this.historyMode = String(mode); + + this.showCaseRecord = true; + this.showRefer = true; + } + + if (mode) { + this.referMode = String(mode); + this.caseRecordMode = String(mode); + } + } + } + } + + hideAll() { + this.patientMedicalForm.removeControl('patientHistoryForm'); + this.patientMedicalForm.removeControl('patientVitalsForm'); + this.patientMedicalForm.removeControl('patientExaminationForm'); + this.patientMedicalForm.removeControl('patientANCForm'); + this.patientMedicalForm.removeControl('patientCaseRecordForm'); + this.patientMedicalForm.removeControl('patientReferForm'); + this.patientMedicalForm.removeControl('NCDScreeningForm'); + this.patientMedicalForm.removeControl('idrsScreeningForm'); + + this.showQuickConsult = false; + this.showNCDScreening = false; + this.showAnc = false; + this.showHistory = false; + this.showVitals = false; + this.showExamination = false; + this.showPNC = false; + this.showCaseRecord = false; + this.showRefer = false; + + this.changeDetectorRef.detectChanges(); + } + + submitPatientMedicalDetailsForm(medicalForm: any) { + this.disableSubmitButton = true; + this.showProgressBar = true; + if (this.visitCategory === 'Cancer Screening') + this.submitNurseCancerVisitDetails(medicalForm); + + if (this.visitCategory === 'NCD screening') + this.submitNurseNCDScreeningVisitDetails(medicalForm); + + if (this.visitCategory === 'General OPD (QC)') + this.submitNurseQuickConsultVisitDetails(medicalForm); + + if (this.visitCategory === 'ANC') + this.submitNurseANCVisitDetails(medicalForm); + + if (this.visitCategory === 'PNC') + this.submitPatientMedicalDetailsPNC(medicalForm); + + if (this.visitCategory === 'General OPD') + this.submitNurseGeneralOPDVisitDetails(medicalForm); + + if (this.visitCategory === 'NCD care') + this.submitNurseNCDcareVisitDetails(medicalForm); + + if (this.visitCategory === 'COVID-19 Screening') + this.submitNurseCovidVisitDetails(medicalForm); + } + + removeBeneficiaryDataForNurseVisit() { + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('benFlowID'); + } + navigateToNurseWorklist() { + this.patientMedicalForm.reset(); + this.removeBeneficiaryDataForNurseVisit(); + this.router.navigate(['/common/nurse-worklist']); + } + + checkForPrescribedTests(temp: any) { + const investigationForm = (( + this.patientMedicalForm.controls['patientCaseRecordForm'] + )).controls['generalDoctorInvestigationForm']; + this.testsPrescribed = + this.doctorService.postGeneralCaseRecordInvestigation( + investigationForm, + temp, + ); + console.log('testsPrescribed', this.testsPrescribed); + } + submitDoctorDiagnosisForm() { + this.disableSubmitButton = true; + this.showProgressBar = true; + if (this.visitCategory === 'Cancer Screening') + this.submitCancerDiagnosisForm(); + + if (this.visitCategory === 'General OPD (QC)') + this.submitQuickConsultDiagnosisForm(); + + if (this.visitCategory === 'ANC') this.submitANCDiagnosisForm(); + + if (this.visitCategory === 'PNC') this.submitPNCDiagnosisForm(); + + if (this.visitCategory === 'General OPD') + this.submitGeneralOPDDiagnosisForm(); + + if (this.visitCategory === 'NCD care') this.submitNCDCareDiagnosisForm(); + if (this.visitCategory === 'COVID-19 Screening') + this.submitCovidDiagnosisForm(); + if (this.visitCategory === 'NCD screening') + this.submitNCDScreeningDiagnosisForm(); + } + submitNCDScreeningDiagnosisForm() { + console.log('patientMedicalForm', this.patientMedicalForm); + if (this.checkNCDScreeningRequiredData(this.patientMedicalForm)) { + const temp = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + visitCode: localStorage.getItem('visitCode'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + }; + + this.checkForPrescribedTests(temp); + this.doctorService + .postDoctorNCDScreeningDetails( + this.patientMedicalForm, + temp, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + const idrsFormDetails = ( + this.patientMedicalForm.controls['idrsScreeningForm'] + ); + this.doctorService + .updateIDRSDetails(idrsFormDetails, this.visitCategory) + .subscribe( + (res) => { + console.log('updated Idrs value in diagnosis', res); + }, + (err) => { + console.log(err, 'error'); + }, + ); + console.log( + 'IDRS', + ( + this.patientMedicalForm.controls['idrsScreeningForm'].value + ), + ); + this.patientMedicalForm.reset(); + sessionStorage.removeItem('instFlag'); + sessionStorage.removeItem('suspectFlag'); + if (this.isSpecialist) { + this.linkCareContextBasedOnSpecialistScheduled(); + } else { + this.linkCareContextBasedOnTestsPrescribed(); + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + removeBeneficiaryDataForDoctorVisit() { + localStorage.removeItem('visitCode'); + localStorage.removeItem('beneficiaryGender'); + localStorage.removeItem('benFlowID'); + localStorage.removeItem('visitCategory'); + localStorage.removeItem('beneficiaryRegID'); + localStorage.removeItem('visitID'); + localStorage.removeItem('beneficiaryID'); + localStorage.removeItem('doctorFlag'); + localStorage.removeItem('nurseFlag'); + localStorage.removeItem('pharmacist_flag'); + } + + updateDoctorDiagnosisForm() { + this.disableSubmitButton = true; + this.showProgressBar = true; + const visitCategory = localStorage.getItem('visitCategory'); + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const vanID = JSON.parse(serviceLineDetails).vanID; + const parkingPlaceID = JSON.parse(serviceLineDetails).parkingPlaceID; + const otherDetails = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + sessionID: localStorage.getItem('sessionID'), + beneficiaryID: localStorage.getItem('beneficiaryID'), + parkingPlaceID: parkingPlaceID, + vanID: vanID, + visitCode: localStorage.getItem('visitCode'), + serviceID: localStorage.getItem('serviceID'), + benFlowID: localStorage.getItem('benFlowID'), + isSpecialist: this.isSpecialist, + }; + + if (visitCategory === 'Cancer Screening') { + if (this.checkCancerRequiredData(this.patientMedicalForm)) { + this.doctorService + .saveSpecialistCancerObservation( + this.patientMedicalForm, + otherDetails, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.patientMedicalForm.reset(); + if (this.isSpecialist) { + this.getHealthIDDetails(res.data.response); + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } else if (visitCategory === 'NCD screening') { + if (this.checkNCDScreeningRequiredData(this.patientMedicalForm)) { + this.checkForPrescribedTests(otherDetails); + this.doctorService + .updateDoctorDiagnosisDetails( + this.patientMedicalForm, + visitCategory, + otherDetails, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + const idrsFormDetails = ( + this.patientMedicalForm.controls['idrsScreeningForm'] + ); + this.doctorService + .updateIDRSDetails(idrsFormDetails, this.visitCategory) + .subscribe( + (res) => { + console.log('updated Idrs value in diagnosis', res); + }, + (err) => { + console.log(err, 'error'); + }, + ); + this.patientMedicalForm.reset(); + sessionStorage.removeItem('instFlag'); + sessionStorage.removeItem('suspectFlag'); + if (this.isSpecialist) { + if ( + this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0 + ) { + this.confirmationService.alert( + res.data.response, + 'success', + ); + this.navigateToSpecialistWorklist(); + } else { + this.getHealthIDDetails(res.data.response); + } + } else { + if ( + (this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0) || + (this.schedulerData !== undefined && + this.schedulerData !== null) + ) { + this.confirmationService.alert( + res.data.response, + 'success', + ); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails(res.data.response); + } + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } else { + if (this.checkNurseRequirements(this.patientMedicalForm)) { + this.checkForPrescribedTests(otherDetails); + this.doctorService + .updateDoctorDiagnosisDetails( + this.patientMedicalForm, + visitCategory, + otherDetails, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + if ( + this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0 + ) { + this.confirmationService.alert( + res.data.response, + 'success', + ); + this.navigateToSpecialistWorklist(); + } else { + this.getHealthIDDetails(res.data.response); + } + } else { + if ( + (this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0) || + (this.schedulerData !== undefined && + this.schedulerData !== null) + ) { + this.confirmationService.alert( + res.data.response, + 'success', + ); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails(res.data.response); + } + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + } + + /** + * Submit Nurse Cancer Details + */ + submitNurseCancerVisitDetails(medicalForm: any) { + if (this.checkCancerRequiredData(medicalForm)) { + // check if the form is valid + const imageCoordiantes = this.getImageCoordinates(medicalForm); + + this.confirmationService + .confirm( + `info`, + this.current_language_set.alerts.info.doctorVisit, + 'Yes', + 'No', + ) + .subscribe((result) => { + if (result !== undefined && result !== null) + this.nurseService + .postNurseCancerVisitForm( + medicalForm, + imageCoordiantes, + result, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info + .datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else if (res.statusCode === 9999) { + this.navigateToNurseWorklist(); + this.confirmationService.alert(res.errorMessage, 'info'); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + }); + } + } + resetSpinnerandEnableTheSubmitButton() { + this.disableSubmitButton = false; + this.showProgressBar = false; + } + getImageCoordinates(patientMedicalForm: any) { + const serviceLineDetails: any = localStorage.getItem('serviceLineDetails'); + const imageCords = []; + const image1 = (( + (patientMedicalForm.controls.patientExaminationForm).controls[ + 'oralExaminationForm' + ] + )).controls['image'].value; + if (image1) + imageCords.push( + Object.assign(image1, { + vanID: JSON.parse(serviceLineDetails).vanID, + parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + }), + ); + const image2 = (( + (patientMedicalForm.controls.patientExaminationForm).controls[ + 'abdominalExaminationForm' + ] + )).controls['image'].value; + if (image2) + imageCords.push( + Object.assign(image2, { + vanID: JSON.parse(serviceLineDetails).vanID, + parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + }), + ); + const image3 = (( + (patientMedicalForm.controls.patientExaminationForm).controls[ + 'gynecologicalExaminationForm' + ] + )).controls['image'].value; + if (image3) + imageCords.push( + Object.assign(image3, { + vanID: JSON.parse(serviceLineDetails).vanID, + parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + }), + ); + const image4 = (( + (patientMedicalForm.controls.patientExaminationForm).controls[ + 'breastExaminationForm' + ] + )).controls['image'].value; + if (image4) + imageCords.push( + Object.assign(image4, { + vanID: JSON.parse(serviceLineDetails).vanID, + parkingPlaceID: JSON.parse(serviceLineDetails).parkingPlaceID, + }), + ); + + return imageCords; + } + + /** + * Submit Doctor Cancer Details + */ + submitCancerDiagnosisForm() { + if (this.checkCancerRequiredData(this.patientMedicalForm)) { + // check if the form is valid + this.doctorService + .postDoctorCancerVisitDetails( + this.patientMedicalForm, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } else { + if ( + this.schedulerData !== undefined && + this.schedulerData !== null + ) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + /* If RBS score more than 200, then Visual Acuity test is mandatory */ + visualAcuityTestValidation(caseRecordForm: any, required: any) { + if ( + this.visualAcuityPresent > 0 && + this.idrsScoreService.visualAcuityTestInMMU !== 0 && + this.visualAcuityMandatory > 0 + ) { + let investigationVisualCount = 0; + const labTestArray = + caseRecordForm.controls['generalDoctorInvestigationForm'].value.labTest; + if ( + labTestArray !== undefined && + labTestArray !== null && + labTestArray.length > 0 + ) { + labTestArray.forEach((element: any) => { + if ( + element.procedureName !== null && + element.procedureName.toLowerCase() === + environment.visualAcuityTest.toLowerCase() + ) { + investigationVisualCount++; + } + }); + } + + if (investigationVisualCount === 0) { + required.push( + this.current_language_set.pleaseSelectVisualAcuityTestInInvestigation, + ); + } + } + } + checkNurseRequirements(medicalForm: any) { + const vitalsForm = medicalForm.controls['patientVitalsForm']; + const covidForm = medicalForm.controls['patientVisitForm']; + const referForm = medicalForm.controls['patientReferForm']; + const covidForm2 = covidForm.controls['patientCovidForm']; + const historyForm = medicalForm.controls['patientHistoryForm']; + const caseRecordForm = ( + medicalForm.controls['patientCaseRecordForm'] + ); + + console.log('medicalForm', medicalForm); + + const examinationForm = ( + this.patientMedicalForm.controls['patientExaminationForm'] + ); + const pncForm = ( + this.patientMedicalForm.controls['patientPNCForm'] + ); + const ancForm = ( + this.patientMedicalForm.controls['patientANCForm'] + ); + const required = []; + if (environment.isTMOffline) { + if ( + this.enableLungAssessment === true && + this.beneficiaryAge >= 18 && + this.nurseService.isAssessmentDone === false + ) { + required.push('Please perform Lung Assessment'); + } + } + + console.log('pncForm', pncForm); + if (this.visitCategory === 'PNC') { + if (pncForm.controls['deliveryPlace'].errors) { + required.push(this.current_language_set.pncData.placeofDelivery); + } + if (pncForm.controls['deliveryType'].errors) { + required.push(this.current_language_set.pncData.typeofDelivery); + } + } + if (this.visitCategory === 'General OPD' && this.attendant === 'doctor') { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['generalDiagnosisForm']; + const diagForm2 = ( + diagForm1.controls['provisionalDiagnosisList'] + ); + const diagForm3 = diagForm2.controls[0]; + if (diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + } + + if ( + this.visitCategory !== 'General OPD (QC)' && + this.visitCategory !== 'NCD screening' + ) { + const pregForm = medicalForm.controls['patientHistoryForm']; + const pregForm1 = pregForm.controls['pastObstericHistory']; + const pregForm2 = ( + pregForm1.controls['pastObstericHistoryList'] + ); + if (this.attendant === 'nurse') { + if (pregForm2.controls) { + const score1 = Number(pregForm2.controls['length']); + for (let i = 0; i < score1; i++) { + const pregForm3 = pregForm2.controls[i]; + if ( + pregForm3.controls['pregOutcome'].value && + pregForm3.controls['pregOutcome'].value.pregOutcome === 'Abortion' + ) { + if ( + pregForm3.controls['abortionType'].value && + pregForm3.controls['abortionType'].value.complicationValue === + 'Induced' && + pregForm3.controls['typeofFacility'].errors + ) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.typeofFacility + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + if (pregForm3.controls['postAbortionComplication'].errors) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.complicationPostAbortion + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + if (pregForm3.controls['abortionType'].errors) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.typeOfAbortion + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + if (pregForm3.controls['pregDuration'].errors) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.noOfcompletedWeeks + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + } + } + } + } + } + + if ( + this.visitCategory === 'General OPD' && + this.designation === 'TC Specialist' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['generalDiagnosisForm']; + const diagForm2 = ( + diagForm1.controls['provisionalDiagnosisList'] + ); + const diagForm3 = diagForm2.controls[0]; + + if (diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + } + if (this.visitCategory === 'PNC' && this.attendant === 'doctor') { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['generalDiagnosisForm']; + const diagForm2 = ( + diagForm1.controls['provisionalDiagnosisList'] + ); + + const diagForm3 = diagForm2.controls[0]; + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + + const confirmatorydiagForm = ( + diagForm1.controls['confirmatoryDiagnosisList'] + ); + + confirmatorydiagForm.value.filter((item: any) => { + if ( + item.viewConfirmatoryDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set.confirmatoryDiagnosisIsNotValid, + ); + }); + } + if (this.visitCategory === 'PNC' && this.designation === 'TC Specialist') { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['generalDiagnosisForm']; + const diagForm2 = ( + diagForm1.controls['provisionalDiagnosisList'] + ); + const diagForm3 = diagForm2.controls[0]; + if (diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + + const confirmatorydiagForm = ( + diagForm1.controls['confirmatoryDiagnosisList'] + ); + + confirmatorydiagForm.value.filter((item: any) => { + if ( + item.viewConfirmatoryDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set.confirmatoryDiagnosisIsNotValid, + ); + }); + } + if ( + this.visitCategory === 'Cancer Screening' && + this.attendant === 'doctor' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['diagnosisForm']; + + if (diagForm1.controls['provisionalDiagnosisPrimaryDoctor'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + } + if ( + this.visitCategory === 'Cancer Screening' && + this.designation === 'TC Specialist' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['diagnosisForm']; + if (diagForm1.controls['provisionalDiagnosisPrimaryDoctor'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + } + console.log('attendant', this.attendant); + + if ( + this.visitCategory === 'COVID-19 Screening' && + this.attendant === 'doctor' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['generalDiagnosisForm']; + console.log('diag', diagForm1); + if (diagForm1.controls['doctorDiagnosis'].errors) { + required.push(this.current_language_set.doctorDiagnosis); + } + } + + if (this.visitCategory === 'COVID-19 Screening') { + const historyForm = ( + this.patientMedicalForm.controls['patientHistoryForm'] + ); + console.log('HistoryForm', historyForm); + const historyForm2 = ( + historyForm.controls['comorbidityHistory'] + ); + const historyForm3 = ( + historyForm2.controls['comorbidityConcurrentConditionsList'] + ); + const historyForm4 = historyForm3.controls[0]; + if (covidForm2.controls['contactStatus'].errors) { + required.push(this.current_language_set.contactHistory); + } + + if (covidForm2.controls['travelStatus'].errors) { + required.push(this.current_language_set.covid.travelHistory); + } + if (covidForm2.controls['symptom'].errors) { + required.push( + this.current_language_set.ExaminationData.cancerScreeningExamination + .symptoms.symptoms, + ); + } + /* if(historyForm.controls[0].errors){ + required.push("Comorbid"); + }*/ + if (historyForm4.controls['comorbidConditions'].errors) { + required.push( + this.current_language_set.historyData.ancHistory + .combordityANC_OPD_NCD_PNC.comorbidConditions, + ); + } + /* if(historyForm5.controls["comorbidConditions"].errors){ + required.push("Comorbid conditions"); + }*/ + /* if(historyForm2.controls["timePeriodAgo"].errors){ + required.push("Comorbid conditions Duration"); + } + if(historyForm2.controls["timePeriodUnit"].errors){ + required.push("Comorbid conditions Duration Unit"); + }*/ + } + if (this.visitCategory === 'ANC') { + const ancdetailsForm = ( + ancForm.controls['patientANCDetailsForm'] + ); + if (ancdetailsForm.controls['primiGravida'].errors) { + required.push( + this.current_language_set.ancData.ancDataDetails.primiGravida, + ); + } + if (ancdetailsForm.controls['lmpDate'].errors) { + required.push( + this.current_language_set.ancData.ancDataDetails.lastMenstrualPeriod, + ); + } + if (this.attendant === 'doctor' || this.designation === 'TC Specialist') { + const ANCCaseRecordForm = ( + medicalForm.controls['patientCaseRecordForm'] + ); + const ANCVitalsForm = ( + medicalForm.controls['patientVitalsForm'] + ); + console.log('ANCCaseRecordForm', ANCVitalsForm); + if (this.rbsPresent > 0) { + let investigationCount = 0; + const labTestArray = + ANCCaseRecordForm.controls['generalDoctorInvestigationForm'].value + .labTest; + if ( + labTestArray !== undefined && + labTestArray !== null && + labTestArray.length > 0 + ) { + labTestArray.forEach((element: any) => { + if ( + element.procedureName !== null && + element.procedureName.toLowerCase() === + environment.RBSTest.toLowerCase() + ) { + investigationCount++; + } + }); + } + + if ( + investigationCount === 0 && + ANCVitalsForm.controls['rbsTestResult'].value === null + ) { + required.push( + this.current_language_set.pleaseSelectRBSTestInInvestigation, + ); + } + } + if (this.heamoglobinPresent > 0) { + let investigationCount = 0; + const labTestArray = + ANCCaseRecordForm.controls['generalDoctorInvestigationForm'].value + .labTest; + if ( + labTestArray !== undefined && + labTestArray !== null && + labTestArray.length > 0 + ) { + labTestArray.forEach((element: any) => { + if ( + element.procedureName !== null && + element.procedureName.toLowerCase() === + environment.haemoglobinTest.toLowerCase() + ) { + investigationCount++; + } + }); + } + + if (investigationCount === 0) { + required.push( + this.current_language_set + .pleaseSelectHeamoglobinTestInInvestigation, + ); + } + } + } + } + if ( + this.visitCategory !== 'General OPD (QC)' && + this.visitCategory !== 'NCD screening' + ) { + const personalHistory = historyForm.controls['personalHistory']; + const allergyList = personalHistory.value.allergicList; + + let snomedTermNotMapped = false; + + if (allergyList.length > 0) { + for (let i = 0; i < allergyList.length; i++) { + if (allergyList[i].allergyType !== null) { + if ( + allergyList[i].snomedCode === null && + allergyList[i].snomedTerm !== null + ) { + snomedTermNotMapped = true; + } else if ( + allergyList[i].snomedCode !== null && + allergyList[i].snomedTerm === null + ) { + snomedTermNotMapped = true; + } + } + } + } + + if (snomedTermNotMapped) { + required.push(this.current_language_set.allergyNameIsNotValid); + } + } + + if (vitalsForm !== undefined && vitalsForm !== null) { + if (vitalsForm.controls['systolicBP_1stReading'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .systolicBP, + ); + } + if (vitalsForm.controls['diastolicBP_1stReading'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .diastolicBP, + ); + } + if (vitalsForm.controls['height_cm'].errors) { + required.push( + this.current_language_set.vitalsDetails + .AnthropometryDataANC_OPD_NCD_PNC.height, + ); + } + if (vitalsForm.controls['weight_Kg'].errors) { + required.push(this.current_language_set.common.weight); + } + if (vitalsForm.controls['temperature'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .temperature, + ); + } + if (vitalsForm.controls['pulseRate'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .pulseRate, + ); + } + } + + console.log('referForm', referForm); + if (this.attendant === 'doctor' || this.designation === 'TC Specialist') { + if (referForm.controls['refrredToAdditionalServiceList'].value !== null) { + if ( + referForm.controls['refrredToAdditionalServiceList'].value.length > 0 + ) { + if (referForm.controls['referralReason'].errors) { + required.push( + this.current_language_set.Referdetails.referralReason, + ); + } + } else if ( + referForm.controls['referredToInstituteName'].value !== null + ) { + if (referForm.controls['referralReason'].errors) { + required.push( + this.current_language_set.Referdetails.referralReason, + ); + } + } + } else if (referForm.controls['referredToInstituteName'].value !== null) { + if (referForm.controls['referralReason'].errors) { + required.push(this.current_language_set.Referdetails.referralReason); + } + } + } + + console.log(examinationForm, 'examinationForm'); + if (examinationForm !== undefined && examinationForm !== null) { + const generalExaminationForm = ( + examinationForm.controls['generalExaminationForm'] + ); + if (generalExaminationForm.controls['typeOfDangerSigns'].errors) { + required.push( + this.current_language_set.ExaminationData.ANC_OPD_PNCExamination + .genExamination.dangersigns, + ); + } + if (generalExaminationForm.controls['lymphnodesInvolved'].errors) { + required.push( + this.current_language_set.ExaminationData.ANC_OPD_PNCExamination + .genExamination.lymph, + ); + } + if (generalExaminationForm.controls['typeOfLymphadenopathy'].errors) { + required.push( + this.current_language_set.ExaminationData.ANC_OPD_PNCExamination + .genExamination.typeofLymphadenopathy, + ); + } + if (generalExaminationForm.controls['extentOfEdema'].errors) { + required.push( + this.current_language_set.ExaminationData.ANC_OPD_PNCExamination + .genExamination.extentofEdema, + ); + } + if (generalExaminationForm.controls['edemaType'].errors) { + required.push( + this.current_language_set.ExaminationData.ANC_OPD_PNCExamination + .genExamination.typeofEdema, + ); + } + } + + this.mmuReferredSubscription = this.nurseService.ismmutc$.subscribe( + (response) => (this.ismmutc = response), + ); + + if ( + this.attendant === 'nurse' && + this.ismmutc === 'yes' && + !this.schedulerData + ) + required.push(this.current_language_set.nurseData.scheduleTM); + if (this.visitCategory === 'NCD care' && this.attendant === 'doctor') { + const diagnosisForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + if (diagnosisForm !== undefined) { + const diagnosisForm1 = ( + diagnosisForm.controls['generalDiagnosisForm'] + ); + if (diagnosisForm1 !== undefined) { + const temp = + diagnosisForm1.controls['ncdScreeningConditionArray'].value; + if (diagnosisForm1.controls['ncdScreeningConditionArray'].errors) { + required.push(this.current_language_set.casesheet.ncdCondition); + } + let flag = false; + + if (temp !== undefined && temp !== null && temp.length > 0) { + temp.forEach((element: any) => { + if (element === 'Other') flag = true; + }); + } + if ( + flag && + diagnosisForm1.controls['ncdScreeningConditionOther'].value === null + ) + required.push(this.current_language_set.nCDConditionOther); + } + } + } + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.belowFields, + required, + ); + this.resetSpinnerandEnableTheSubmitButton(); + return 0; + } else { + return 1; + } + } + + checkCancerRequiredData(medicalForm: any) { + const vitalsForm = medicalForm.controls['patientVitalsForm']; + const referForm = medicalForm.controls['patientReferForm']; + const required = []; + + console.log('medicalCancer', medicalForm); + + if (vitalsForm !== undefined && vitalsForm !== null) { + if (vitalsForm.controls['systolicBP_1stReading'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .systolicBP, + ); + } + if (vitalsForm.controls['diastolicBP_1stReading'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .diastolicBP, + ); + } + if (vitalsForm.controls['height_cm'].errors) { + required.push( + this.current_language_set.vitalsDetails + .AnthropometryDataANC_OPD_NCD_PNC.height, + ); + } + if (vitalsForm.controls['weight_Kg'].errors) { + required.push( + this.current_language_set.vitalsDetails + .AnthropometryDataANC_OPD_NCD_PNC.weight, + ); + } + } + + if ( + this.visitCategory === 'Cancer Screening' && + this.attendant === 'doctor' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + + if (diagForm.controls['provisionalDiagnosisPrimaryDoctor'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + } + + if ( + this.visitCategory === 'Cancer Screening' && + this.designation === 'TC Specialist' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + + if (diagForm.controls['provisionalDiagnosisPrimaryDoctor'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + } + + if (this.attendant === 'doctor' || this.designation === 'TC Specialist') { + if (referForm.controls['refrredToAdditionalServiceList'].value !== null) { + if ( + referForm.controls['refrredToAdditionalServiceList'].value.length > 0 + ) { + if (referForm.controls['referralReason'].errors) { + required.push( + this.current_language_set.Referdetails.referralReason, + ); + } + } else if (referForm.controls['referredToInstituteID'].value !== null) { + if (referForm.controls['referralReason'].errors) { + required.push( + this.current_language_set.Referdetails.referralReason, + ); + } + } + } else if (referForm.controls['referredToInstituteID'].value !== null) { + if (referForm.controls['referralReason'].errors) { + required.push(this.current_language_set.Referdetails.referralReason); + } + } + } + this.mmuReferredSubscription = this.nurseService.ismmutc$.subscribe( + (response) => (this.ismmutc = response), + ); + + if ( + this.attendant === 'nurse' && + this.ismmutc === 'yes' && + !this.schedulerData + ) + required.push(this.current_language_set.nurseData.scheduleTM); + + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.belowFields, + required, + ); + this.resetSpinnerandEnableTheSubmitButton(); + return false; + } else { + return true; + } + } + + checkNCDScreeningRequiredData(medicalForm: any) { + const NCDScreeningForm = ( + medicalForm.controls['patientVitalsForm'] + ); + const ncdIDRSScreeningForm = ( + medicalForm.controls['idrsScreeningForm'] + ); + const required = []; + let count = 0; + const physicalActivityMandatory = ( + medicalForm.controls['patientHistoryForm'].controls[ + 'physicalActivityHistory' + ] + ); + if (environment.isTMOffline) { + if ( + this.enableLungAssessment === true && + this.beneficiaryAge >= 18 && + this.nurseService.isAssessmentDone === false + ) { + required.push('Please perform Lung Assessment'); + } + } + /* If diabetes suspected then rbs test has to perform under vitals */ + if ( + this.attendant === 'nurse' && + this.diabetesSelected === 1 && + NCDScreeningForm.controls['rbsCheckBox'].value === true && + NCDScreeningForm.controls['rbsTestResult'].value === null + ) { + required.push('Please perform RBS Test under Vitals'); + } + if (this.beneficiary.ageVal >= 30) { + const familyDiseaseList = + medicalForm.controls.patientHistoryForm.controls.familyHistory.controls + .familyDiseaseList.value; + familyDiseaseList.forEach((element: any) => { + if ( + element.diseaseType !== null && + element.deleted === false && + element.diseaseType.diseaseType === 'Diabetes Mellitus' + ) { + count++; + } + }); + if (count === 0) { + required.push( + this.current_language_set.pleaseSelectDiabetesMellitusInFamilyHistory, + ); + } + if (physicalActivityMandatory.controls['activityType'].errors) { + required.push(this.current_language_set.physicalActivity); + } + } + let familyMember = 0; + const familyDiseasesList = + medicalForm.controls.patientHistoryForm.controls.familyHistory.controls + .familyDiseaseList.value; + let familyDiseasesLength = familyDiseasesList.length; + for (let element = 0; element < familyDiseasesList.length; element++) { + if ( + familyDiseasesList[element].diseaseType !== null && + familyDiseasesList[element].deleted === false + ) { + if ( + familyDiseasesList[element].familyMembers !== null && + familyDiseasesList[element].familyMembers.length > 0 + ) { + familyMember++; + } + } else { + familyDiseasesLength--; + } + } + if (familyMember !== familyDiseasesLength) { + required.push(this.current_language_set.familyMemberInFamilyHistory); + } + console.log( + 'required', + medicalForm.controls['idrsScreeningForm'], + ); + if (ncdIDRSScreeningForm.controls['requiredList'].value !== null) { + const ar = ncdIDRSScreeningForm.controls['requiredList'].value; + for (let i = 0; i < ar.length; i++) { + if (ar[i] !== 'Hypertension') { + required.push(ar[i]); + } + } + } + + //WDF requirement -> to check whether RBS test is prescribed or not + if (this.attendant === 'doctor' || this.designation === 'TC Specialist') { + const NCDScreeningCaseRecordForm = ( + medicalForm.controls['patientCaseRecordForm'] + ); + if ( + this.rbsPresent > 0 && + this.idrsScoreService.diabetesNotPresentInMMU !== 0 + ) { + let investigationCount = 0; + const labTestArray = + NCDScreeningCaseRecordForm.controls['generalDoctorInvestigationForm'] + .value.labTest; + if (labTestArray !== undefined && labTestArray.length > 0) { + labTestArray.forEach((element: any) => { + if ( + element.procedureName !== null && + element.procedureName.toLowerCase() === + environment.RBSTest.toLowerCase() + ) { + investigationCount++; + } + }); + } + + if ( + investigationCount === 0 && + this.diabetesSelected === 1 && + NCDScreeningForm.controls['rbsCheckBox'].value === true && + NCDScreeningForm.controls['rbsTestResult'].value === null + ) { + required.push('Please select RBS Test under Vitals or Investigation'); + } + + if ( + investigationCount === 0 && + this.diabetesSelected === 1 && + NCDScreeningForm.controls['rbsCheckBox'].value === false && + NCDScreeningForm.controls['rbsTestResult'].value === null + ) { + required.push('Please select RBS Test under Investigation'); + } + } + if (this.designation === 'TC Specialist') { + const finalDiagnosis = ( + medicalForm.controls['patientCaseRecordForm'].controls[ + 'generalDiagnosisForm' + ] + ); + const diabetesConfirm = + finalDiagnosis.controls['diabetesConfirmed'].value; + const hyperTensionConfirm = + finalDiagnosis.controls['hypertensionConfirmed'].value; + if (diabetesConfirm === null || hyperTensionConfirm === null) { + required.push(this.current_language_set.pleaseSelectFinalDiagnosis); + } + } + + this.visualAcuityTestValidation(NCDScreeningCaseRecordForm, required); + } + //WDF requirement + if (NCDScreeningForm.controls['height_cm'].errors) { + required.push( + this.current_language_set.vitalsDetails.AnthropometryDataANC_OPD_NCD_PNC + .height, + ); + } + if (NCDScreeningForm.controls['weight_Kg'].errors) { + required.push( + this.current_language_set.vitalsDetails.AnthropometryDataANC_OPD_NCD_PNC + .weight, + ); + } + if (NCDScreeningForm.controls['waistCircumference_cm'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsCancerscreening_QC + .waistCircumference, + ); + } + if ( + NCDScreeningForm.controls['temperature'].errors && + this.ncdTemperature === true + ) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .temperature, + ); + } + if (NCDScreeningForm.controls['pulseRate'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .pulseRate, + ); + } + if (NCDScreeningForm.controls['systolicBP_1stReading'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .systolicBP, + ); + } + if (NCDScreeningForm.controls['diastolicBP_1stReading'].errors) { + required.push( + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC + .diastolicBP, + ); + } + + if (this.attendant === 'doctor' || this.attendant === 'TC Specialist') { + const diagForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + const diagForm1 = diagForm.controls['generalDiagnosisForm']; + const diagForm2 = ( + diagForm1.controls['provisionalDiagnosisList'] + ); + const diagForm3 = diagForm2.controls[0]; + if ( + diagForm3.controls['viewProvisionalDiagnosisProvided'].errors && + this.enableProvisionalDiag === true + ) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + const referForm = medicalForm.controls['patientReferForm']; + if ( + referForm.controls['referredToInstituteName'].value === null && + sessionStorage.getItem('instFlag') === 'true' && + sessionStorage.getItem('suspectFlag') === 'true' + ) { + required.push( + this.current_language_set.Referdetails.higherhealthcarecenter, + ); + } + if (referForm.controls['refrredToAdditionalServiceList'].value !== null) { + if ( + referForm.controls['refrredToAdditionalServiceList'].value.length > 0 + ) { + if (referForm.controls['referralReason'].errors) { + required.push( + this.current_language_set.Referdetails.referralReason, + ); + } + } else if ( + referForm.controls['referredToInstituteName'].value !== null + ) { + if (referForm.controls['referralReason'].errors) { + required.push( + this.current_language_set.Referdetails.referralReason, + ); + } + } + } else if (referForm.controls['referredToInstituteName'].value !== null) { + if (referForm.controls['referralReason'].errors) { + required.push(this.current_language_set.Referdetails.referralReason); + } + } + } + this.mmuReferredSubscription = this.nurseService.ismmutc$.subscribe( + (response) => (this.ismmutc = response), + ); + if ( + this.attendant === 'nurse' && + this.ismmutc === 'yes' && + !this.schedulerData + ) + required.push(this.current_language_set.nurseData.scheduleTM); + + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.belowFields, + required, + ); + this.resetSpinnerandEnableTheSubmitButton(); + return false; + } else { + return true; + } + } + + /** + * Submit NURSE GENERAL QUICK CONSULT + */ + submitNurseQuickConsultVisitDetails(medicalForm: any) { + if (this.checkNurseRequirements(medicalForm)) { + this.nurseService + .postNurseGeneralQCVisitForm(medicalForm, this.schedulerData) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + checkQuickConsultDoctorData(patientMedicalForm: any) { + const form = ( + this.patientMedicalForm.controls['patientQuickConsultForm'] + ); + const caseRecordForm = ( + patientMedicalForm.controls['patientCaseRecordForm'] + ); + const required = []; + + if (form.controls['chiefComplaintList'].errors) { + required.push( + this.current_language_set.nurseData.chiefComplaintsDetails + .chiefComplaints, + ); + } + if (form.controls['clinicalObservation'].errors) { + required.push(this.current_language_set.casesheet.clinicalObs); + } + if ( + this.visitCategory === 'General OPD (QC)' && + this.attendant === 'doctor' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientQuickConsultForm'] + ); + const diagForm2 = ( + diagForm.controls['provisionalDiagnosisList'] + ); + console.log('diagForm2', diagForm2); + + const diagForm3 = diagForm2.controls[0]; + if (diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + } + if ( + this.visitCategory === 'General OPD (QC)' && + this.designation === 'TC Specialist' + ) { + const diagForm = ( + this.patientMedicalForm.controls['patientQuickConsultForm'] + ); + const diagForm2 = ( + diagForm.controls['provisionalDiagnosisList'] + ); + const diagForm3 = diagForm2.controls[0]; + if (diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (!diagForm3.controls['viewProvisionalDiagnosisProvided'].errors) { + diagForm2.value.filter((item: any) => { + if ( + item.viewProvisionalDiagnosisProvided && + (item.conceptID === null || + item.conceptID === undefined || + item.conceptID === '') + ) + required.push( + this.current_language_set + .pleaseSelectprovisionalDiagnosisWithSnomedCode, + ); + }); + } + if (diagForm.controls['instruction'].errors) { + required.push(this.current_language_set.casesheet.sprcAdvice); + } + } + + if (form.controls['provisionalDiagnosisList'].errors) { + required.push( + this.current_language_set.DiagnosisDetails.provisionaldiagnosis, + ); + } + + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.belowFields, + required, + ); + this.resetSpinnerandEnableTheSubmitButton(); + return 0; + } else { + return 1; + } + } + + /** + * Submit DOCTOR GENERAL QUICK CONSULT + */ + submitQuickConsultDiagnosisForm() { + const valid = this.checkQuickConsultDoctorData(this.patientMedicalForm); + if (valid) { + const patientQuickConsultForm = ( + this.patientMedicalForm.controls['patientQuickConsultForm'] + ); + let patientQuickConsultFormValue = JSON.parse( + JSON.stringify(patientQuickConsultForm.value), + ); + console.log(patientQuickConsultFormValue, 'formValue'); + const chiefComplaintList = + patientQuickConsultFormValue.chiefComplaintList; + chiefComplaintList.forEach((element: any) => { + if (element.chiefComplaint) { + element.chiefComplaintID = element.chiefComplaint.chiefComplaintID; + element.chiefComplaint = element.chiefComplaint.chiefComplaint; + } + }); + + let prescribedDrugs = + patientQuickConsultFormValue.prescription.prescribedDrugs; + prescribedDrugs = prescribedDrugs.filter((item: any) => !!item.createdBy); + patientQuickConsultFormValue.prescription = prescribedDrugs; + + let labTestOrders: any = []; + if ( + patientQuickConsultFormValue.test !== null && + patientQuickConsultFormValue.radiology !== null + ) { + labTestOrders = patientQuickConsultFormValue.test.concat( + patientQuickConsultFormValue.radiology, + ); + } else if (patientQuickConsultFormValue.test !== null) { + labTestOrders = Object.assign([], patientQuickConsultFormValue.test); + } else { + labTestOrders = Object.assign( + [], + patientQuickConsultFormValue.radiology, + ); + } + patientQuickConsultFormValue.labTestOrders = labTestOrders; + patientQuickConsultFormValue.test = undefined; + patientQuickConsultFormValue.radiology = undefined; + patientQuickConsultFormValue = Object.assign( + {}, + patientQuickConsultFormValue, + this.patientMedicalForm.controls['patientFileUploadDetailsForm'], + ); + + this.doctorService + .postQuickConsultDetails( + { quickConsultation: patientQuickConsultFormValue }, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.patientMedicalForm.reset(); + if (this.isSpecialist) { + if ( + labTestOrders !== undefined && + labTestOrders !== null && + labTestOrders.length > 0 + ) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToSpecialistWorklist(); + } else { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } + } else { + if ( + (labTestOrders !== undefined && + labTestOrders !== null && + labTestOrders.length > 0) || + (this.schedulerData !== undefined && + this.schedulerData !== null) + ) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + updateQuickConsultDiagnosisForm() { + const patientQuickConsultDetails = this.mapDoctorQuickConsultDetails(); + if (this.checkQuickConsultDoctorData(this.patientMedicalForm)) { + this.doctorService + .updateQuickConsultDetails( + { quickConsultation: patientQuickConsultDetails }, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + if ( + patientQuickConsultDetails && + patientQuickConsultDetails.labTestOrders !== undefined && + patientQuickConsultDetails.labTestOrders !== null && + patientQuickConsultDetails.labTestOrders.length > 0 + ) { + this.confirmationService.alert(res.data.response, 'success'); + this.navigateToSpecialistWorklist(); + } else { + this.getHealthIDDetails(res.data.response); + } + } else { + if ( + (this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0) || + (this.schedulerData !== undefined && + this.schedulerData !== null) + ) { + this.confirmationService.alert(res.data.response, 'success'); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails(res.data.response); + } + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + mapDoctorQuickConsultDetails() { + const patientQuickConsultForm = ( + this.patientMedicalForm.controls['patientQuickConsultForm'] + ); + const patientQuickConsultDetails = JSON.parse( + JSON.stringify(patientQuickConsultForm.value), + ); + + let prescribedDrugs = + patientQuickConsultDetails.prescription.prescribedDrugs; + prescribedDrugs = prescribedDrugs.filter((item: any) => !!item.createdBy); + patientQuickConsultDetails.prescription = prescribedDrugs; + + const chiefComplaintList = patientQuickConsultDetails.chiefComplaintList; + chiefComplaintList.forEach((element: any) => { + if (element.chiefComplaint) { + element.chiefComplaintID = element.chiefComplaint.chiefComplaintID; + element.chiefComplaint = element.chiefComplaint.chiefComplaint; + } + }); + let labTestOrders = []; + if ( + patientQuickConsultDetails.test !== null && + patientQuickConsultDetails.radiology !== null + ) { + labTestOrders = patientQuickConsultDetails.test.concat( + patientQuickConsultDetails.radiology, + ); + } else if (patientQuickConsultDetails.test !== null) { + labTestOrders = Object.assign([], patientQuickConsultDetails.test); + } else { + labTestOrders = Object.assign([], patientQuickConsultDetails.radiology); + } + labTestOrders = labTestOrders.filter((test: any) => !test.disabled); + + patientQuickConsultDetails.labTestOrders = labTestOrders; + patientQuickConsultDetails.chiefComplaintList = chiefComplaintList; + patientQuickConsultDetails.prescribedDrugs = prescribedDrugs; + patientQuickConsultDetails.test = undefined; + patientQuickConsultDetails.radiology = undefined; + + return patientQuickConsultDetails; + } + /** + * Submit NURSE ANC Details + */ + submitNurseANCVisitDetails(medicalForm: any) { + if (this.checkNurseRequirements(medicalForm)) { + this.nurseService + .postNurseANCVisitForm( + medicalForm, + null, + this.visitCategory, + this.beneficiary.ageVal, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * Submit DOCTOR ANC Details + */ + submitANCDiagnosisForm() { + if (this.checkNurseRequirements(this.patientMedicalForm)) { + const temp = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + visitCode: localStorage.getItem('visitCode'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + isSpecialist: this.isSpecialist, + }; + this.checkForPrescribedTests(temp); + this.doctorService + .postDoctorANCDetails( + this.patientMedicalForm, + temp, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + this.linkCareContextBasedOnSpecialistScheduled(); + } else { + this.linkCareContextBasedOnTestsPrescribed(); + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * Submit Function for NCD Care + */ + submitNurseNCDcareVisitDetails(medicalForm: any) { + if (this.checkNurseRequirements(medicalForm)) { + this.nurseService + .postNurseNCDCareVisitForm( + medicalForm, + this.visitCategory, + this.beneficiary, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * Submit Function for Covid-19 + */ + submitNurseCovidVisitDetails(medicalForm: any) { + if (this.checkNurseRequirements(medicalForm)) { + this.nurseService + .postNurseCovidVisitForm( + medicalForm, + this.visitCategory, + this.beneficiary, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * Submit Nurse NCD Screening + */ + submitNurseNCDScreeningVisitDetails(medicalForm: any) { + if (this.checkNCDScreeningRequiredData(medicalForm)) { + this.nurseService + .postNCDScreeningForm( + medicalForm, + this.visitCategory, + this.beneficiary, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + submitCovidDiagnosisForm() { + if (this.checkNurseRequirements(this.patientMedicalForm)) { + const temp = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + visitCode: localStorage.getItem('visitCode'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + isSpecialist: this.isSpecialist, + }; + const investigationForm = (( + this.patientMedicalForm.controls['patientCaseRecordForm'] + )).controls['generalDoctorInvestigationForm']; + const testsPrescribed = + this.doctorService.postGeneralCaseRecordInvestigation( + investigationForm, + temp, + ); + console.log('testsPrescribed', testsPrescribed, this.testsPrescribed); + this.doctorService + .postDoctorCovidDetails( + this.patientMedicalForm, + temp, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + if (this.isSpecialist) { + this.linkCareContextBasedOnSpecialistScheduled(); + } else { + this.linkCareContextBasedOnTestsPrescribed(); + } + } else { + if ( + (testsPrescribed !== undefined && + testsPrescribed !== null && + testsPrescribed.laboratoryList.length > 0) || + (this.schedulerData !== undefined && + this.schedulerData !== null) + ) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + submitNCDCareDiagnosisForm() { + if (this.checkNurseRequirements(this.patientMedicalForm)) { + const temp = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + visitCode: localStorage.getItem('visitCode'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + isSpecialist: this.isSpecialist, + }; + this.checkForPrescribedTests(temp); + this.doctorService + .postDoctorNCDCareDetails( + this.patientMedicalForm, + temp, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + this.linkCareContextBasedOnSpecialistScheduled(); + } else { + this.linkCareContextBasedOnTestsPrescribed(); + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * Submit Function for PNC + * + */ + submitPatientMedicalDetailsPNC(medicalForm: any) { + if (this.checkNurseRequirements(medicalForm)) { + this.nurseService + .postNursePNCVisitForm( + medicalForm, + this.visitCategory, + this.beneficiary, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * Submit Function for General OPD + * + */ + submitNurseGeneralOPDVisitDetails(medicalForm: any) { + if (this.checkNurseRequirements(medicalForm)) { + this.nurseService + .postNurseGeneralOPDVisitForm( + medicalForm, + this.visitCategory, + this.beneficiary, + this.schedulerData, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToNurseWorklist(); + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + navigateToDoctorWorklist() { + this.patientMedicalForm.reset(); + this.testsPrescribed = null; + this.removeBeneficiaryDataForDoctorVisit(); + this.router.navigate(['/common/doctor-worklist']); + } + navigateToSpecialistWorklist() { + this.patientMedicalForm.reset(); + this.testsPrescribed = null; + this.removeBeneficiaryDataForDoctorVisit(); + this.router.navigate(['/common/tcspecialist-worklist']); + } + basedOnRoleNavigateToWorklist() { + if (this.isSpecialist) { + this.navigateToSpecialistWorklist(); + } else { + this.navigateToDoctorWorklist(); + } + } + /* JA354063 - Link care context if tests are not prescribed by the specialist*/ + linkCareContextBasedOnSpecialistScheduled() { + if ( + this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0 + ) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToSpecialistWorklist(); + } else { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } + } + /* JA354063 - Link care context if tests are not prescribed by the doctor or if the tm is not scheduled from doctor*/ + linkCareContextBasedOnTestsPrescribed() { + console.log( + 'tests prescribed', + this.testsPrescribed.laboratoryList.length, + this.schedulerData, + ); + if ( + (this.testsPrescribed !== undefined && + this.testsPrescribed !== null && + this.testsPrescribed.laboratoryList.length > 0) || + (this.schedulerData !== undefined && this.schedulerData !== null) + ) { + this.confirmationService.alert( + this.current_language_set.alerts.info.datafillSuccessfully, + 'success', + ); + this.navigateToDoctorWorklist(); + } else { + this.getHealthIDDetails( + this.current_language_set.alerts.info.datafillSuccessfully, + ); + } + } + /* Fetch health ID detaiuls to link the visit */ + getHealthIDDetails(successResponseFromAPI: any) { + this.confirmationService + .confirm( + 'info', + successResponseFromAPI + + '. ' + + this.current_language_set.common.doYouWantToLinkCareContext, + ) + .subscribe((res) => { + if (res) { + this.fetchHealthIDDetailsOnConfirmation(); + } else if (!res) { + this.basedOnRoleNavigateToWorklist(); + console.log(); + } + }); + } + fetchHealthIDDetailsOnConfirmation() { + const data = { + beneficiaryID: this.beneficiary.beneficiaryID, + beneficiaryRegID: this.beneficiaryRegID, + }; + this.registrarService.getHealthIdDetails(data).subscribe( + (healthIDDetails: any) => { + if (healthIDDetails.statusCode === 200) { + const dialog = this.mdDialog.open(HealthIdDisplayModalComponent, { + data: { + dataList: healthIDDetails, + healthIDMapping: true, + visitCode: localStorage.getItem('visitCode'), + }, + }); + dialog.afterClosed().subscribe((result) => { + console.log(result); + this.basedOnRoleNavigateToWorklist(); + }); + } else { + this.confirmationService.alert( + this.current_language_set.issueInGettingBeneficiaryABHADetails, + 'error', + ); + this.patientMedicalForm.reset(); + this.removeBeneficiaryDataForNurseVisit(); + this.router.navigate(['/common/nurse-worklist']); + } + }, + (err) => { + this.confirmationService.alert( + this.current_language_set.issueInGettingBeneficiaryABHADetails, + 'error', + ); + this.patientMedicalForm.reset(); + this.removeBeneficiaryDataForNurseVisit(); + this.router.navigate(['/common/nurse-worklist']); + }, + ); + } + + submitGeneralOPDDiagnosisForm() { + if (this.checkNurseRequirements(this.patientMedicalForm)) { + const temp = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + visitCode: localStorage.getItem('visitCode'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + isSpecialist: this.isSpecialist, + }; + /* Method to check whether tests has been prescribed, if not link the care context*/ + this.checkForPrescribedTests(temp); + this.doctorService + .postDoctorGeneralOPDDetails( + this.patientMedicalForm, + temp, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + this.linkCareContextBasedOnSpecialistScheduled(); + } else { + this.linkCareContextBasedOnTestsPrescribed(); + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + idrsChange(value: any) { + this.enableIDRSUpdate = value; + } + submitPNCDiagnosisForm() { + if (this.checkNurseRequirements(this.patientMedicalForm)) { + const temp = { + beneficiaryRegID: this.beneficiaryRegID, + benVisitID: this.visitID, + visitCode: localStorage.getItem('visitCode'), + providerServiceMapID: localStorage.getItem('providerServiceID'), + createdBy: localStorage.getItem('userName'), + isSpecialist: this.isSpecialist, + }; + this.checkForPrescribedTests(temp); + this.doctorService + .postDoctorPNCDetails( + this.patientMedicalForm, + temp, + this.schedulerData, + this.isSpecialist, + ) + .subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if (this.isSpecialist) { + this.linkCareContextBasedOnSpecialistScheduled(); + } else { + this.linkCareContextBasedOnTestsPrescribed(); + } + } else { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (err) => { + this.resetSpinnerandEnableTheSubmitButton(); + this.confirmationService.alert(err, 'error'); + }, + ); + } + } + + /** + * update patient data + */ + updatePatientVitals() { + this.vitalsMode = String('update'); + } + + updatePatientHistory() { + if (this.visitCategory !== 'Cancer Screening') { + if (this.visitCategory === 'NCD screening') { + if (this.checkNCDScreeningHistory(this.patientMedicalForm)) + this.historyMode = String('update'); + } else { + if (this.checkPastObstericHistory(this.patientMedicalForm)) + this.historyMode = String('update'); + } + } else { + this.historyMode = String('update'); + } + } + + updatePatientExamination() { + this.examinationMode = String('update'); + } + + updatePatientANC() { + this.ancMode = String('update'); + } + + updatePatientPNC() { + this.pncMode = String('update'); + } + + updatePatientNcdScreening() { + const required = []; + const ncdIDRSScreeningForm = ( + this.patientMedicalForm.controls['idrsScreeningForm'] + ); + if (ncdIDRSScreeningForm.controls['requiredList'].value !== null) { + const ar = ncdIDRSScreeningForm.controls['requiredList'].value; + for (let i = 0; i < ar.length; i++) { + if (ar[i] !== 'Hypertension') { + required.push(ar[i]); + } + } + } + console.log('req', required); + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.mandatoryFields, + required, + ); + } else this.ncdScreeningMode = String('update'); + } + + ngOnDestroy() { + if (this.visitDetailMasterDataSubscription) + this.visitDetailMasterDataSubscription.unsubscribe(); + if (this.beneficiaryDetailsSubscription) + this.beneficiaryDetailsSubscription.unsubscribe(); + if (this.rbsPresentSubscription) this.rbsPresentSubscription.unsubscribe(); + if (this.visualAcuitySubscription) + this.visualAcuitySubscription.unsubscribe(); + if (this.hemoglobinSubscription) this.hemoglobinSubscription.unsubscribe(); + if (this.diabetesSubscription) this.diabetesSubscription.unsubscribe(); + if (this.visualAcuityMandatorySubscription) + this.visualAcuityMandatorySubscription.unsubscribe(); + if (this.ncdTemperatureSubscription) + this.ncdTemperatureSubscription.unsubscribe(); + if (this.mmuReferredSubscription) + this.mmuReferredSubscription.unsubscribe(); + if (this.enableVitalsButtonSubscription) + this.enableVitalsButtonSubscription.unsubscribe(); + + this.doctorService.clearCache(); + this.masterdataService.reset(); + } + + beneficiaryDetailsSubscription: any; + getBeneficiaryDetails() { + this.beneficiaryDetailsSubscription = + this.beneficiaryDetailsService.beneficiaryDetails$.subscribe( + (beneficiary) => { + if (beneficiary) { + this.beneficiary = beneficiary; + this.beneficiaryAge = beneficiary.ageVal; + console.log('beneficiary', beneficiary); + } + }, + ); + } + + visitDetailMasterDataSubscription: any; + getVisitReasonAndCategory() { + this.masterdataService.getVisitDetailMasterData(); + this.visitDetailMasterDataSubscription = + this.masterdataService.visitDetailMasterData$.subscribe( + (visitDetails) => { + if (visitDetails) { + this.visitCategoryList = visitDetails.visitCategories; + console.log('Visit Details Master Data', visitDetails); + + if (this.visitCategory) { + this.getNurseMasterData(this.visitCategory); + this.getDoctorMasterData(this.visitCategory); + } + } + }, + ); + } + + getNurseMasterData(visitCategory: string) { + const visitID = this.getVisitCategoryID(visitCategory); + const serviceProviderID = localStorage.getItem('providerServiceID'); + + if (visitID) + this.masterdataService.getNurseMasterData(visitID, serviceProviderID); + } + + getDoctorMasterData(visitCategory: string) { + const visitID = this.getVisitCategoryID(visitCategory); + const serviceProviderID = localStorage.getItem('providerServiceID'); + + if (visitID) + this.masterdataService.getDoctorMasterData(visitID, serviceProviderID); + } + + getVisitCategoryID(visitCategory: string) { + if (visitCategory && this.visitCategoryList) { + const temp = this.visitCategoryList.filter((category: any) => { + return category.visitCategory === visitCategory; + }); + if (temp.length > 0) return temp[0].visitCategoryID; + } + return null; + } + + getPregnancyStatus() { + const pg = this.patientMedicalForm.controls['patientVisitForm']; + pg.controls['patientVisitDetailsForm'].valueChanges.subscribe((value) => { + if (value.pregnancyStatus) { + this.pregnancyStatus = value.pregnancyStatus; + } else { + this.pregnancyStatus = null; + } + }); + } + + patchGravidaValue() { + const af = this.patientMedicalForm.controls['patientANCForm'] as FormGroup; + const pof = (( + this.patientMedicalForm.controls['patientHistoryForm'] + )).controls['pastObstericHistory'] as FormGroup; + + (af.controls['obstetricFormulaForm']).controls[ + 'gravida_G' + ].valueChanges.subscribe((value) => { + if (pof && value && value > 1) + pof.controls['totalNoOfPreg'].setValue(value); + }); + } + + getCurrentVitals() { + this.patientMedicalForm.controls[ + 'patientVitalsForm' + ].valueChanges.subscribe((value) => { + if (value) { + this.currentVitals = value; + } + }); + } + + patchCancerFindings() { + this.patientMedicalForm.valueChanges.subscribe( + (patientMedicalForm: any) => { + this.findings = { + briefHistory: + patientMedicalForm.patientExaminationForm.signsForm.observation, + oralExamination: + patientMedicalForm.patientExaminationForm.oralExaminationForm + .observation, + abdominalExamination: + patientMedicalForm.patientExaminationForm.abdominalExaminationForm + .observation, + gynecologicalExamination: + patientMedicalForm.patientExaminationForm + .gynecologicalExaminationForm.observation, + }; + }, + ); + } + + getANCDiagnosis() { + const ANCForm = ( + this.patientMedicalForm.controls['patientANCForm'] + ); + const CaseRecordForm = ( + this.patientMedicalForm.controls['patientCaseRecordForm'] + ); + + ANCForm.controls['obstetricFormulaForm'].valueChanges.subscribe((value) => { + CaseRecordForm.controls['generalDiagnosisForm'].patchValue(value); + }); + ANCForm.controls['patientANCDetailsForm'].valueChanges.subscribe( + (value) => { + CaseRecordForm.controls['generalDiagnosisForm'].patchValue(value); + }, + ); + } + + getPrimeGravidaStatus() { + const ANCForm = ( + this.patientMedicalForm.controls['patientANCForm'] + ); + (ANCForm.controls['patientANCDetailsForm']).controls[ + 'primiGravida' + ].valueChanges.subscribe((value) => { + this.primeGravidaStatus = value; + }); + } + + patchLMPDate() { + const patientANCDetailsForm = (( + this.patientMedicalForm.controls['patientANCForm'] + )).controls['patientANCDetailsForm']; + const menstrualHistoryForm = (( + this.patientMedicalForm.controls['patientHistoryForm'] + )).controls['menstrualHistory']; + + patientANCDetailsForm.valueChanges.subscribe((value) => { + if (value.lmpDate) { + const temp = new Date(value.lmpDate); + menstrualHistoryForm.patchValue({ lMPDate: temp }); + this.nurseService.setLMPForFetosenseTest(temp); + } + }); + } + + patchGeneralFinding() { + const patientChiefComplaintsForm = (( + this.patientMedicalForm.controls['patientVisitForm'] + )).controls['patientChiefComplaintsForm']; + + patientChiefComplaintsForm.valueChanges.subscribe((value) => { + this.findings = value; + }); + } + + ngAfterViewChecked() { + this.changeDetectorRef.detectChanges(); + } + lableName: any; + updatePending(event: any) { + let dirty = false; + + let changedForm: any; + + if (!this.newLookupMode) { + switch (event.previouslySelectedStep.label) { + case 'ANC': { + const ancForm = ( + this.patientMedicalForm.controls['patientANCForm'] + ); + if (ancForm.dirty) { + this.lableName = this.current_language_set.ancData.anc; + dirty = true; + changedForm = ancForm; + } + break; + } + + case 'History': { + const historyForm = ( + this.patientMedicalForm.controls['patientHistoryForm'] + ); + if (historyForm.dirty) { + this.lableName = this.current_language_set.common.history; + + dirty = true; + changedForm = historyForm; + } + break; + } + + case 'Vitals': { + const vitalsForm = ( + this.patientMedicalForm.controls['patientVitalsForm'] + ); + if (vitalsForm.dirty || this.enableUpdateButtonInVitals) { + this.lableName = + this.current_language_set.vitalsDetails.vitalsDataANC_OPD_NCD_PNC.vitals; + dirty = true; + changedForm = vitalsForm; + } + break; + } + + case 'Examination': { + const examinationForm = ( + this.patientMedicalForm.controls['patientExaminationForm'] + ); + if (examinationForm.dirty) { + this.lableName = + this.current_language_set.ExaminationData.examination; + dirty = true; + changedForm = examinationForm; + } + break; + } + + case 'IDRS': { + const IDRSForm = ( + this.patientMedicalForm.controls['idrsScreeningForm'] + ); + this.lableName = 'Screening'; + if (this.enableIDRSUpdate === false) { + dirty = true; + changedForm = IDRSForm; + } + break; + } + + case 'Visit Details': { + const patientVisitFormDet = ( + this.patientMedicalForm.controls['patientVisitForm'] + ); + const covidVaccinationForm = + patientVisitFormDet.controls['covidVaccineStatusForm']; + this.lableName = this.current_language_set.covidVaccinationStatus; + if ( + this.doctorService.covidVaccineAgeGroup === '>=12 years' && + (covidVaccinationForm.dirty === true || + this.doctorService.enableCovidVaccinationButton === true) + ) { + dirty = true; + changedForm = covidVaccinationForm; + } + break; + } + + default: { + dirty = false; + break; + } + } + } else { + switch (event.previouslySelectedStep.label) { + case 'Visit Details': { + const patientVisitFormDet = ( + this.patientMedicalForm.controls['patientVisitForm'] + ); + const covidVaccinationForm = + patientVisitFormDet.controls['covidVaccineStatusForm']; + this.lableName = this.current_language_set.covidVaccinationStatus; + if ( + this.doctorService.covidVaccineAgeGroup === '>=12 years' && + (covidVaccinationForm.dirty === true || + this.doctorService.enableCovidVaccinationButton === true) + ) { + dirty = true; + changedForm = covidVaccinationForm; + } + break; + } + + default: + dirty = false; + break; + } + } + + if (dirty) + this.confirmationService.alert( + this.current_language_set.alerts.info.dontForget + + ' ' + + this.lableName + + ' ' + + this.current_language_set.alerts.info.changes, + ); + } + + sideNavModeChange(sidenav: any) { + const deviceHeight = window.screen.height; + const deviceWidth = window.screen.width; + if (deviceWidth < 700) sidenav.mode = 'over'; + else sidenav.mode = 'side'; + sidenav.toggle(); + } + + canDeactivate(): Observable { + console.log('deactivate called'); + if ( + (sessionStorage.length > 0 && this.patientMedicalForm.dirty) || + this.enableUpdateButtonInVitals + ) + return this.confirmationService.confirm( + `info`, + this.current_language_set.alerts.info.navigateFurtherAlert, + 'Yes', + 'No', + ); + else return of(true); + } + + preventSubmitOnEnter(event: Event) { + event.preventDefault(); + } + + schedulerData: any; + schedulerFormData: any; + schedulerButton: any; + openScheduler() { + // let mdDialogRef: MatDialogRef = this.mdDialog.open( + // SchedulerComponent, + // { + // data: this.schedulerFormData, + // } + // ); + // mdDialogRef.afterClosed().subscribe((result) => { + // if (result) { + // console.log("result", result); + // if (result.clear) { + // this.schedulerFormData = null; + // this.schedulerData = null; + // this.schedulerButton = + // this.current_language_set.common.scheduleforTM + + // " " + + // this.serviceType; + // } else if ( + // result.tmSlot && + // result.tmSlot !== null && + // result.tmSlot !== undefined + // ) { + // this.schedulerFormData = result; + // this.schedulerData = this.schedulerFormData.tmSlot; + // this.schedulerButton = "View " + this.serviceType + " Schedule"; + // } + // } else { + // console.log("result", result); + // } + // }); + } + + startTC() { + console.log('startTC'); + this.doctorService.invokeSwymedCallSpecialist().subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data) { + window.location.href = res.data.response; + this.updateTCStartTime(); + } else { + this.confirmationService.alert(res.errorMessage, 'error'); + } + }, + (error) => { + this.confirmationService.alert(error, 'error'); + }, + ); + } + updateTCStartTime() { + const tCStartTimeObj = { + benRegID: localStorage.getItem('beneficiaryRegID'), + visitCode: localStorage.getItem('visitCode'), + }; + this.doctorService.updateTCStartTime(tCStartTimeObj).subscribe((res) => { + console.log(res); + }); + } + provideLogin() { + this.confirmationService + .confirm( + 'info', + this.current_language_set.provideSwyMedLoginDetailsToStartTC, + 'Yes', + 'No', + ) + .subscribe((res) => { + if (res) { + this.openSnackBar(); + } else { + this.confirmationService.alert( + this.current_language_set.loginManuallyThroughSwyMed, + ); + } + }); + } + + openSnackBar() { + const snackBarRef: MatSnackBarRef = + this.snackBar.openFromComponent(SpecialistLoginComponent, { + horizontalPosition: 'right', + data: { + message: 'string', + action: 'Save', + }, + }); + snackBarRef.afterDismissed().subscribe(() => { + this.startTC(); + }); + } + checkPastObstericHistory(generalOPDHistory: any) { + const vitalsForm = ( + generalOPDHistory.controls['patientHistoryForm'] + ); + const pregForm1 = vitalsForm.controls['pastObstericHistory']; + const pregForm2 = pregForm1.controls['pastObstericHistoryList']; + const historyForm = ( + generalOPDHistory.controls['patientHistoryForm'] + ); + + const required = []; + if (pregForm2.controls) { + const score1 = Number(pregForm2.controls['length']); + for (let i = 0; i < score1; i++) { + const pregForm3 = pregForm2.controls[i]; + if ( + pregForm3.controls['pregOutcome'].value && + pregForm3.controls['pregOutcome'].value.pregOutcome === 'Abortion' + ) { + if ( + pregForm3.controls['abortionType'].value && + pregForm3.controls['abortionType'].value.complicationValue === + 'Induced' && + pregForm3.controls['typeofFacility'].errors + ) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory.obstetric + .typeofFacility + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + if (pregForm3.controls['postAbortionComplication'].errors) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory.obstetric + .complicationPostAbortion + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + if (pregForm3.controls['abortionType'].errors) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory.obstetric + .typeOfAbortion + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + if (pregForm3.controls['pregDuration'].errors) { + required.push( + this.current_language_set.historyData.opd_NCD_PNCHistory.obstetric + .noOfcompletedWeeks + + '-' + + this.current_language_set.historyData.opd_NCD_PNCHistory + .obstetric.orderofPregnancy + + ' ' + + pregForm3.value.pregOrder, + ); + } + } + } + } + const personalHistory = historyForm.controls['personalHistory']; + const allergyList = personalHistory.value.allergicList; + + let snomedTermNotMapped = false; + + if (allergyList.length > 0) { + for (let i = 0; i < allergyList.length; i++) { + if (allergyList[i].allergyType !== null) { + if ( + allergyList[i].snomedCode === null && + allergyList[i].snomedTerm !== null + ) { + snomedTermNotMapped = true; + } else if ( + allergyList[i].snomedCode !== null && + allergyList[i].snomedTerm === null + ) { + snomedTermNotMapped = true; + } + } + } + } + + if (snomedTermNotMapped) { + required.push(this.current_language_set.allergyNameIsNotValid); + } + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.belowFields, + required, + ); + return 0; + } else { + return 1; + } + } + checkNCDScreeningHistory(historyForm: any) { + const required = []; + + let count = 0; + const familyDiseaseList = + historyForm.controls.patientHistoryForm.controls.familyHistory.controls + .familyDiseaseList.value; + familyDiseaseList.forEach((element: any) => { + if ( + element.diseaseType !== null && + element.deleted === false && + element.diseaseType.diseaseType === 'Diabetes Mellitus' + ) { + count++; + } + }); + if (this.beneficiaryAge < 30) { + count++; + } + + if (count === 0) { + required.push( + this.current_language_set.pleaseSelectDiabetesMellitusInFamilyHistory, + ); + } + + let familyMember = 0; + const familyDiseasesList = + historyForm.controls.patientHistoryForm.controls.familyHistory.controls + .familyDiseaseList.value; + let familyDiseasesLength = familyDiseasesList.length; + for (let element = 0; element < familyDiseasesList.length; element++) { + if ( + familyDiseasesList[element].diseaseType !== null && + familyDiseasesList[element].deleted === false + ) { + if ( + familyDiseasesList[element].familyMembers !== null && + familyDiseasesList[element].familyMembers.length > 0 + ) { + familyMember++; + } + } else { + familyDiseasesLength--; + } + } + if (familyMember !== familyDiseasesLength) { + required.push(this.current_language_set.familyMemberInFamilyHistory); + } + if (required.length) { + this.confirmationService.notify( + this.current_language_set.alerts.info.mandatoryFields, + required, + ); + return 0; + } else { + return 1; + } + } + getMMUInvestigationDetails() { + const reqObj = { + benRegID: localStorage.getItem('beneficiaryRegID'), + visitCode: localStorage.getItem('referredVisitCode'), + benVisitID: localStorage.getItem('referredVisitID'), + fetchMMUDataFor: 'Investigation', + }; + if ( + localStorage.getItem('referredVisitCode') !== 'undefined' && + localStorage.getItem('referredVisitID') !== 'undefined' + ) { + this.doctorService.getMMUData(reqObj).subscribe( + (res: any) => { + if (res.statusCode === 200 && res.data !== null) { + if ( + res.data.data.laboratoryList !== undefined && + res.data.data.laboratoryList.length > 0 + ) { + const labList = res.data.data.laboratoryList; + let rbsPresentInList = false; + labList.forEach((element: any) => { + if (element.procedureName.toLowerCase() === 'RBS Test') { + this.diabetesSelected = 0; + rbsPresentInList = true; + } + }); + this.diabetesSelected = 1; + } + } else { + this.confirmationService.alert( + this.current_language_set.errorInFetchingMMUInvestigationDetails, + 'error', + ); + } + }, + (err) => { + this.confirmationService.alert( + this.current_language_set.errorInFetchingMMUInvestigationDetails, + 'error', + ); + }, + ); + } + } + + openBenPreviousisitDetails() { + this.mdDialog.open(OpenPreviousVisitDetailsComponent, { + disableClose: true, + width: '95%', + panelClass: 'preview-casesheet', + data: { + previous: true, + }, + }); + } +} diff --git a/src/app/app-modules/registrar/registration/register-personal-details/register-personal-details.component.ts b/src/app/app-modules/registrar/registration/register-personal-details/register-personal-details.component.ts index 39dc3f0..a111f9e 100644 --- a/src/app/app-modules/registrar/registration/register-personal-details/register-personal-details.component.ts +++ b/src/app/app-modules/registrar/registration/register-personal-details/register-personal-details.component.ts @@ -28,17 +28,10 @@ import { ViewChild, HostListener, DoCheck, - AfterViewInit, OnDestroy, AfterViewChecked, } from '@angular/core'; -import { - FormGroup, - FormControl, - FormArray, - FormBuilder, - Validators, -} from '@angular/forms'; +import { FormGroup } from '@angular/forms'; import { ConfirmationService } from '../../../core/services/confirmation.service'; import { CameraService } from '../../../core/services/camera.service'; import { RegistrarService } from '../../shared/services/registrar.service'; @@ -57,7 +50,7 @@ import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-la styleUrls: ['./register-personal-details.component.css'], }) export class RegisterPersonalDetailsComponent - implements OnInit, DoCheck, AfterViewInit, OnDestroy, AfterViewChecked + implements OnInit, DoCheck, OnDestroy, AfterViewChecked { colorTheme = 'theme-dark-blue'; @@ -102,9 +95,6 @@ export class RegisterPersonalDetailsComponent // dateAdapter.setLocale('en-IN'); setTheme('bs4'); // or 'bs4' } - ngAfterViewInit(): void { - throw new Error('Method not implemented.'); - } ngOnInit() { this.setDateLimits(); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9283b80..df2fc15 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -79,14 +79,14 @@ const routes: Routes = [ (module) => module.RegistrarModule, ), }, - // { - // path: 'nurse-doctor', - // canActivate: [AuthGuard], - // loadChildren: () => - // import('./app-modules/nurse-doctor/nurse-doctor.module').then( - // module => module.NurseDoctorModule - // ), - // }, + { + path: 'nurse-doctor', + canActivate: [AuthGuard], + loadChildren: () => + import('./app-modules/nurse-doctor/nurse-doctor.module').then( + (module) => module.NurseDoctorModule, + ), + }, { path: 'lab', canActivate: [AuthGuard],