Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 3882

Show
Ignore:
Timestamp:
04/09/08 13:19:42 (9 months ago)
Author:
tmdugan
Message:

-- patient matching

* updated jars to get patient matching working as a module
* moved module logging configuration into log4j.xml

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/patientmatching/.classpath

    r3423 r3882  
    33        <classpathentry kind="src" path="src"/> 
    44        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 
    5         <classpathentry kind="lib" path="commons-logging-1.0.4.jar"/> 
    6         <classpathentry kind="lib" path="web-openmrs-api-1.0.54.1540.jar"/> 
    7         <classpathentry kind="lib" path="lib-common/spring-2.0.jar"/> 
    8         <classpathentry kind="lib" path="lib-common/openmrs-api-1.1.0.1810.jar"/> 
    95        <classpathentry kind="lib" path="lib/postgresql-8.1-406.jdbc3.jar"/> 
    10         <classpathentry kind="lib" path="lib/mysql-connector-java-5.0.6-bin.jar"/> 
    11         <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/> 
     6        <classpathentry kind="lib" path="lib/j2ee.jar"/> 
     7        <classpathentry kind="lib" path="lib/simmetrics_jar_v1_6_2_d07_02_07.jar"/> 
     8        <classpathentry kind="lib" path="lib-common/commons-logging-1.0.4.jar"/> 
     9        <classpathentry kind="lib" path="lib/simmetrics_jar_v1_4_d03_03_06.jar"/> 
     10        <classpathentry kind="lib" path="lib-common/log4j-1.2.13.jar"/> 
     11        <classpathentry kind="lib" path="lib-common/mysql-connector-java-3.1.10-bin.jar"/> 
     12        <classpathentry kind="lib" path="lib-common/spring-2.5.1.jar"/> 
     13        <classpathentry kind="lib" path="lib-common/openmrs-api-1.2.12.3789.jar"/> 
     14        <classpathentry kind="lib" path="lib-common/web-openmrs-api-1.2.12.3789.jar"/> 
    1215        <classpathentry kind="lib" path="lib/commons-dbcp-1.2.2.jar"/> 
    1316        <classpathentry kind="lib" path="lib/commons-pool-1.3.jar"/> 
    14         <classpathentry kind="lib" path="lib/j2ee.jar"/> 
    15         <classpathentry kind="lib" path="lib/simmetrics_jar_v1_6_2_d07_02_07.jar"/> 
    16         <classpathentry kind="output" path="bin"/> 
     17        <classpathentry kind="output" path="build"/> 
    1718</classpath> 
  • openmrs-modules/patientmatching/src/org/openmrs/module/patientmatching/PatientMatchingActivator.java

    r2802 r3882  
    88import java.util.Iterator; 
    99import java.util.List; 
     10import java.util.Set; 
    1011 
    1112import org.aopalliance.aop.Advice; 
    1213import org.apache.commons.logging.Log; 
    1314import org.apache.commons.logging.LogFactory; 
    14 import org.apache.log4j.ConsoleAppender; 
    15 import org.apache.log4j.FileAppender; 
    16 import org.apache.log4j.Level; 
    1715import org.apache.log4j.Logger; 
    18 import org.apache.log4j.PatternLayout; 
    1916import org.openmrs.Patient; 
    2017import org.openmrs.PatientIdentifier; 
    2118import org.openmrs.PersonAttribute; 
    2219import org.openmrs.PersonAttributeType; 
     20import org.openmrs.api.PatientService; 
    2321import org.openmrs.api.PatientSetService; 
    2422import org.openmrs.api.context.Context; 
     
    8179        private Log log = LogFactory.getLog(this.getClass()); 
    8280        public static String FILE_LOG = "patient_matching_file_log"; 
    83         public static String LOG_FILE_NAME = "log/link_module.log"; 
    8481        private Logger file_log = Logger.getLogger(FILE_LOG); 
    8582         
     
    108105                Context.addProxyPrivilege(PRIVILEGE2); 
    109106                 
    110                 // configure file logging 
    111                 file_log.setAdditivity(false); 
    112                 file_log.setLevel((Level)Level.INFO); 
    113                 try{ 
    114                         file_log.addAppender(new FileAppender(new PatternLayout("[%d{yyyy-MM-dd HH:mm:ss}]%m%n"), LOG_FILE_NAME)); 
    115                          
    116                 } 
    117                 catch(IOException ioe){ 
    118                         file_log.addAppender(new ConsoleAppender()); 
    119                 } 
    120                  
    121107                log.info("Starting to populate matching table"); 
    122108                if(LinkDBConnections.getInstance().getRecDBManager() != null){ 
     
    149135                // a record with openmrs_id equal to patient.getID, then add 
    150136                PatientSetService pss = Context.getPatientSetService(); 
    151                 List<Patient> patient_list = pss.getAllPatients().getPatients(); 
    152                 Iterator<Patient> it = patient_list.iterator(); 
     137                PatientService patientService = Context.getPatientService(); 
     138                Set<Integer> patient_list = pss.getAllPatients().getPersonIds(null); 
     139                Iterator<Integer> it = patient_list.iterator(); 
    153140                while(it.hasNext()){ 
    154                         Patient p = it.next(); 
     141                        Patient p = patientService.getPatient(it.next()); 
    155142                        Integer id = p.getPatientId(); 
    156143                        int existing_patients = link_db.getRecordCountFromDB(LINK_TABLE_KEY_DEMOGRAPHIC, id.toString());