Skip to content

Commit

Permalink
Merge branch 'master' into POC-155
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqedme authored Jul 19, 2024
2 parents 618892d + f299779 commit a664dde
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 13 deletions.
16 changes: 15 additions & 1 deletion src/app/constants/program.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ const PMTCT_PROGRAM: Program = {
dept: 'HIV',
compatibleWithOtherDeptPrograms: false
};
const ANC_PROGRAM: Program = {
uuid: '52aeb285-fb18-455b-893e-3e53ccc77ceb',
name: 'ANTENATAL CARE PROGRAM',
dept: 'HIV',
compatibleWithOtherDeptPrograms: false
};
const PNC_PROGRAM: Program = {
uuid: 'd2552058-d7bd-47c6-aed1-480a4308027a',
name: 'POSTNATAL PROGRAM',
dept: 'HIV',
compatibleWithOtherDeptPrograms: false
};
const STANDARD_HIV_PROGRAM: Program = {
uuid: '781d85b0-1359-11df-a1f1-0026b9348838',
name: 'STANDARD HIV TREATMENT',
Expand Down Expand Up @@ -122,5 +134,7 @@ export const Programs = {
EXPRESS_CARE_PROGRAM,
DTG_PHARMACO_VIGILANCE_PROGRAM,
HIV_SOCIAL_WORK_PROGRAM,
NUTRITION_PROGRAM
NUTRITION_PROGRAM,
ANC_PROGRAM,
PNC_PROGRAM
};
6 changes: 5 additions & 1 deletion src/app/constants/referral-concepts.contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const PPP_REFERRAL_CONCEPT = '4e6d1c61-624c-4350-a604-374f835aa481';
const PATIENT_PREFERENCE_CONCEPT = '7e7d4555-362a-498a-b5ed-abcddcfce2a7';
const STANDARD_HIV_CARE_REFERRAL_CONCEPT =
'b412ae76-4ab4-4d00-800e-bd8d167769e1';
const ANC_CONCEPT = '375e6d4a-ba94-41ac-8ac3-5a56015c4d92';
const PNC_CONCEPT = 'c5789e91-2c76-450a-94f7-94fce32335d3';

export const ReferralConcepts = {
differentiatedCareConceptUuid,
Expand All @@ -27,5 +29,7 @@ export const ReferralConcepts = {
BACK_TO_CCC_REFERRAL_CONCEPT,
PPP_REFERRAL_CONCEPT,
PATIENT_PREFERENCE_CONCEPT,
STANDARD_HIV_CARE_REFERRAL_CONCEPT
STANDARD_HIV_CARE_REFERRAL_CONCEPT,
ANC_CONCEPT,
PNC_CONCEPT
};
1 change: 1 addition & 0 deletions src/app/interfaces/return-value.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface ReturnValue {
providerUuid: string;
locationUuid: string;
hivReferralLocationUuid: string;
pmtctProgrammeUuid: string;
}
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
94 changes: 93 additions & 1 deletion 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 All @@ -129,8 +139,15 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges {
this.patientIdentifers = identifiers;
});
this.patient = this.order.patient;

this.person = new Person(this.order.patient.person);
if (Moment().diff(Moment(this.person.birthdate), 'months') <= 18) {
if (
Moment().diff(Moment(this.person.birthdate), 'months') <= 18 &&
!(
this.patient.identifiers[0].identifierType.uuid ===
this.cccIdentifierType
)
) {
this.isHEIActive = true;
} else {
this.isHEIActive = false;
Expand All @@ -145,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 @@ -217,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 @@ -291,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 @@ -380,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

0 comments on commit a664dde

Please sign in to comment.