Skip to content

Commit

Permalink
add country features with full sns libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
levine12 committed Mar 5, 2020
1 parent a8ee158 commit 37d870b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 141 deletions.
4 changes: 2 additions & 2 deletions omod/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk -->

<!--

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.327</version>
</dependency>

-->


<dependency>
<groupId>org.openmrs.web</groupId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
import org.openmrs.module.patientlist.DoctorRequestedByPatient;
import org.springframework.aop.AfterReturningAdvice;

/*
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.sns.AmazonSNSClient;
import com.amazonaws.services.sns.model.CreateTopicRequest;
import com.amazonaws.services.sns.model.CreateTopicResult;
*/

import java.util.Random;
import org.apache.commons.codec.binary.Hex;
Expand Down Expand Up @@ -55,7 +53,7 @@ public void afterReturning(Object returnValue, Method method, Object[] args, Obj
}

}
/*

private void sendAwsSms(String phoneNumber, String msg) {
System.out.println("Sending message to physician, Tel No.: " + phoneNumber);

Expand All @@ -76,6 +74,5 @@ private void sendAwsSms(String phoneNumber, String msg) {
snsClient.deleteTopic(createTopicResult.getTopicArn());

}
*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
import java.util.Random;
import java.util.Set;

/*
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.sns.AmazonSNSClient;
import com.amazonaws.services.sns.model.CreateTopicRequest;
import com.amazonaws.services.sns.model.CreateTopicResult;
import org.apache.commons.codec.binary.Hex;
*/

import org.openmrs.Encounter;
import org.openmrs.Obs;
Expand All @@ -28,7 +26,6 @@
*/
public class SendSMSLabsDrugsAdvice implements MethodBeforeAdvice {

/*
private void sendAwsSms(String phoneNumber, String msg) {

// Generate a random topic name to avoid collisions
Expand All @@ -48,7 +45,7 @@ private void sendAwsSms(String phoneNumber, String msg) {
snsClient.deleteTopic(createTopicResult.getTopicArn());

}
*/

/*
Need to get encounter type so we only send SMS when it's either a drug or lab order
encounter
Expand Down Expand Up @@ -95,7 +92,7 @@ public void before(Method method, Object[] args, Object o) throws Throwable {
System.out.println("********** SENDING SMS");

try {
//sendAwsSms(patientTelNo, encTypeName + ": " + obs.getValueText());
sendAwsSms(patientTelNo, encTypeName + ": " + obs.getValueText());
}
catch (Exception e) {
System.out.println("There was an error sending the sms message:");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,6 @@ public void controller(HttpServletRequest request, FragmentModel model, HttpSess
person.getPersonId());
String userCountries = pp.get(0).getCountries();
/*
PersonAddress address;
address = new PersonAddress();
address.setPerson(person);
address.setAddress6("Ghana,Uganda,Nigeriar");
address.setCreator(user);
address.setDateCreated(new Date());
address = Context.getPersonService().savePersonAddress(address);
if (address == null) {
address = new PersonAddress();
address.setPerson(person);
address.setAddress6("Ghana,Uganda,Nigeriayy");
address.setCreator(user);
address.setDateCreated(new Date());
Context.getPersonService().savePersonAddress(address);
} else {
address.setAddress6(address.getAddress6() + "x");
Context.getPersonService().savePersonAddress(address);
}
person = Context.getPersonService().getPersonByUuid(person.getUuid());
System.out.println("Person: " + person.getGivenName() + " " + person.getFamilyName() + " Country: "
+ person.getPersonAddress().getAddress6());
PersonAttributeType attType = Context.getPersonService().getPersonAttributeTypeByName("Country");
PersonAttribute p = new PersonAttribute();
p.setPerson(person1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public void controller(HttpServletRequest request, PageModel model, HttpSession
PersonCountries personCountries;
int personId;
for (Patient patient : patients) {
if (patient.getPersonVoided() || patient.getVoided()) {
continue;
}
personId = patient.getPersonId();
pp = Context.getService(PersonCountriesService.class).getPersonCountriesForPerson(personId);
if ((pp == null) || pp.isEmpty()) {
Expand Down
22 changes: 6 additions & 16 deletions omod/src/main/resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,13 @@
<aware_of_module>org.openmrs.module.legacyui</aware_of_module>
</aware_of_modules>

<!--
<advice>
<point>org.openmrs.api.PatientService</point>
<class>org.openmrs.module.patientlist.advice.PatientAfterSaveAdvice</class>
</advice>
-->


<!--
<advice>
<point>org.openmrs.module.patientlist.api.DoctorRequestedByPatientService</point>
<class>org.openmrs.module.patientlist.advice.DoctorRequestedAfterSaveAdvise</class>
</advice>
-->



<advice>
Expand All @@ -69,24 +62,21 @@
<point>org.openmrs.api.VisitService</point>
<class>org.openmrs.module.patientlist.advice.PatientStartingVisitAdvise</class>
</advice>

<!--
THIS IS NOT BEING USED - WE JUST WANT TO KNOW WHEN WE'RE SAVING ENCOUNTERS FOR LAB/MEDS (SEE NEXT ADVICE
FOR ENCOUNTER
<advice>
<point>org.openmrs.api.ObsService</point>
<class>org.openmrs.module.patientlist.advice.SendSMSLabsDrugsAdvice</class>
</advice>
-->
-->

<advice>
<point>org.openmrs.api.EncounterService</point>
<class>org.openmrs.module.patientlist.advice.SendSMSLabsDrugsAdvice</class>
</advice>

<!--
<advice>
<point>org.openmrs.api.EncounterService</point>
<class>org.openmrs.module.patientlist.advice.DoctorConsultResponseAfterSaveAdvise</class>
</advice>
-->

<globalProperty>
<property>patientlist.clerkrole</property>
<defaultValue></defaultValue>
Expand Down
3 changes: 1 addition & 2 deletions omod/src/main/webapp/pages/enterPersonnelInfo.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ function isValidSubmit() {
<select onchange="selectPersonnel(this.value)">
<option value="0">Select Personnel</option>
<% personnel.each { personel->%>
<option value="${personel.userId}/${personel.telno}/${personel.countries}">${personel.givenName + " " + personel.familyName
+ " " + personel.countries + " " + personel.telno} </option>
<option value="${personel.userId}/${personel.telno}/${personel.countries}">${personel.givenName + " " + personel.familyName} </option>
<% } %>
</select>
<% } %>
Expand Down

0 comments on commit 37d870b

Please sign in to comment.