Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
04/30/08 19:48:54 (8 months ago)
Author:
msheley
Message:

--sockethl7listener
* Modify setting of patient identifier types when using

assigning authority

* Modify how Assigning Authority is pulled from PID segment

Files:

Legend:

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

    r4031 r4059  
    2222import org.openmrs.api.PersonService; 
    2323import org.openmrs.api.context.Context; 
     24import org.openmrs.module.sockethl7listener.service.SocketHL7ListenerService; 
    2425 
    2526import ca.uhn.hl7v2.HL7Exception; 
     
    476477                                        if (stIdent != null) 
    477478                                        { 
    478                                                 assignAuth = ident.getAssigningAuthority() 
    479                                                                .getUniversalID().toString(); 
     479                                                assignAuth = ident.getAssigningAuthority().getNamespaceID().getValue(); 
     480                                                 
    480481                                                if ((pit = patientService 
    481482                                                                .getPatientIdentifierType("MRN_" + assignAuth)) == null) 
     
    483484                                                        pit = patientService 
    484485                                                                        .getPatientIdentifierType("MRN_OTHER"); 
    485                                                         pi.setLocation(encounterLocation); 
    486                                                         pi.setIdentifierType(pit); 
    487                                                         pi.setIdentifier(stIdent); 
    488                                                         pi.setPreferred(true); 
    489                                                         pi.setDateCreated(encounterDate); 
    490                                                         pi.setCreator(Context.getAuthenticatedUser()); 
    491                                                         pi.setPatient(hl7Patient); 
    492                                                         identifiers.add(pi); 
    493486                                                } 
     487                                                pi.setLocation(encounterLocation); 
     488                                                pi.setIdentifierType(pit); 
     489                                                pi.setIdentifier(stIdent); 
     490                                                pi.setPreferred(true); 
     491                                                pi.setDateCreated(encounterDate); 
     492                                                pi.setCreator(Context.getAuthenticatedUser()); 
     493                                                pi.setPatient(hl7Patient); 
     494                                                identifiers.add(pi); 
     495                                                 
    494496                                        } 
    495497                                         
     
    855857                        motherNameAttr.setValue(motherNameString);       
    856858                        motherNameAttr.setDateCreated(encounterDate); 
    857                         //motherNameAttr.setDateCreated( new Date()); 
    858859                        motherNameAttr.setCreator(Context.getAuthenticatedUser()); 
    859860                        hl7Patient.addAttribute(motherNameAttr); 
     
    910911 
    911912                //      Extract provider information for provider observations. 
    912                 //PersonService ps = Context.getPersonService(); 
    913913                Provider provider = new Provider(); 
    914914                XCN doctor = null; 
     
    935935                        formatDoctorName(doctor,provider); 
    936936                        provider.createUserForProvider(provider); 
     937                        //using npi for provider id 
     938                        SocketHL7ListenerService hl7ListService = (SocketHL7ListenerService) Context.getService(SocketHL7ListenerService.class); 
     939                        String npi = hl7ListService.getNPI(provider.getFirstName(),provider.getLastName()); 
     940                        provider.setId(npi); 
    937941                         
    938942                        try { 
     
    953957                                        } 
    954958         
    955                                         PersonAttribute providerNameAttr = new PersonAttribute(providerNameAttrType,provider.getFirstName() + "." +  provider.getLastName()); 
    956                                         //providerNameAttr.setDateChanged(encounterDate); 
     959                                        PersonAttribute providerNameAttr = new PersonAttribute(providerNameAttrType,provider.getFirstName()  
     960                                                       + "." +  provider.getLastName()); 
    957961                                        providerNameAttr.setDateCreated(encounterDate); 
    958962                                        providerNameAttr.setCreator(Context.getAuthenticatedUser()); 
     
    960964 
    961965                                //Add to the attribute string used for matching 
     966                            //TODO If id is empty in the hl7 message, do we want to add 
     967                                        //add that empty string for drid, or do we want to use 
     968                                        //the referenced npi value? 
     969                                //concatMatchingAttribute("drid", id); 
    962970                                concatMatchingAttribute("drid", provider.getId()); 
    963971                                concatMatchingAttribute("drfn", provider.getFirstName());