Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ export class MasterDataService {
visitCode: visitCode,
});
}

getEcgAbnormalFindings() {
return this.http.get(environment.getEcgAbnormalFindingsUrl);
}
}
1 change: 1 addition & 0 deletions src/app/app-modules/lab/shared/utility/lab-utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class LabUtils {
calibrationStatusAPI: null,
calibrationEndAPI: null,
compListDetails: this.fb.array([]),
ecgAbnormalFindings: this.fb.control([]),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ export class DataManipulation {
const labTestResults: any = [];
labForm.forEach((element: any, i: any) => {
if (element.prescriptionID || element.procedureID) {
labTestResults.push({
const procedureObj: any = {
prescriptionID: element.prescriptionID,
procedureID: element.procedureID,
compList: this.labComponentRestruct(element.compListDetails),
});
};
if (element.ecgAbnormalFindings && element.ecgAbnormalFindings.length > 0) {
procedureObj.abnormalFindings = element.ecgAbnormalFindings;
}
labTestResults.push(procedureObj);
}
});

Expand Down
114 changes: 24 additions & 90 deletions src/app/app-modules/lab/workarea/workarea.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,7 @@ <h5>{{ procedure.value.procedureName }}&nbsp;</h5>
(input)="checkNormalRange(i, j)"
(blur)="checkRange(i, j)"
[required]="
procedure.value.isMandatory ===
true &&
procedure.value.procedureName ===
testName &&
stripSelected === true
? true
: false ||
(procedure.value
.procedureName !==
testName &&
procedure.value
.isMandatory === true)
? true
: false
isFieldRequired(procedure)
"
/>

Expand Down Expand Up @@ -191,22 +178,7 @@ <h5>{{ procedure.value.procedureName }}&nbsp;</h5>
>
<div>
<span
*ngIf="
procedure.value.isMandatory ===
true &&
procedure.value.procedureName ===
testName &&
stripSelected === true
? true
: false ||
(procedure.value
.procedureName !==
testName &&
procedure.value
.isMandatory === true)
? true
: false
"
*ngIf="isFieldRequired(procedure)"
>
<p style="font-size: 12px">
{{
Expand All @@ -220,20 +192,7 @@ <h5>{{ procedure.value.procedureName }}&nbsp;</h5>
formControlName="compOptSelected"
disableRipple="true"
[required]="
procedure.value.isMandatory ===
true &&
procedure.value.procedureName ===
testName &&
stripSelected === true
? true
: false ||
(procedure.value
.procedureName !==
testName &&
procedure.value
.isMandatory === true)
? true
: false
isFieldRequired(procedure)
"
>
<mat-radio-button
Expand All @@ -248,38 +207,6 @@ <h5>{{ procedure.value.procedureName }}&nbsp;</h5>
{{ radio.value.name }}
</mat-radio-button>
</mat-radio-group>
<div>
<mat-form-field
class=""
style="
margin-left: unset !important;
padding: unset;
"
*ngIf="
procedure.value.procedureName.includes(
'ECG'
) && enableEcgAbnormal
"
>
<mat-select
multiple
class="p-t-12"
[style.width]="'100%'"
formControlName="ecgAbnormalities"
style="line-height: unset"
placeholder="ECG Abnormalities"
required
>
<mat-option
*ngFor="
let option of ecgAbnormalities
"
[value]="option.ecgAbnormality"
>{{ option.ecgAbnormality }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</section>
<section
Expand Down Expand Up @@ -307,20 +234,7 @@ <h5>{{ procedure.value.procedureName }}&nbsp;</h5>
?.result
}}"
[required]="
procedure.value.isMandatory ===
true &&
procedure.value.procedureName ===
testName &&
stripSelected === true
? true
: false ||
(procedure.value
.procedureName !==
testName &&
procedure.value
.isMandatory === true)
? true
: false
isFieldRequired(procedure)
"
>
<mat-option
Expand Down Expand Up @@ -358,6 +272,26 @@ <h5>{{ procedure.value.procedureName }}&nbsp;</h5>
</div>
</div>
</div>
<div
[hidden]="!isEcgAbnormal(procedure)"
style="margin-top: 16px"
>
<mat-form-field style="width: 100%">
<mat-select
multiple
formControlName="ecgAbnormalFindings"
placeholder="ECG Abnormalities"
[required]="isEcgAbnormal(procedure)"
>
<mat-option
*ngFor="let option of ecgAbnormalOptions"
[value]="option.findingID"
>
{{ option.findingName }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-expansion-panel>
</ng-container>
</section>
Expand Down
47 changes: 44 additions & 3 deletions src/app/app-modules/lab/workarea/workarea.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export class WorkareaComponent
testName!: string;
current_language_set: any;
maxFileSize = 5;
ecgAbnormalities: any;
enableEcgAbnormal = false;
ecgAbnormalOptions: any[] = [];

constructor(
private fb: FormBuilder,
Expand All @@ -108,6 +107,7 @@ export class WorkareaComponent
this.getTestRequirements();
this.stepExpand = 0;
this.testName = environment.RBSTest;
this.fetchEcgAbnormalFindings();
}
ngDoCheck() {
this.assignSelectedLanguage();
Expand All @@ -118,6 +118,45 @@ export class WorkareaComponent
this.current_language_set = getLanguageJson.currentLanguageObject;
}

fetchEcgAbnormalFindings() {
this.masterdataService.getEcgAbnormalFindings().subscribe(
(res: any) => {
if (res.statusCode === 200 && res.data) {
this.ecgAbnormalOptions = res.data
.filter((item: any) => !item.deleted)
.sort((a: any, b: any) =>
a.findingName.localeCompare(b.findingName),
);
}
},
(error) => {
console.error('Error fetching ECG abnormal findings', error);
},
);
}

isEcgAbnormal(procedure: any): boolean {
const name = procedure?.value?.procedureName;
const comps = procedure?.value?.compListDetails;
if (!name || !Array.isArray(comps)) {
return false;
}
return (
name.includes('ECG') &&
comps.some((comp: any) => comp.compOptSelected === 'Abnormal')
);
}

isFieldRequired(procedure: any): boolean {
return (
(procedure.value.isMandatory === true &&
procedure.value.procedureName === this.testName &&
this.stripSelected === true) ||
(procedure.value.procedureName !== this.testName &&
procedure.value.isMandatory === true)
);
}

/**
* MERGE ALL 3 FORMS after getting data
*/
Expand Down Expand Up @@ -220,7 +259,8 @@ export class WorkareaComponent
* Patch Values for Lab Test Procedure
*/
patchLabTestProcedureMasterData(test: any, index: any) {
this.labForm.at(index).patchValue({
const ctrl = this.labForm.at(index);
ctrl.patchValue({
procedureType: test.procedureType,
procedureName: test.procedureName,
procedureID: test.procedureID,
Expand All @@ -232,6 +272,7 @@ export class WorkareaComponent
calibrationStartAPI: test.calibrationStartAPI,
calibrationStatusAPI: test.calibrationStatusAPI,
calibrationEndAPI: test.calibrationEndAPI,
ecgAbnormalFindings: test.ecgAbnormalFindings || [],
});
this.patchLabTestComponentCommonMasterData(test.compListDetails, index);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ <h4 class="norecord">
{{ component?.remarks }}
</td>
</tr>
<tr
*ngIf="
test?.procedureName &&
test?.procedureName.includes('ECG') &&
test?.abnormalFindingLabels &&
test?.abnormalFindingLabels.length > 0
"
>
<td
colspan="4"
style="
background-color: #f9f3cd;
font-weight: 500;
padding: 8px;
"
>
<strong>ECG Abnormal Findings:</strong>
{{ test?.abnormalFindingLabels?.join(", ") }}
</td>
</tr>
</ng-container>
</tbody>
<tfoot>
Expand Down Expand Up @@ -485,6 +505,26 @@ <h4 class="norecord">
{{ component?.remarks }}
</td>
</tr>
<tr
*ngIf="
test?.procedureName &&
test?.procedureName.includes('ECG') &&
test?.abnormalFindingLabels &&
test?.abnormalFindingLabels.length > 0
"
>
<td
colspan="6"
style="
background-color: #f9f3cd;
font-weight: 500;
padding: 8px;
"
>
<strong>ECG Abnormal Findings:</strong>
{{ test?.abnormalFindingLabels?.join(", ") }}
</td>
</tr>
</ng-container>
</tbody>
<tfoot>
Expand Down
Loading