Skip to content

Commit

Permalink
Merge pull request #630 from Bahmni/feature/ipd-microfrontend
Browse files Browse the repository at this point in the history
IPD microfrontend setup
  • Loading branch information
bassoGeorge authored and Arjun-Go committed Mar 26, 2024
1 parent 07263ae commit 7ed4afa
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ui/app/ot/controller/listViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ angular.module('bahmni.ot')
var attributesRelatedToBed = [{heading: 'Status Change Notes', sortInfo: 'notes'},
{heading: 'Bed Location', sortInfo: 'bedLocation'},
{heading: 'Bed ID', sortInfo: 'bedNumber'}];

return listViewAttributes.concat(getSurgicalAttributesTableInfo(), attributesRelatedToBed);
var primaryDiagnosisInfo = [{heading: 'Primary Diagnoses', sortInfo: 'patientObservations'}];
return listViewAttributes.concat(getSurgicalAttributesTableInfo(), attributesRelatedToBed, primaryDiagnosisInfo);
}

function getFilteredSurgicalAttributeTypes () {
Expand Down
27 changes: 26 additions & 1 deletion ui/app/ot/mappers/SurgicalBlockMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ Bahmni.OT.SurgicalBlockMapper = function () {
return mappedAttributes;
};

var mapPrimaryDiagnoses = function (diagnosisObs) {
var uniqueDiagnoses = new Map();
_.each(diagnosisObs, function (diagnosis) {
var existingDiagnosis = uniqueDiagnoses.get(diagnosis.display);
if (existingDiagnosis) {
if (existingDiagnosis.obsDatetime < diagnosis.obsDatetime) {
uniqueDiagnoses.set(diagnosis.display, diagnosis);
}
} else {
uniqueDiagnoses.set(diagnosis.display, diagnosis);
}
});
var primaryDiagnosesNames = _.filter(Array.from(uniqueDiagnoses.values()), function (diagnosis) {
var obsGroupList = diagnosis.obsGroup.display.split(": ")[1].split(", ");
return _.includes(obsGroupList, "Primary") && !(_.includes(obsGroupList, "Ruled Out Diagnosis"));
}).map(function (diagnosis) {
if (diagnosis.concept.display == "Non-coded Diagnosis") {
return diagnosis.value;
}
return diagnosis.value.display;
}).join(", ");
return primaryDiagnosesNames;
};

var mapSurgicalAppointment = function (openMrsSurgicalAppointment, attributeTypes, surgeonsList) {
var surgicalAppointmentAttributes = mapOpenMrsSurgicalAppointmentAttributes(openMrsSurgicalAppointment.surgicalAppointmentAttributes, surgeonsList);
return {
Expand All @@ -43,7 +67,8 @@ Bahmni.OT.SurgicalBlockMapper = function () {
status: openMrsSurgicalAppointment.status,
bedLocation: (openMrsSurgicalAppointment.bedLocation || ""),
bedNumber: (openMrsSurgicalAppointment.bedNumber || ""),
surgicalAppointmentAttributes: new Bahmni.OT.SurgicalBlockMapper().mapAttributes(surgicalAppointmentAttributes, attributeTypes)
surgicalAppointmentAttributes: new Bahmni.OT.SurgicalBlockMapper().mapAttributes(surgicalAppointmentAttributes, attributeTypes),
primaryDiagnosis: mapPrimaryDiagnoses(openMrsSurgicalAppointment.patientObservations) || ""
};
};

Expand Down
2 changes: 1 addition & 1 deletion ui/app/ot/services/surgicalAppointmentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ angular.module('bahmni.ot')
v: "custom:(id,uuid," +
"provider:(uuid,person:(uuid,display),attributes:(attributeType:(display),value,voided))," +
"location:(uuid,name),startDatetime,endDatetime,surgicalAppointments:(id,uuid,patient:(uuid,display,person:(age))," +
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes))"
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes,patientObservations))"
},
withCredentials: true
});
Expand Down
3 changes: 3 additions & 0 deletions ui/app/ot/views/listView.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<td>
{{appointment.bedNumber}}
</td>
<td class="list-view-primary-diagnosis">
{{appointment.primaryDiagnosis}}
</td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 4 additions & 0 deletions ui/app/styles/ot/_ot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,10 @@ div[ng-app="ot"] {
.status-cancelled {
background: #fcb6b6;
}
.list-view-primary-diagnosis {
min-width: 300px;
white-space: normal;
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions ui/test/unit/ot/controller/listViewController.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ describe('listViewController', function () {
expect(isCancelled).toBeFalsy();
});

it("should have bed location and bed id in table info", function () {
it("should have bed location, bed id and primary diagnoses in table info", function () {
scope.filterParams = {
providers: [],
locations: {"OT 1": true, "OT 2": true, "OT 3": true},
Expand All @@ -659,11 +659,13 @@ describe('listViewController', function () {
};
rootScope.attributeTypes = defaultAttributeTypes;
createController();
expect(scope.tableInfo.length).toBe(21);
expect(scope.tableInfo.length).toBe(22);
expect(scope.tableInfo[19].heading).toBe("Bed Location");
expect(scope.tableInfo[19].sortInfo).toBe("bedLocation");
expect(scope.tableInfo[20].heading).toBe("Bed ID");
expect(scope.tableInfo[20].sortInfo).toBe("bedNumber");
expect(scope.tableInfo[21].heading).toBe("Primary Diagnoses");
expect(scope.tableInfo[21].sortInfo).toBe("patientObservations");
});

it('should have all the surgical attributes in table info', function () {
Expand All @@ -674,7 +676,7 @@ describe('listViewController', function () {
};
rootScope.attributeTypes = defaultAttributeTypes;
createController();
expect(scope.tableInfo.length).toBe(21);
expect(scope.tableInfo.length).toBe(22);
expect(scope.tableInfo[11].heading).toBe('procedure');
expect(scope.tableInfo[11].sortInfo).toBe('surgicalAppointmentAttributes.procedure.value');
expect(scope.tableInfo[12].heading).toBe('otherSurgeon');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('surgicalAppointmentService', function () {
expect(mockHttp.get.calls.mostRecent().args[1].params).toEqual({ startDatetime : '2039-08-26T12:00:00.000+0000', endDatetime : '2039-08-26T15:00:00.000+0000',includeVoided: false, activeBlocks: true, v: "custom:(id,uuid," +
"provider:(uuid,person:(uuid,display),attributes:(attributeType:(display),value,voided))," +
"location:(uuid,name),startDatetime,endDatetime,surgicalAppointments:(id,uuid,patient:(uuid,display,person:(age))," +
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes))"});
"actualStartDatetime,actualEndDatetime,status,notes,sortWeight,bedNumber,bedLocation,surgicalAppointmentAttributes,patientObservations))"});
expect(mockHttp.get.calls.mostRecent().args[1].withCredentials).toBeTruthy();
});

Expand Down

0 comments on commit 7ed4afa

Please sign in to comment.