Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/09/08 18:54:25 (7 months ago)
Author:
msheley
Message:

sockethl7listener --
* Adjustments for blank name and address fields in hl7
* Added handling messages that have no date/times for encounters
* Moved location where createObsForProvider is called.
* Modified logging

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/sockethl7listener/src/org/openmrs/module/sockethl7listener/HL7SocketHandler.java

    r4133 r4159  
    3838import org.openmrs.api.context.Context; 
    3939import org.openmrs.api.context.ContextAuthenticationException; 
    40 import org.openmrs.api.context.UserContext; 
    4140import org.openmrs.hl7.HL7Constants; 
    4241import org.openmrs.hl7.HL7InQueue; 
     
    5655import ca.uhn.hl7v2.model.v25.datatype.CWE; 
    5756import ca.uhn.hl7v2.model.v25.datatype.CX; 
     57import ca.uhn.hl7v2.model.v25.datatype.DTM; 
    5858import ca.uhn.hl7v2.model.v25.datatype.ID; 
    5959import ca.uhn.hl7v2.model.v25.datatype.NM; 
     
    152152         * @throws ContextAuthenticationException 
    153153         */ 
    154         public Message processMessage(Message message) throws ApplicationException { 
     154        public synchronized Message processMessage(Message message) throws ApplicationException { 
    155155                 
    156156                Context.openSession(); 
     
    234234                 
    235235                // validate message 
    236  
     236                Date starttime = new Date(); 
    237237                validate(message); 
    238238                boolean error = false; 
     
    269269                                        + message.getName()); 
    270270                } 
    271                  
     271                DTM dtm = (DTM) timeStamp.getComponent(0); 
     272                if (dtm == null || dtm.getValue() == null){ 
     273                        timeStamp = msh.getDateTimeOfMessage(); 
     274                } 
    272275         
    273276                 
     
    284287                         
    285288                        // Get the location 
    286                         Date starttime = new Date(); 
     289                        //Date starttime = new Date(); 
    287290                        String institutionId = zlr.getOrderingFacilityIDNum(); 
    288291                        Location encounterLocation = setLocation(institutionId); 
    289292                        Date encounterDate = TranslateDate(timeStamp); 
    290293                        Patient hl7Patient = patientHandler.setPatientFromHL7(pid,nk1,encounterDate,encounterLocation); 
    291                         Provider provider = patientHandler.setProviderFromPV1(pv1,hl7Patient); 
     294                        Provider provider = patientHandler.setProviderFromPV1(pv1,hl7Patient,encounterDate); 
    292295                         
    293296                        Patient resultPatient = findPatient(hl7Patient,encounterDate);                   
     
    300303                                                resultPatient,encounterDate,  provider); 
    301304                                } 
    302                          
     305                               createObsForProvider(encounter,provider); 
    303306                                if (message instanceof ORU_R01) 
    304307                                { 
     
    403406                                enc.setProvider(providerUser); 
    404407                                es.createEncounter(enc); 
    405                                 createObsForProvider(enc,provider); 
     408                                //createObsForProvider(enc,provider); 
    406409                 
    407410                         
     
    12321235                 
    12331236                 
    1234                 String id, mrn ,fn,ln,gender,city,state,zip, db, mb, yb, tel , hl7Tel, matchTel, addr1; 
     1237                String id, mrn ="" ,fn = "", ln = "", gender = "", 
     1238                city = "", state = "", zip = "", db = "", mb = "",  
     1239                yb = "", tel= "" , hl7Tel = "", matchTel = "", addr1 = ""; 
    12351240                 
    12361241                Calendar hl7cal = Calendar.getInstance(); 
     
    12591264                PersonAddress hl7PA = hl7Patient.getPersonAddress(); 
    12601265                 
    1261                 String hl7City, hl7State, hl7Zip, hl7Addr1
     1266                String hl7City = "", hl7State = "", hl7Zip = "", hl7Addr1 = ""
    12621267                if (hl7PA != null) { 
    12631268                        hl7Addr1 = hl7PA.getAddress1(); 
     1269                        if (hl7Addr1 == null || hl7Addr1.equals("")){ 
     1270                                hl7Addr1 = ""; 
     1271                        } 
    12641272                        hl7City = hl7PA.getCityVillage(); 
     1273                        if (hl7City == null || hl7City.equals("")){ 
     1274                                hl7City = ""; 
     1275                        } 
     1276                 
    12651277                        hl7State = hl7PA.getStateProvince(); 
     1278                        if (hl7State == null || hl7State.equals("")){ 
     1279                                hl7State = ""; 
     1280                        } 
    12661281                        hl7Zip = hl7PA.getPostalCode(); 
    1267                 }else{ 
    1268                         hl7Addr1 = ""; 
    1269                         hl7City = ""; 
    1270                         hl7State = ""; 
    1271                         hl7Zip = ""; 
     1282                         
     1283                        if (hl7Zip == null || hl7Zip.equals("")){ 
     1284                                hl7Zip = ""; 
     1285                        } 
    12721286                } 
    12731287                 
     
    16111625                        String firstname = ""; 
    16121626                        String lastname = ""; 
    1613                         int index1 =NKnameValue.indexOf("."); 
     1627                        int index1 =NKnameValue.indexOf("|"); 
    16141628                        if (index1 != -1){ 
    16151629                                firstname = NKnameValue.substring(0,index1);