diff --git a/Common-UI b/Common-UI index 209356cf..a5b78ec4 160000 --- a/Common-UI +++ b/Common-UI @@ -1 +1 @@ -Subproject commit 209356cf324fb19ca5705e62c58931062468147f +Subproject commit a5b78ec4b7ce8bfc369a88d23ccecce9c345e0e1 diff --git a/src/app/app-modules/nurse-doctor/history/general-opd-history/general-opd-history.component.ts b/src/app/app-modules/nurse-doctor/history/general-opd-history/general-opd-history.component.ts index aca936e5..8a47c511 100644 --- a/src/app/app-modules/nurse-doctor/history/general-opd-history/general-opd-history.component.ts +++ b/src/app/app-modules/nurse-doctor/history/general-opd-history/general-opd-history.component.ts @@ -163,45 +163,31 @@ export class GeneralOpdHistoryComponent } loadFormData() { - this.pastHistory = this.nurseGeneralHistoryForm.get( - 'pastHistory' - ) as FormGroup; - this.comorbidityHistory = this.nurseGeneralHistoryForm.get( - 'comorbidityHistory' - ) as FormGroup; - this.medicationHistory = this.nurseGeneralHistoryForm.get( - 'medicationHistory' - ) as FormGroup; - this.personalHistory = this.nurseGeneralHistoryForm.get( - 'personalHistory' - ) as FormGroup; - this.familyHistory = this.nurseGeneralHistoryForm.get( - 'familyHistory' - ) as FormGroup; - this.menstrualHistory = this.nurseGeneralHistoryForm.get( - 'menstrualHistory' - ) as FormGroup; - this.perinatalHistory = this.nurseGeneralHistoryForm.get( - 'perinatalHistory' - ) as FormGroup; - this.pastObstericHistory = this.nurseGeneralHistoryForm.get( - 'pastObstericHistory' - ) as FormGroup; - this.immunizationHistory = this.nurseGeneralHistoryForm.get( - 'immunizationHistory' - ) as FormGroup; - this.otherVaccines = this.nurseGeneralHistoryForm.get( - 'otherVaccines' - ) as FormGroup; - this.feedingHistory = this.nurseGeneralHistoryForm.get( - 'feedingHistory' - ) as FormGroup; - this.developmentHistory = this.nurseGeneralHistoryForm.get( - 'developmentHistory' - ) as FormGroup; - this.physicalActivityHistory = this.nurseGeneralHistoryForm.get( - 'physicalActivityHistory' - ) as FormGroup; + const form = this.nurseGeneralHistoryForm; + if (!form) return; + const pick = (name: string): FormGroup | undefined => { + const ctrl = form.get(name); + return ctrl ? (ctrl as FormGroup) : undefined; + }; + this.pastHistory = pick('pastHistory') ?? this.pastHistory; + this.comorbidityHistory = + pick('comorbidityHistory') ?? this.comorbidityHistory; + this.medicationHistory = + pick('medicationHistory') ?? this.medicationHistory; + this.personalHistory = pick('personalHistory') ?? this.personalHistory; + this.familyHistory = pick('familyHistory') ?? this.familyHistory; + this.menstrualHistory = pick('menstrualHistory') ?? this.menstrualHistory; + this.perinatalHistory = pick('perinatalHistory') ?? this.perinatalHistory; + this.pastObstericHistory = + pick('pastObstericHistory') ?? this.pastObstericHistory; + this.immunizationHistory = + pick('immunizationHistory') ?? this.immunizationHistory; + this.otherVaccines = pick('otherVaccines') ?? this.otherVaccines; + this.feedingHistory = pick('feedingHistory') ?? this.feedingHistory; + this.developmentHistory = + pick('developmentHistory') ?? this.developmentHistory; + this.physicalActivityHistory = + pick('physicalActivityHistory') ?? this.physicalActivityHistory; } ngOnChanges(changes: any) { diff --git a/src/app/app-modules/nurse-doctor/visit-details/visit-details/visit-details.component.ts b/src/app/app-modules/nurse-doctor/visit-details/visit-details/visit-details.component.ts index 7a053ee6..b8fa3d2d 100644 --- a/src/app/app-modules/nurse-doctor/visit-details/visit-details/visit-details.component.ts +++ b/src/app/app-modules/nurse-doctor/visit-details/visit-details/visit-details.component.ts @@ -116,6 +116,34 @@ export class PatientVisitDetailsComponent this.beneficiaryDetailsSubscription.unsubscribe(); } + private readonly supportedVisitCategories = [ + 'General OPD (QC)', + 'Cancer Screening', + 'General OPD', + 'NCD screening', + 'PNC', + 'ANC', + 'NCD care', + 'COVID-19 Screening', + ]; + + private filterSupportedCategories(categories: any[]): any[] { + const age = this.beneficiary?.ageVal; + return (categories || []).filter((item: any) => { + const name = item?.visitCategory; + if (!this.supportedVisitCategories.includes(name)) return false; + if ( + (name === 'NCD screening' || name === 'NCD care') && + age !== null && + age !== undefined && + age < 30 + ) { + return false; + } + return true; + }); + } + visitCategorySubscription: any; getVisitReasonAndCategory() { this.visitCategorySubscription = @@ -127,8 +155,9 @@ export class PatientVisitDetailsComponent this.templateNurseMasterData ); this.templateVisitReasons = this.templateNurseMasterData.visitReasons; - this.templateVisitCategories = - this.templateNurseMasterData.visitCategories; + this.templateVisitCategories = this.filterSupportedCategories( + this.templateNurseMasterData.visitCategories + ); this.templateFilterVisitCategories = this.templateVisitCategories; if ( diff --git a/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts b/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts index a4851fba..a636fcc1 100644 --- a/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts +++ b/src/app/app-modules/nurse-doctor/workarea/workarea.component.ts @@ -1021,6 +1021,15 @@ export class WorkareaComponent this.referMode = new String(mode); this.caseRecordMode = new String(mode); } + } else { + setTimeout(() => + this.confirmationService.alert( + this.currentLanguageSet?.alerts?.info + ?.visitCategoryNotSupported || + 'This visit category is not supported. Please re-select the visit category.', + 'info' + ) + ); } } else if (this.specialistFlag === '100') { this.showOnlyTMReferred(); @@ -1060,10 +1069,6 @@ export class WorkareaComponent this.showPNC = false; this.showCaseRecord = false; this.showRefer = false; - - if (this.attendantType === 'nurse') { - this.changeDetectorRef.detectChanges(); - } } submitPatientMedicalDetailsForm(medicalForm: any) {