Skip to content

Commit

Permalink
Adding counselling workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
slubwama authored and solemabrothers committed Jan 14, 2020
1 parent 7671565 commit 503d52e
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@

import org.openmrs.Patient;
import org.openmrs.Person;
import org.openmrs.annotation.Authorized;
import org.openmrs.api.OpenmrsService;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.PrivilegeConstants;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;


/**
* This service exposes module's core functionality. It is a Spring managed bean which is configured in moduleApplicationContext.xml.
Expand Down Expand Up @@ -59,4 +64,5 @@ public interface AijarService extends OpenmrsService {
* This method when called generates and saves UIC (Unique Identifier Code) for all patients who dont have the UIC
*/
public void generateAndSaveUICForPatientsWithOut();

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public void install() throws Exception {
install(Locations.PHARMACY);
install(Locations.RECEPTION);
install(Locations.TRIAGE);
install(Locations.COUNSELING_CENTER);

// Install Encounter Role
install(encounterRole(EncounterRoles.ASSISTANT_CIRCUMCISER_NAME,EncounterRoles.ASSISTANT_CIRCUMCISER_DESCRIPTION,EncounterRoles.ASSISTANT_CIRCUMCISER_UUID));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
import java.util.Date;
import java.util.Calendar;


import org.openmrs.Patient;
import org.openmrs.PatientIdentifierType;
import org.openmrs.PatientIdentifier;
import org.openmrs.Person;
import org.openmrs.Relationship;
import org.openmrs.User;
import org.openmrs.api.PatientService;
import org.openmrs.api.PersonService;
import org.openmrs.PatientIdentifierType;
import org.openmrs.PatientIdentifier;
import org.openmrs.api.VisitService;
import org.openmrs.api.context.Context;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.apache.commons.logging.Log;
Expand All @@ -37,6 +37,8 @@
import org.openmrs.module.aijar.metadata.core.Locations;
import org.openmrs.module.aijar.metadata.core.PatientIdentifierTypes;
import org.openmrs.notification.Alert;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.OpenmrsUtil;
import org.springframework.beans.factory.annotation.Autowired;


Expand Down Expand Up @@ -300,5 +302,4 @@ private String replaceLettersWithNumber(String letter) {
}
return numberToReturn;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,38 @@ public List<LocationTagDescriptor> tags() {

};

public static LocationDescriptor COUNSELING_CENTER = new LocationDescriptor(){

@Override
public String uuid() {
return "7c231e1a-1db5-11ea-978f-2e728ce88125";
}

@Override
public String description() {
return "A location where counseling and screening is done for a patient";
}

@Override
public String name() {
return "Counseling Center";
}

@Override
public LocationDescriptor parent() {
return PARENT;
}

@Override
public List<LocationTagDescriptor> tags() {

return Arrays.asList(
LocationTags.LOGIN_LOCATION,
LocationTags.VISIT_LOCATION
);

}

};

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.openmrs.module.aijar.tasks;

import org.openmrs.Visit;
import org.openmrs.api.VisitService;
import org.openmrs.api.context.Context;
import org.openmrs.scheduler.tasks.AbstractTask;
import org.openmrs.util.OpenmrsUtil;

import java.util.List;

public class StopActiveFacilityVisitTask extends AbstractTask {
@Override
public void execute() {
VisitService visitService = Context.getVisitService();
List<Visit> visitList = visitService.getAllVisits();
for (Visit visit : visitList) {
if (visit.getStopDatetime() == null && visit.getVisitType()==visitService.getVisitTypeByUuid("7b0f5697-27e3-40c4-8bae-f4049abfb4ed")) {
visitService.endVisit(visit, OpenmrsUtil.getLastMomentOfDay(visit.getStartDatetime()));
}
}
}
}
23 changes: 23 additions & 0 deletions api/src/main/resources/liquibase.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,27 @@
</insert>

</changeSet>

<changeSet id="ugandaemr-2019-16-16-1425" author="slubwama">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
SELECT COUNT(*) FROM scheduler_task_config
WHERE schedulable_class = 'org.openmrs.module.aijar.tasks.StopActiveFacilityVisitTask'
</sqlCheck>
</preConditions>
<comment>Close all active facility visits</comment>
<insert tableName="scheduler_task_config">
<column name="name" value="Close Active Facility Visits" />
<column name="description" value="generates_uics into patient identifier table" />
<column name="schedulable_class" value="org.openmrs.module.aijar.tasks.StopActiveFacilityVisitTask" />
<column name="start_time_pattern" value="MM/dd/yyyy HH:mm:ss" />
<column name="start_time" valueDate="2019-11-08T16:59:59" />
<column name="repeat_interval" value="86400" />
<column name="date_created" valueDate="CURRENT_TIMESTAMP" />
<column name="created_by" value="1" />
<column name="start_on_startup" value="1"/>
<column name="started" value="1"/>
<column name="uuid" value="1434dd72-1ff7-11ea-978f-2e728ce88125" />
</insert>
</changeSet>
</databaseChangeLog>
11 changes: 10 additions & 1 deletion api/src/main/resources/metadata/Role_Privilege.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<privilege privilege="App: ugandaemr.widget.eidSummary" description="Access eidSummary On Patient Dashboard" uuid="2dc27a93-a7d3-496e-b5ba-f8449ec90c12"/>
<privilege privilege="App: ugandaemr.widget.mchSummary" description="Access MCH Summary on patient Dashboard" uuid="014fa1f5-7862-47d9-a977-a0b75bc33af9"/>

<!--Counseling Center-->
<privilege privilege="App: ugandaemrpoc.counselingCenter" description="Access to the counseling center" uuid="b663fd6f-05fd-4553-be68-215464059977"/>

<!--* HOME PAGE *-->
<privilege privilege="App: ugandaemr.report.cohortBuilder" description="Access Link to Manage cohort builder reports" uuid="515a0ce8-a4e5-4b7e-b210-3f64ad96302e"/>
<privilege privilege="App: ugandaemr.backup.backupDatabase" description="Access App to the Backup" uuid="96c5dbe1-2c73-4f95-9b37-b24277617f6d"/>
Expand Down Expand Up @@ -120,6 +123,7 @@
<role role="HTS Data Manager" description="This role enables a user access general reports and HTS Specific reports" uuid="1255d77e-6037-4774-a3df-6998b4fd9d11"/>
<role role="General Data Manager" description="This is the over all data manager role. It enables one to access all reports in the system" uuid="c951823d-4798-4fc2-bf9d-91c311c50631"/>
<role role="Organizational:Pharmacy" description="This is the over all data manager role. It enables one to access all reports in the system" uuid="cf349e5e-e59a-4019-a218-dd57935488da"/>
<role role="Counselor" description="This role allows access to the counseling center" uuid="cab08bba-e2d9-4b32-83ec-ced29d69e283"/>


<!-- ROLE PRIVILEGES -->
Expand Down Expand Up @@ -231,6 +235,12 @@


<!--* COUNSELOR ROLE *-->
<!--role-role-->
<role_role parent_role="Base Role" child_role="Counselor"/>

<!-- role privilege -->
<role_privilege role="Counselor" privilege="App: ugandaemrpoc.counselingCenter"/>
<role_privilege role="Counselor" privilege="Task: HIV Clinic Access"/>


<!--* LABORATORY ROLE *-->
Expand Down Expand Up @@ -270,7 +280,6 @@
<role_privilege role="HIV Clinic" privilege="App: ugandaemr.widget.directionsToResidence"/>
<role_privilege role="HIV Clinic" privilege="App: ugandaemrpoc.artclinic"/>


<!--* OPD Clinic *-->
<!--role-role-->
<role_role parent_role="Base Role" child_role="OPD Clinic"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
formUILocation="patientDashboard.visitActions"
formOrder="3"
formIcon="icon-medkit"
formShowIf="(visit.active || !visit.active) &amp;&amp; patient.person.dead==false &amp;&amp; sessionLocation.uuid=='86863db4-6101-4ecf-9a86-5e716d6504e4'"
formShowIf="(visit.active || !visit.active) &amp;&amp; patient.person.dead==false &amp;&amp; (sessionLocation.uuid=='86863db4-6101-4ecf-9a86-5e716d6504e4' || sessionLocation.uuid=='7c231e1a-1db5-11ea-978f-2e728ce88125')"
formDisplayStyle="Standard">

<ifMode mode="ENTER,EDIT" include="false">
Expand Down

0 comments on commit 503d52e

Please sign in to comment.