diff --git a/omod/pom.xml b/omod/pom.xml index 01f9a01..dcebc31 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -27,14 +27,14 @@ - + org.openmrs.web diff --git a/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorConsultResponseAfterSaveAdvise.java b/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorConsultResponseAfterSaveAdvise.java deleted file mode 100644 index 36b0cbe..0000000 --- a/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorConsultResponseAfterSaveAdvise.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.openmrs.module.patientlist.advice; - -import java.lang.reflect.Method; -import java.util.Date; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.openmrs.Encounter; -import org.openmrs.EncounterType; -import org.openmrs.Patient; -import org.openmrs.User; -import org.openmrs.Visit; -import org.openmrs.api.context.Context; -//import org.openmrs.module.internlmsgs.InternlMessage; -//import org.openmrs.module.internlmsgs.api.InternlMessageService; -import org.springframework.aop.AfterReturningAdvice; - -/** - * @author levine - */ -public class DoctorConsultResponseAfterSaveAdvise implements AfterReturningAdvice { - - private Log log = LogFactory.getLog(this.getClass()); - - public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { - /* - if (!method.getName().equals("saveEncounter")) { - return; - } - Encounter encounter = (Encounter) args[0]; - String encTypeName = encounter.getEncounterType().getName(); - //if (!encTypeName.equals("Telemedicine Consult")) { - if (!encTypeName.equals("Drug order")) { - - return; - } - System.out.println("SAVE ENCOUNTER: " + encTypeName); - - String subject = "Physician consult request response is posted"; - Visit visit = encounter.getVisit(); - Patient patient = encounter.getPatient(); - User requestingDoctor = visit.getCreator(); - User msgSenderUser = Context.getUserService().getUserByUsername("omgbemena"); - String body = "The consult request regarding patient: " + patient.getGivenName() + " " + patient.getFamilyName() - + " has been provided.\n"; - sendMessage(msgSenderUser, requestingDoctor, patient, subject, body); - */ - return; - } - - void sendMessage(User msgSenderUser, User requestingDoctor, Patient patient, String subject, String body) { - - System.out.println("************CONSULT RESPONSE: msgSenderUserUser: " + msgSenderUser.getId() - + " requestingDoctor: " + requestingDoctor + " patient: " + patient.getGivenName() + " " - + patient.getFamilyName() + " subject: " + subject + " body: " + body); - - String recipientUserIds = requestingDoctor.getUserId() + ","; - - /* - InternlMessage msg = new InternlMessage(); - - msg.setSenderUserId(msgSenderUser.getId()); - msg.setIsDeleted(0); - msg.setIsDraft(0); - msg.setMsgTag("sent-" + msgSenderUser.getId()); - - msg.setMsgBody("%" + body); - msg.setMsgDate(new Date()); - msg.setMsgSubject(subject); - msg.setMsgPriority(0); - msg.setIsTrashed(0); - msg.setMsgRecipients(recipientUserIds); - msg.setMsgHasBeenRead(0); - System.out.println("BEFORE MESSAGE SAVED\n" + msg.stringRep()); - InternlMessage m = Context.getService(InternlMessageService.class).saveInternlMessage(msg); - System.out.println("MESSAGE SAVED SUCCESSFULLY\n" + msg.stringRep()); - m = msg.copy(); - m.setMsgTag("recip-" + requestingDoctor.getUserId()); - Context.getService(InternlMessageService.class).saveInternlMessage(m); - System.out.println("********NEW MESSAGE\n " + m.stringRep()); - */ - - } -} diff --git a/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorRequestedAfterSaveAdvise.java b/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorRequestedAfterSaveAdvise.java index 1bb0cf0..ac42dc5 100644 --- a/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorRequestedAfterSaveAdvise.java +++ b/omod/src/main/java/org/openmrs/module/patientlist/advice/DoctorRequestedAfterSaveAdvise.java @@ -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; @@ -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); @@ -76,6 +74,5 @@ private void sendAwsSms(String phoneNumber, String msg) { snsClient.deleteTopic(createTopicResult.getTopicArn()); } - */ } diff --git a/omod/src/main/java/org/openmrs/module/patientlist/advice/SendSMSLabsDrugsAdvice.java b/omod/src/main/java/org/openmrs/module/patientlist/advice/SendSMSLabsDrugsAdvice.java index 2df365d..bf7d41a 100644 --- a/omod/src/main/java/org/openmrs/module/patientlist/advice/SendSMSLabsDrugsAdvice.java +++ b/omod/src/main/java/org/openmrs/module/patientlist/advice/SendSMSLabsDrugsAdvice.java @@ -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; @@ -28,7 +26,6 @@ */ public class SendSMSLabsDrugsAdvice implements MethodBeforeAdvice { - /* private void sendAwsSms(String phoneNumber, String msg) { // Generate a random topic name to avoid collisions @@ -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 @@ -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:"); diff --git a/omod/src/main/java/org/openmrs/module/patientlist/fragment/controller/PatientListFragFragmentController.java b/omod/src/main/java/org/openmrs/module/patientlist/fragment/controller/PatientListFragFragmentController.java index 4e3eb69..4269d8d 100644 --- a/omod/src/main/java/org/openmrs/module/patientlist/fragment/controller/PatientListFragFragmentController.java +++ b/omod/src/main/java/org/openmrs/module/patientlist/fragment/controller/PatientListFragFragmentController.java @@ -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); diff --git a/omod/src/main/java/org/openmrs/module/patientlist/page/controller/UpdateNigeriaPatientsCountryPageController.java b/omod/src/main/java/org/openmrs/module/patientlist/page/controller/UpdateNigeriaPatientsCountryPageController.java index 35d57b0..ef88374 100644 --- a/omod/src/main/java/org/openmrs/module/patientlist/page/controller/UpdateNigeriaPatientsCountryPageController.java +++ b/omod/src/main/java/org/openmrs/module/patientlist/page/controller/UpdateNigeriaPatientsCountryPageController.java @@ -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()) { diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index 29bfe83..da5c6a3 100644 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -44,20 +44,13 @@ org.openmrs.module.legacyui - - + @@ -69,24 +62,21 @@ org.openmrs.api.VisitService org.openmrs.module.patientlist.advice.PatientStartingVisitAdvise + + --> org.openmrs.api.EncounterService org.openmrs.module.patientlist.advice.SendSMSLabsDrugsAdvice - - + patientlist.clerkrole diff --git a/omod/src/main/webapp/pages/enterPersonnelInfo.gsp b/omod/src/main/webapp/pages/enterPersonnelInfo.gsp index a56f1e7..4330b2f 100644 --- a/omod/src/main/webapp/pages/enterPersonnelInfo.gsp +++ b/omod/src/main/webapp/pages/enterPersonnelInfo.gsp @@ -78,8 +78,7 @@ function isValidSubmit() { <% } %>