Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/09/08 13:54:25 (4 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/HL7PatientHandler.java

    r4133 r4159  
    541541                ST STmn = xpn.getSecondAndFurtherGivenNamesOrInitialsThereof(); 
    542542                 
    543                 if ( FNln != null){ 
    544                         ln = FNln.getSurname().getValue();       
    545                 } 
     543                if ( FNln != null && FNln.getSurname() != null){ 
     544                        String lnvalue = FNln.getSurname().getValue();   
     545                        if (lnvalue != null ) ln = lnvalue; 
     546                } 
     547 
    546548                if (STfn != null){ 
    547                         fn = STfn.getValue(); 
     549                        String fnvalue = STfn.getValue(); 
     550                        if (fnvalue != null) fn = fnvalue; 
    548551                } 
    549552                 
    550553                if (STmn != null){ 
    551                         mn = STmn.getValue(); 
     554                        String mnvalue = STmn.getValue(); 
     555                        if (mnvalue != null) mn = mnvalue; 
    552556                } 
    553557                 
     
    561565                personNamesSet.add(name); 
    562566 
    563                 ln = ((ln == null) || ln.toLowerCase().equalsIgnoreCase("null"))? "" : ln; 
    564                 fn = ((fn == null) || fn.toLowerCase().equalsIgnoreCase("null"))? "" : fn; 
    565567                //for matching attribute only, check first name for invalid names 
    566568                //and nullify if needed 
     
    568570                        fn = checkFirstName(fn,this.distinct_only); 
    569571                } 
    570                 //personAttrList += ";fn:" + fn + ";ln:" + ln; 
    571  
     572                 
    572573                hl7Patient.setNames(personNamesSet); 
    573574                hl7Patient.getPersonName().setDateCreated(encounterDate); 
     
    880881        } 
    881882 
    882         public Provider setProviderFromPV1(PV1 pv1,Patient hl7Patient) { 
     883        public Provider setProviderFromPV1(PV1 pv1,Patient hl7Patient, Date encounterDate) { 
    883884 
    884885                //      Extract provider information for provider observations. 
     
    920921 
    921922                                provider.createUserForProvider(provider); 
    922                                 setPatientMatchingAttribute(provider, hl7Patient); 
     923                                setPatientMatchingAttribute(provider, hl7Patient, encounterDate); 
    923924 
    924925 
     
    988989        } 
    989990         
    990         public String setPatientMatchingAttribute(Provider provider, Patient p){ 
     991        public String setPatientMatchingAttribute(Provider provider, Patient p, Date encounterDate){ 
    991992                String mrn = "", attribute = "", drid = "" , 
    992993                       drfn = "", drln = "", nkfn = "", nkln = "", 
     
    998999                if (provider != null){ 
    9991000                        drid = provider.getId(); 
     1001                        if (drid ==  null){ 
     1002                                drid = ""; 
     1003                        } 
    10001004                        drfn = provider.getFirstName(); 
     1005                        if (drfn ==  null){ 
     1006                                drfn = ""; 
     1007                        } 
    10011008                        drln = provider.getLastName(); 
     1009                        if (drln ==  null){ 
     1010                                drln = ""; 
     1011                        } 
    10021012                } 
    10031013                 
    10041014                fn = p.getGivenName(); 
     1015                if (fn == null) fn = ""; 
    10051016                ln = p.getFamilyName(); 
     1017                if (ln == null) ln = ""; 
    10061018                sex = p.getGender(); 
     1019                if (sex == null) sex = ""; 
     1020                 
    10071021                if (p.getAttribute(ATTRIBUTE_RACE) != null){ 
    1008                         race = p.getAttribute(ATTRIBUTE_RACE).getValue().toLowerCase()
     1022                        race = p.getAttribute(ATTRIBUTE_RACE).getValue()
    10091023                } 
    10101024                if (p.getAttribute(ATTRIBUTE_TELEPHONE) != null) { 
    1011                         tel = p.getAttribute(ATTRIBUTE_TELEPHONE).getValue().toLowerCase()
     1025                        tel = p.getAttribute(ATTRIBUTE_TELEPHONE).getValue()
    10121026                } 
    10131027                if (p.getPatientIdentifier()!= null) { 
     
    10151029                } 
    10161030                if (p.getAttribute(ATTRIBUTE_NEXT_OF_KIN) != null){ 
    1017                         nkname = p.getAttribute(ATTRIBUTE_NEXT_OF_KIN).getValue().toLowerCase()
     1031                        nkname = p.getAttribute(ATTRIBUTE_NEXT_OF_KIN).getValue()
    10181032                } 
    10191033                int index = nkname.indexOf("|"); 
     
    10261040                 
    10271041                if (p.getPersonAddress()!= null){ 
    1028                         city = p.getPersonAddress().getCityVillage().toLowerCase(); 
    1029                         zip = p.getPersonAddress().getPostalCode().toLowerCase(); 
    1030                         st = p.getPersonAddress().getStateProvince().toLowerCase(); 
     1042                        city = p.getPersonAddress().getCityVillage(); 
     1043                        if (city == null) city = ""; 
     1044                        zip = p.getPersonAddress().getPostalCode(); 
     1045                        if (zip == null) zip = ""; 
     1046                        st = p.getPersonAddress().getStateProvince(); 
     1047                        if (st == null) st = ""; 
    10311048                } 
    10321049                 
     
    10501067                } 
    10511068 
    1052                 PersonAttribute matchingInfoAttribute = new PersonAttribute(otherMatchingAttrType,attribute); 
     1069                PersonAttribute matchingInfoAttribute = new PersonAttribute(); 
     1070                matchingInfoAttribute.setAttributeType(otherMatchingAttrType); 
     1071                matchingInfoAttribute.setDateCreated(encounterDate); 
     1072                matchingInfoAttribute.setCreator(Context.getAuthenticatedUser()); 
     1073                matchingInfoAttribute.setValue(attribute); 
    10531074                p.addAttribute(matchingInfoAttribute); 
    10541075                return attribute;