Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poc 781 #1762

Merged
merged 5 commits into from
Jul 19, 2024
Merged

Poc 781 #1762

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
49 changes: 49 additions & 0 deletions src/app/lab-order-search/lab-order-search-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class LabOrdersSearchHelperService {
conceptUuid: 'a898fe80-1350-11df-a1f1-0026b9348838',
display: 'DNA PCR'
},

{
type: 'VL',
conceptUuid: 'a8982474-1350-11df-a1f1-0026b9348838',
Expand All @@ -24,13 +25,26 @@ export class LabOrdersSearchHelperService {
conceptUuid: 'a896cce6-1350-11df-a1f1-0026b9348838',
display: 'CD4 Panel'
},
{
type: 'HPV',
conceptUuid: 'a8a46fd6-1350-11df-a1f1-0026b9348838',
display: 'HPV'
},
{
type: 'Other',
conceptUuid: '',
display: 'Others'
}
];
}
public get hpvTestSampleTypes() {
return [
{
id: 1,
display: 'Cervical Swab'
}
];
}

public get sampleTypes() {
return [
Expand Down Expand Up @@ -181,6 +195,41 @@ export class LabOrdersSearchHelperService {
};
}

public createHpvPayload(
order: any,
encounterObs: any,
encounterLocationUuid: any,
patientIdentifier: any,
patientName: any,
sex: any,
birthDate: any,
dateRecieved: any,
sampleType: any,
isPregnant = 0,
breastfeeding = 0
) {
const vlJustificationUuid: any = this.findObsValueByConceptUuid(
encounterObs,
'0a98f01f-57f1-44b7-aacf-e1121650a967'
);

return {
type: 'HPV',
locationUuid: encounterLocationUuid,
orderNumber: order.orderNumber,
providerIdentifier: order.orderer.identifier,
patientName: patientName,
patientIdentifier: patientIdentifier,
sex: sex,
birthDate: this.formatDate(birthDate),
sampleType: sampleType,
vlJustificationUuid: vlJustificationUuid,
isPregnant: isPregnant,
breastfeeding: breastfeeding,
dateDrawn: this.formatDate(order.dateActivated),
dateReceived: this.formatDate(dateRecieved)
};
}
public createViralLoadPayload(
order,
encounterObs,
Expand Down
48 changes: 48 additions & 0 deletions src/app/lab-order-search/lab-order-search-post.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,34 @@ <h5>
</div>
<div class="clear"></div>
<!-- DNAPCR ends -->
<!-- HPV starts-->
<div class="panel-info" *ngIf="isHPVtest">
<h5>
<span>HPV Summary Info</span>
</h5>
<table class="table">
<tbody>
<tr class="after_table row_0">
<td>Entry Point:</td>
<td>{{ HPVData.entryPoint }}</td>
</tr>
<tr>
<td>HIV Status:</td>
<td>{{ HPVData.hivStatus }}</td>
</tr>
<tr>
<td>Type Of Screening:</td>
<td>{{ HPVData.typeOfScreening }}</td>
</tr>
<tr>
<td>Sample Collection Method:</td>
<td>{{ HPVData.sampleCollectionMethod }}</td>
</tr>
</tbody>
</table>
</div>
<div class="clear"></div>
<!-- HPV ends -->
<div *ngIf="!isBusy" class="container-fluid">
<div class="row">
<div>
Expand Down Expand Up @@ -214,6 +242,26 @@ <h5>
</div>
</div>
</div>
<div class="row" *ngIf="orderType.type === 'HPV'">
<div>
<div class="form-group">
<label for="hpvTestSampleType">Sample Type</label>
<select
class="form-control"
id="hpvTestSampleType"
[(ngModel)]="selectedSampleType"
>
<option [ngValue]=""></option>
<option
*ngFor="let sample of hpvTestSampleTypes"
[ngValue]="sample.id"
>
{{ sample.display }}
</option>
</select>
</div>
</div>
</div>
<div class="row">
<div>
<div class="form-group">
Expand Down
85 changes: 85 additions & 0 deletions src/app/lab-order-search/lab-order-search-post.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,27 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
public hivSummary: any;
public error: any;
public hasDnaPcr = false;
public isHPVtest = false;
public dnaPcrData: any = {
hivStatusOfMother: '',
infantProphylaxis: '',
infantFeeding: ''
};
public HPVData: any = {
entryPoint: '',
hivStatus: '',
typeOfScreening: '',
sampleCollectionMethod: '',
dateOfSampleCollection: ''
};

public isPregnant = false;
public isBreastfeeding = false;

public labLocations: any;
public patientIdentifers = [];
public sampleTypes: any;
public hpvTestSampleTypes: any;
public orderTypes: any;
public isBusy = true;

Expand All @@ -104,6 +113,7 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
this.labLocations = this.labOrdersSearchHelperService.labLocations;
this.sampleTypes = this.labOrdersSearchHelperService.sampleTypes;
this.orderTypes = this.labOrdersSearchHelperService.orderTypes;
this.hpvTestSampleTypes = this.labOrdersSearchHelperService.hpvTestSampleTypes;
}

public ngOnInit() {
Expand Down Expand Up @@ -152,6 +162,7 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
this.displayPregnancy();
this.loadHivSummary(this.person.uuid);
this.displayDnaPcrInputs();
this.displayHPVInputs();
this.setDefaultLocation();
}

Expand Down Expand Up @@ -224,7 +235,64 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
}
);
}
public displayHPVInputs() {
const ot = this.orderType.type;
if (ot !== 'HPV') {
return;
} else {
this.isHPVtest = true;

this.HPVData.entryPoint = this.hpvValue(
this.findObs(
this.order.encounter.obs,
'a8a17e48-1350-11df-a1f1-0026b9348838'
).display
);
this.HPVData.hivStatus = this.hpvValue(
this.findObs(
this.order.encounter.obs,
'9e4d6436-4040-46a3-a0ae-6dbc0acfe593'
).display
);
this.HPVData.typeOfScreening = this.hpvValue(
this.findObs(
this.order.encounter.obs,
'6048b6bd-c698-48c9-8d20-424ab0b3d628'
).display
);
this.HPVData.sampleCollectionMethod = this.hpvValue(
this.findObs(
this.order.encounter.obs,
'aa14f397-5d82-4cd3-8dc8-bb381a935717'
).display
);
this.HPVData.dateOfSampleCollection = this.hpvValue(
this.findObs(
this.order.encounter.obs,
'e07623c2-38af-4caa-8d8d-d01791441c59'
).display
);
}
}
public hpvValue(displayString: any) {
const parts = displayString.split(':');
return parts.length > 1 ? parts[1].trim() : displayString;
}
public getHpvConceptValues(uuid: string, property: string) {
this.conceptResourceService
.getConceptByUuid(uuid)
.pipe(take(1))
.subscribe(
(data) => {
if (data) {
this.dnaPcrData[property] += `${data.name.display} ,`;
}
},
(error) => {
console.error('Failed to load concepts ', error);
}
);
}
public displayDnaPcrInputs() {
const ot = this.orderType.type;
if (ot !== 'DNAPCR') {
Expand Down Expand Up @@ -298,8 +366,10 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
if (!this.hasLoadingTimeRequiredInputs()) {
return;
}

const payload = this.getPayload();
const location = this.selectedLabLocation;
console.log('uchunguzi ', payload);
this.isBusy = true;
this.labOrderPostService
.postOrderToEid(location, payload)
Expand Down Expand Up @@ -387,6 +457,21 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
this.isBreastfeeding ? 1 : 0
);
}
if (this.orderType.type === 'HPV') {
payload = this.labOrdersSearchHelperService.createHpvPayload(
order,
obs,
locationUuid,
patientIdentifier,
patientName,
gender,
birthdate,
this.dateReceived,
this.selectedSampleType,
this.isPregnant ? 1 : 0,
this.isBreastfeeding ? 1 : 0
);
}

if (this.orderType.type === 'CD4') {
payload = this.labOrdersSearchHelperService.createCD4Payload(
Expand Down
Loading