Skip to content

Commit

Permalink
BAH-3079 | Ability to indicate medications to be added to drug chart …
Browse files Browse the repository at this point in the history
…while creating Prescription and to display medications in Treatments display control in Patient dashboard along with 'Add to Drug Chart' link (#217)

* BAH-3079 | modify. get inpatient drug orders in active and inactive drug orders list

* BAH-3079 | modify. get inpatient drug orders in active and inactive drug orders list

* add. Workflow and pom changes for omod
  • Loading branch information
Arjun-Go authored Jul 10, 2023
1 parent f5a20a3 commit 70f75a9
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 15 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
name: Build and Publish package
on:
push:
branches: [ master ]
branches: [ Bahmni-IPD-master ]
workflow_dispatch:

jobs:
Trivy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Trivy Scan
run: |
wget -q https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/trivy_scan.sh && chmod +x trivy_scan.sh
./trivy_scan.sh
rm trivy_scan.sh
build-publish-package:
name: Build and Publish package
runs-on: macos-11
needs: Trivy
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down Expand Up @@ -36,4 +47,3 @@ jobs:
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

2 changes: 1 addition & 1 deletion .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Validate PR
on:
pull_request:
branches: [ master ]
branches: [ Bahmni-IPD-master ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion bahmnicore-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>bahmni</artifactId>
<version>1.1.0</version>
</parent>
<artifactId>bahmnicore-api</artifactId>
<artifactId>bahmnicore-ipd-api</artifactId>
<packaging>jar</packaging>
<name>Bahmni EMR Core API</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,17 @@ public Map<String,DrugOrder> getDiscontinuedDrugOrders(List<DrugOrder> drugOrder
public List<DrugOrder> getInactiveDrugOrders(String patientUuid, Set<Concept> concepts, Set<Concept> drugConceptsToBeExcluded,
Collection<Encounter> encounters) {
Patient patient = openmrsPatientService.getPatientByUuid(patientUuid);
CareSetting careSettingByName = orderService.getCareSettingByName(CareSetting.CareSettingType.OUTPATIENT.toString());
CareSetting outPatientCareSetting = orderService.getCareSettingByName(CareSetting.CareSettingType.OUTPATIENT.toString());
CareSetting inPatientCareSetting = orderService.getCareSettingByName(CareSetting.CareSettingType.INPATIENT.toString());
Date asOfDate = new Date();
List<Order> orders = orderDao.getInactiveOrders(patient, orderService.getOrderTypeByName("Drug order"),
careSettingByName, asOfDate, concepts, drugConceptsToBeExcluded, encounters);
return mapOrderToDrugOrder(orders);
List<Order> outPatientOrders = orderDao.getInactiveOrders(patient, orderService.getOrderTypeByName("Drug order"),
outPatientCareSetting, asOfDate, concepts, drugConceptsToBeExcluded, encounters);
List<Order> inPatientOrders = orderDao.getInactiveOrders(patient, orderService.getOrderTypeByName("Drug order"),
inPatientCareSetting, asOfDate, concepts, drugConceptsToBeExcluded, encounters);
List<Order> allActiveDrugOrders = new ArrayList<>();
allActiveDrugOrders.addAll(outPatientOrders);
allActiveDrugOrders.addAll(inPatientOrders);
return mapOrderToDrugOrder(allActiveDrugOrders);
}

@Override
Expand Down Expand Up @@ -204,10 +210,16 @@ private List<OrderFrequencyData> getFrequencies() {
private List<DrugOrder> getActiveDrugOrders(String patientUuid, Date asOfDate, Set<Concept> conceptsToFilter,
Set<Concept> conceptsToExclude, Date startDate, Date endDate, Collection<Encounter> encounters) {
Patient patient = openmrsPatientService.getPatientByUuid(patientUuid);
CareSetting careSettingByName = orderService.getCareSettingByName(CareSetting.CareSettingType.OUTPATIENT.toString());
List<Order> orders = orderDao.getActiveOrders(patient, orderService.getOrderTypeByName("Drug order"),
careSettingByName, asOfDate, conceptsToFilter, conceptsToExclude, startDate, endDate, encounters);
return mapOrderToDrugOrder(orders);
CareSetting outPatientCareSetting = orderService.getCareSettingByName(CareSetting.CareSettingType.OUTPATIENT.toString());
CareSetting inPatientCareSetting = orderService.getCareSettingByName(CareSetting.CareSettingType.INPATIENT.toString());
List<Order> outPatientOrders = orderDao.getActiveOrders(patient, orderService.getOrderTypeByName("Drug order"),
outPatientCareSetting, asOfDate, conceptsToFilter, conceptsToExclude, startDate, endDate, encounters);
List<Order> inPatientOrders = orderDao.getActiveOrders(patient, orderService.getOrderTypeByName("Drug order"),
inPatientCareSetting, asOfDate, conceptsToFilter, conceptsToExclude, startDate, endDate, encounters);
List<Order> allActiveDrugOrders = new ArrayList<>();
allActiveDrugOrders.addAll(outPatientOrders);
allActiveDrugOrders.addAll(inPatientOrders);
return mapOrderToDrugOrder(allActiveDrugOrders);
}

private List<DrugOrder> mapOrderToDrugOrder(List<Order> orders){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.times;
import static org.mockito.MockitoAnnotations.initMocks;

public class BahmniDrugOrderServiceImplTest {
Expand Down Expand Up @@ -85,7 +86,7 @@ public void shouldGetActiveDrugOrdersOfAPatientProgram() throws ParseException {
bahmniDrugOrderService.getDrugOrders(PATIENT_UUID, true, conceptsToFilter, null, PATIENT_PROGRAM_UUID);

final Date value = dateArgumentCaptor.getValue();
verify(orderDao).getActiveOrders(mockPatient, mockOrderType, mockCareSetting, value, conceptsToFilter, null, null, null, encounters);
verify(orderDao, times(2)).getActiveOrders(mockPatient, mockOrderType, mockCareSetting, value, conceptsToFilter, null, null, null, encounters);
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions bahmnicore-omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>bahmni</artifactId>
<version>1.1.0</version>
</parent>
<artifactId>bahmnicore-omod</artifactId>
<artifactId>bahmnicore-ipd-omod</artifactId>
<packaging>jar</packaging>
<name>Bahmni EMR Core OMOD</name>

Expand Down Expand Up @@ -61,7 +61,7 @@
</dependency>
<dependency>
<groupId>org.bahmni.module</groupId>
<artifactId>bahmnicore-api</artifactId>
<artifactId>bahmnicore-ipd-api</artifactId>
<version>${project.parent.version}</version>
<exclusions>
<exclusion>
Expand Down
7 changes: 7 additions & 0 deletions trivy-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
allow-rules:
- id:
description:
regex:
- id:
description:
path:

0 comments on commit 70f75a9

Please sign in to comment.