Changeset 4059 for openmrs-modules/sockethl7listener/src/org/openmrs/module/sockethl7listener/HL7PatientHandler.java
- Timestamp:
- 04/30/08 19:48:54 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/sockethl7listener/src/org/openmrs/module/sockethl7listener/HL7PatientHandler.java
r4031 r4059 22 22 import org.openmrs.api.PersonService; 23 23 import org.openmrs.api.context.Context; 24 import org.openmrs.module.sockethl7listener.service.SocketHL7ListenerService; 24 25 25 26 import ca.uhn.hl7v2.HL7Exception; … … 476 477 if (stIdent != null) 477 478 { 478 assignAuth = ident.getAssigningAuthority() 479 .getUniversalID().toString();479 assignAuth = ident.getAssigningAuthority().getNamespaceID().getValue(); 480 480 481 if ((pit = patientService 481 482 .getPatientIdentifierType("MRN_" + assignAuth)) == null) … … 483 484 pit = patientService 484 485 .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);493 486 } 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 494 496 } 495 497 … … 855 857 motherNameAttr.setValue(motherNameString); 856 858 motherNameAttr.setDateCreated(encounterDate); 857 //motherNameAttr.setDateCreated( new Date());858 859 motherNameAttr.setCreator(Context.getAuthenticatedUser()); 859 860 hl7Patient.addAttribute(motherNameAttr); … … 910 911 911 912 // Extract provider information for provider observations. 912 //PersonService ps = Context.getPersonService();913 913 Provider provider = new Provider(); 914 914 XCN doctor = null; … … 935 935 formatDoctorName(doctor,provider); 936 936 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); 937 941 938 942 try { … … 953 957 } 954 958 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()); 957 961 providerNameAttr.setDateCreated(encounterDate); 958 962 providerNameAttr.setCreator(Context.getAuthenticatedUser()); … … 960 964 961 965 //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); 962 970 concatMatchingAttribute("drid", provider.getId()); 963 971 concatMatchingAttribute("drfn", provider.getFirstName());