From 8b61b5c8087c24ecfeb498dfb01d100d362d6ae0 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Sun, 12 Apr 2015 15:09:30 -0700 Subject: [PATCH 1/2] Add PractitionerResourceProvider and update PatientResourceProvider --- .../i3l/HealthPort/PractitionerPortInfo.java | 269 +++++++++++++++ .../gatech/i3l/HealthPort/RestfulServlet.java | 3 + .../providers/PatientResourceProvider.java | 140 +++++++- .../PractitionerResourceProvider.java | 324 ++++++++++++++++++ 4 files changed, 735 insertions(+), 1 deletion(-) create mode 100644 src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java create mode 100644 src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java diff --git a/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java b/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java new file mode 100644 index 0000000..9aaccc0 --- /dev/null +++ b/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java @@ -0,0 +1,269 @@ +/** + * + */ +package edu.gatech.i3l.HealthPort; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.sql.Date; +import java.util.List; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import org.apache.commons.lang3.StringEscapeUtils; + +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt; +import ca.uhn.fhir.model.dstu.composite.CodingDt; +import ca.uhn.fhir.model.dstu.composite.ContainedDt; +import ca.uhn.fhir.model.dstu.composite.QuantityDt; +import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.resource.Condition; +import ca.uhn.fhir.model.dstu.resource.Medication; +import ca.uhn.fhir.model.dstu.resource.MedicationPrescription; +import ca.uhn.fhir.model.dstu.resource.Observation; +import ca.uhn.fhir.model.dstu.resource.MedicationPrescription.Dispense; +import ca.uhn.fhir.model.dstu.resource.MedicationPrescription.DosageInstruction; +import ca.uhn.fhir.model.dstu.valueset.ConditionStatusEnum; +import ca.uhn.fhir.model.dstu.valueset.MedicationPrescriptionStatusEnum; +import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; +import ca.uhn.fhir.model.dstu.valueset.ObservationReliabilityEnum; +import ca.uhn.fhir.model.dstu.valueset.ObservationStatusEnum; +import ca.uhn.fhir.model.primitive.DateDt; +import ca.uhn.fhir.model.primitive.DateTimeDt; +import ca.uhn.fhir.model.primitive.IdDt; +import edu.gatech.i3l.HealthPort.providers.PatientResourceProvider; + +/** + * @author Myung Choi Constructor requires UserID. - Connects to SQL database to + * obtain patient related parameters. + */ +public class PractitionerPortInfo { + + + public String providerOrg = null; + public String providerId = null; + public String providerNpi = null; + public String facilityName = null; + public String specialty = null; + public String name = null; + public String pClass = null; + public String location = null; + public Date dateOfBirth = null; + public String sex = null; + public String supervisionRequired = null; + public String personId = null; + public String primaryClinicLocation = null; + + // Database Paging Resource Names + public static String OBSERVATION = "OBSERVATION"; + public static String CONDITION = "CONDITIONS"; + public static String MEDICATIONPRESCRIPTION = "MEDICATIONPRESCRIPTION"; + + private DataSource dataSource; + + /** + * + */ + public PractitionerPortInfo() { + databaseSetup("jdbc/HealthPort"); + } + + public PractitionerPortInfo(String jndiName) { + databaseSetup(jndiName); + } + + public PractitionerPortInfo(String jndiName, String userId) { + databaseSetup(jndiName); + setInformation(userId); + } + + public List getResourceIdsByProviderName(String tableName, + String practitionerName) { + List retVal = new ArrayList(); + + Connection connection = null; + Statement statement = null; + + String SQL_STATEMENT = "SELECT Provider_ID FROM " + tableName + + " WHERE name = '" + practitionerName + "'"; + + System.out.println ("HealthPortInfo: getResourceIdsByProviders: "+tableName+" for Provider "+practitionerName); + connection = getConnection(); + try { + statement = connection.createStatement(); + ResultSet rs = statement.executeQuery(SQL_STATEMENT); + + while (rs.next()) { + retVal.add(rs.getString("Provider_ID")); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + try { + connection.close(); + } catch (SQLException e) { // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + System.out.println ("HealthPortInfo: getResourceIdsByProviders: Done"); + + return retVal; + } + + private void databaseSetup(String jndiName) { + try { + dataSource = (DataSource) new InitialContext() + .lookup("java:/comp/env/" + jndiName); + } catch (NamingException e) { + e.printStackTrace(); + } + } + + public Connection getConnection() { + try { + return dataSource.getConnection(); + } catch (SQLException e) { + e.printStackTrace(); + return null; + } + } + + public void resetInformation() { + + providerOrg = null; + providerId = null; + providerNpi = null; + facilityName = null; + specialty = null; + name = null; + pClass = null; + location = null; + dateOfBirth = null; + sex = null; + supervisionRequired = null; + personId = null; + primaryClinicLocation = null; + + } + + public void setRSInformation(ResultSet rs) throws SQLException { + + + providerOrg = rs.getString("Provider_Org"); + providerId = rs.getString("Provider_ID"); + providerNpi = rs.getString("Provider_NPI"); + facilityName = rs.getString("Facility_Name"); + specialty = rs.getString("Specialty"); + name = rs.getString("Name"); + pClass = rs.getString("Class"); + location = rs.getString("Location"); + sex = rs.getString("Sex"); + supervisionRequired = rs.getString("Supervision_Required"); + personId = rs.getString("Person_ID"); + primaryClinicLocation = rs.getString("Primary_Clinic_Location"); + +/* System.out.println("Provider_Org="+ rs.getString("Provider_Org")); + System.out.println("Provider_ID=" + rs.getString("Provider_ID")); + System.out.println("Provider_NPI=" + rs.getString("Provider_NPI")); + System.out.println("Facility_Name=" + rs.getString("Facility_Name")); + System.out.println("Specialty=" + rs.getString("Specialty")); + System.out.println("Name=" + rs.getString("Name")); + System.out.println("Class=" + rs.getString("Class")); + System.out.println("Location=" + rs.getString("Location")); + System.out.println("Sex=" + rs.getString("Sex")); + System.out.println("Supervision_Required=" + rs.getString("Supervision_Required")); + System.out.println("Person_ID="+ rs.getString("Person_ID")); + System.out.println("Primary_Clinic_Location=" + rs.getString("Primary_Clinic_Location")); + + +*/ + } + + public void setInformation(String providerId) { + + Connection connection = null; + Statement statement = null; + + this.providerId = providerId; + + try { + connection = getConnection(); + statement = connection.createStatement(); + String SQL_STATEMENT = "SELECT Provider_ID, Provider_Org, Provider_NPI, Facility_Name, Specialty, Name, Class, Location, Sex, Supervision_Required, Person_ID, Primary_Clinic_Location FROM provider where Provider_ID='" + providerId + "'"; + + ResultSet resultSet = statement.executeQuery(SQL_STATEMENT); + + if(resultSet!= null) { + if (resultSet.next()) { + setRSInformation(resultSet); + } + } + + } catch (Exception e) { + e.printStackTrace(); + resetInformation(); + } finally { + try { + connection.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + public String getOrgID(String Tag) { + String orgID = null; + Connection connection = getConnection(); + try { + Statement statement = connection.createStatement(); + String SQL_STATEMENT = "SELECT * FROM ORGANIZATION WHERE TAG='" + + Tag + "'"; + ResultSet resultSet = statement.executeQuery(SQL_STATEMENT); + + if (resultSet.next()) { + orgID = resultSet.getString("ID"); + // System.out.println("[HealthPortUserInfo]"+userId); + // System.out.println("[HealthPortUserInfo]"+name+":"+dataSource); + } + + + } catch (Exception e) { + e.printStackTrace(); + resetInformation(); + } finally { + try { + connection.close(); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return orgID; + } + + /** + * @param string + * @param string2 + */ + public void setInformationProviderID(String string, String string2) { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/edu/gatech/i3l/HealthPort/RestfulServlet.java b/src/edu/gatech/i3l/HealthPort/RestfulServlet.java index b69d1cf..149cf11 100644 --- a/src/edu/gatech/i3l/HealthPort/RestfulServlet.java +++ b/src/edu/gatech/i3l/HealthPort/RestfulServlet.java @@ -13,6 +13,7 @@ import edu.gatech.i3l.HealthPort.providers.MedicationPrescrResource; import edu.gatech.i3l.HealthPort.providers.ObservationResourceProvider; import edu.gatech.i3l.HealthPort.providers.PatientResourceProvider; +import edu.gatech.i3l.HealthPort.providers.PractitionerResourceProvider; import org.slf4j.LoggerFactory; @@ -63,6 +64,8 @@ protected void initialize() throws ServletException { resourceProviders.add(new ObservationResourceProvider()); resourceProviders.add(new ConditionResourceProvider()); resourceProviders.add(new MedicationPrescrResource()); + resourceProviders.add(new PractitionerResourceProvider()); + setResourceProviders(resourceProviders); // /* diff --git a/src/edu/gatech/i3l/HealthPort/providers/PatientResourceProvider.java b/src/edu/gatech/i3l/HealthPort/providers/PatientResourceProvider.java index d5610ec..7d08f51 100644 --- a/src/edu/gatech/i3l/HealthPort/providers/PatientResourceProvider.java +++ b/src/edu/gatech/i3l/HealthPort/providers/PatientResourceProvider.java @@ -1,6 +1,7 @@ package edu.gatech.i3l.HealthPort.providers; import java.sql.Connection; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; @@ -10,14 +11,21 @@ import javax.sql.DataSource; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; import ca.uhn.fhir.model.dstu.resource.Patient; +import ca.uhn.fhir.model.dstu.resource.Practitioner; import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.UriDt; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.rest.annotation.IdParam; import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.annotation.RequiredParam; import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.param.ReferenceParam; +import ca.uhn.fhir.rest.server.IBundleProvider; import ca.uhn.fhir.rest.server.IResourceProvider; import edu.gatech.i3l.HealthPort.HealthPortInfo; import edu.gatech.i3l.HealthPort.ports.ExactDataPort; @@ -29,7 +37,8 @@ */ public class PatientResourceProvider implements IResourceProvider { public static final String SQL_STATEMENT = "SELECT U1.ID, U1.ORGANIZATIONID, U1.NAME, ORG.TAG, U1.RECORDID, U1.PERSONID, U1.GENDER, U1.CONTACT, U1.ADDRESS FROM USER AS U1 LEFT JOIN ORGANIZATION AS ORG ON (ORG.ID=U1.ORGANIZATIONID)"; - + public static final String SQL_PATIENTS_BY_PROVIDERS = "SELECT DISTINCT U1.NAME, U1.ORGANIZATIONID, U1.PERSONID, enc.Provider_ID, enc.Provider_Name FROM USER AS U1 RIGHT JOIN encounter AS enc ON (enc.Member_ID=U1.PERSONID) where enc.Provider_ID =?"; + private HealthPortInfo healthPortUser; private String GWID; private String HVID; @@ -164,5 +173,134 @@ public List getAllPatients() { return retVal; } + + @Search(queryName="provider") + //http://localhost:8080/HealthPort/fhir/Patient?_query=provider&identifier=123456789 + public IBundleProvider getAllPatientsByProvider( @RequiredParam(name = Practitioner.SP_IDENTIFIER) ReferenceParam provider) { + + final InstantDt searchTime = InstantDt.withCurrentTime(); + if(provider==null) return new IBundleProvider() { + + @Override + public List getResources(int theFromIndex, int theToIndex) { + // TODO Auto-generated method stub + List retVal = new ArrayList(); + return retVal; + } + + @Override + public int size() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public InstantDt getPublished() { + // TODO Auto-generated method stub + return searchTime; + } + + + }; + + String providerId = provider.getIdPart(); + + final List patients = getPatients(providerId); + + + return new IBundleProvider() { + + @Override + public int size() { + return patients.size(); + } + + @Override + public List getResources(int theFromIndex, int theToIndex) { + + List retVal = null; + + retVal = patients.subList(theFromIndex, theToIndex); + + return retVal; + } + + @Override + public InstantDt getPublished() { + return searchTime; + } + }; + + } + + + private List getPatients(String providerId) { + Connection connection; + + List retVal = new ArrayList(); + + try{ + connection = healthPortUser.getConnection(); + + PreparedStatement pstmt = connection + .prepareStatement(SQL_PATIENTS_BY_PROVIDERS); + pstmt.setString(1, providerId); + + ResultSet resultSet = pstmt.executeQuery(); + + while (resultSet.next()) { + + + String memberName, personId, orgID, providerName = null; + + memberName = resultSet.getString("NAME"); + personId = resultSet.getString("PERSONID"); + orgID = resultSet.getString("ORGANIZATIONID"); + providerName = resultSet.getString("Provider_Name"); + + String[] userName = memberName.split(" "); + + Patient patient = new Patient(); + patient.addIdentifier(); + patient.getIdentifier().get(0).setSystem(new UriDt("urn:healthport:mrns")); + if (orgID.equals(GWID) || orgID.equalsIgnoreCase(HVID)) { + patient.setId(orgID+"."+personId); + patient.getIdentifier().get(0).setValue(orgID+"."+personId); + } else { + patient.setId(orgID+"."+personId); + patient.getIdentifier().get(0).setValue(orgID+"."+personId); + } + String fullName = null; + if (userName.length == 2){ + patient.addName().addFamily(userName[1]); + patient.getName().get(0).addGiven(userName[0]); + fullName = userName[0] + " "+userName[1]; + } + else{ + patient.addName().addFamily(userName[2]); + patient.getName().get(0).addGiven(userName[0]+ " "+ userName[1]); + fullName = userName[0] + " "+userName[1]+ " "+userName[2]; + } + + ResourceReferenceDt providerRefDt = new ResourceReferenceDt(); + providerRefDt.setDisplay(providerName); + providerRefDt.setReference(providerId); + patient.getCareProvider().add(providerRefDt); + + patient.getText().setStatus(NarrativeStatusEnum.GENERATED); + String textBody = "" + + "
Name"+ fullName + + "
"; + patient.getText().setDiv(textBody); + retVal.add(patient); + } + connection.close(); + + } catch (Exception e){ + e.printStackTrace(); + } + return retVal; + } + } \ No newline at end of file diff --git a/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java b/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java new file mode 100644 index 0000000..bb8122d --- /dev/null +++ b/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java @@ -0,0 +1,324 @@ +/** + * + */ +package edu.gatech.i3l.HealthPort.providers; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt; +import ca.uhn.fhir.model.dstu.resource.Patient; +import ca.uhn.fhir.model.dstu.resource.Practitioner; +import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.Read; +import ca.uhn.fhir.rest.annotation.RequiredParam; +import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.param.ReferenceParam; +import ca.uhn.fhir.rest.server.IBundleProvider; +import ca.uhn.fhir.rest.server.IResourceProvider; +import edu.gatech.i3l.HealthPort.HealthPortInfo; +import edu.gatech.i3l.HealthPort.PractitionerPortInfo; +import edu.gatech.i3l.HealthPort.ports.GreenwayPort; +import edu.gatech.i3l.HealthPort.ports.HealthVaultPort; + +/** + * @author Paul + * + */ + +public class PractitionerResourceProvider implements IResourceProvider { + + /* (non-Javadoc) + * @see ca.uhn.fhir.rest.server.IResourceProvider#getResourceType() + */ + + public static final String SQL_STATEMENT = "SELECT * FROM provider"; + String SQL_STATEMENT_GET_PROVIDERS_BY_PATIENT = "select enc.Provider_ID, enc.Member_ID, enc.Provider_Name from encounter as enc LEFT JOIN provider AS pro ON(pro.Provider_ID=enc.Provider_ID and pro.Name = enc.Provider_Name) where enc.Member_ID=?"; + + + private PractitionerPortInfo practitionerPortInfo; + private HealthPortInfo healthPortUser; + + + private String GWID; + private String HVID; + + public PractitionerResourceProvider() { + practitionerPortInfo = new PractitionerPortInfo ("jdbc/HealthPort"); + healthPortUser = new HealthPortInfo ("jdbc/HealthPort"); + GWID = healthPortUser.getOrgID(GreenwayPort.GREENWAY); + HVID = healthPortUser.getOrgID(HealthVaultPort.HEALTHVAULT); + + } + + public Class getResourceType() { + return Practitioner.class; + } + + + @Read() + public Practitioner getResourceById(@IdParam IdDt theId){ + + Practitioner practitioner = new Practitioner(); + if(theId==null) return practitioner; + + String providerId; + String id = theId.getIdPart(); + + practitionerPortInfo.setInformation(id); + providerId = practitionerPortInfo.providerId; + + practitioner.addIdentifier(); + practitioner.getIdentifier().get(0).setSystem(new UriDt("urn:healthport:mrns")); + practitioner.setId(providerId); + practitioner.getIdentifier().get(0).setValue(providerId); + + String fullName = null; + + if(practitionerPortInfo.name!=null) { + + String[] userName = practitionerPortInfo.name.split(" "); + if (userName.length == 2){ + + String family = userName[1].replaceAll(",", ""); + practitioner.getName().addFamily(family); + practitioner.getName().addGiven(userName[0]); + fullName = userName[0] + " "+ family; + } + else{ + String family = userName[2].replaceAll(",", ""); + practitioner.getName().addFamily(family); + practitioner.getName().addGiven(userName[0]+ " "+ userName[1]); + fullName = userName[0] + " "+userName[1]+ " "+ family; + + } + + practitioner.setOrganization(new ResourceReferenceDt(practitionerPortInfo.providerOrg)); + practitioner.getLocation().add(new ResourceReferenceDt(practitionerPortInfo.location)); + + practitioner.getText().setStatus(NarrativeStatusEnum.GENERATED); + String textBody = "" + + "
Name"+ fullName + + "
"; + practitioner.getText().setDiv(textBody); + + } + return practitioner; + } + + + @Search + public List getAllPractitioners() { + + Connection connection = null; + + ArrayList retVal = new ArrayList(); + + try { + connection = practitionerPortInfo.getConnection(); + + PreparedStatement pstmt = connection + .prepareStatement(SQL_STATEMENT); + + ResultSet resultSet = pstmt.executeQuery(); + + while (resultSet.next()) { + + practitionerPortInfo.setRSInformation(resultSet); + if(practitionerPortInfo.name!=null) { + + String[] userName = practitionerPortInfo.name.split(" "); + + Practitioner practitioner = new Practitioner(); + practitioner.addIdentifier(); + practitioner.getIdentifier().get(0).setSystem(new UriDt("urn:healthport:mrns")); + + String providerId; + providerId = practitionerPortInfo.providerId; + + practitioner.setId(providerId); + practitioner.getIdentifier().get(0).setValue(providerId); + + String fullName = null; + if (userName.length == 2){ + String family = userName[1].replaceAll(",", ""); + practitioner.getName().addFamily(family); + practitioner.getName().addGiven(userName[0]); + fullName = userName[0] + " "+ family; + } + else{ + String family = userName[2].replaceAll(",", ""); + practitioner.getName().addFamily(family); + practitioner.getName().addGiven(userName[0]+ " "+ userName[1]); + fullName = userName[0] + " "+userName[1]+ " "+ family; + } + + practitioner.setOrganization(new ResourceReferenceDt(practitionerPortInfo.providerOrg)); + practitioner.getLocation().add(new ResourceReferenceDt(practitionerPortInfo.location)); + + practitioner.getText().setStatus(NarrativeStatusEnum.GENERATED); + String textBody = "" + + "
Name"+ fullName + + "
"; + practitioner.getText().setDiv(textBody); + + retVal.add(practitioner); + } + } + connection.close(); + + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + return retVal; + + } + + @Search(queryName="patient") + //http://localhost:8080/HealthPort/fhir/Provider?_query=patient&identifier=3.887654321 + public IBundleProvider getAllProvidersByPatient( @RequiredParam(name = Patient.SP_IDENTIFIER) ReferenceParam patient) { + + final InstantDt searchTime = InstantDt.withCurrentTime(); + if(patient==null) return new IBundleProvider() { + + @Override + public List getResources(int theFromIndex, int theToIndex) { + // TODO Auto-generated method stub + List retVal = new ArrayList(); + return retVal; + } + + @Override + public int size() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public InstantDt getPublished() { + // TODO Auto-generated method stub + return searchTime; + } + + + }; + + String patientId = patient.getIdPart(); + + final List providers = getProviders(patientId); + + + return new IBundleProvider() { + + @Override + public int size() { + return providers.size(); + } + + @Override + public List getResources(int theFromIndex, int theToIndex) { + + List retVal = null; + + retVal = providers.subList(theFromIndex, theToIndex); + + return retVal; + } + + @Override + public InstantDt getPublished() { + return searchTime; + } + }; + + } + + + private List getProviders(String memberId) { + Connection connection; + + List retVal = new ArrayList(); + String patientID; + + String Ids[] = memberId.split("."); + if(Ids.length==2) { + patientID = Ids[1]; + } + else { + patientID = memberId; + } + + try{ + connection = practitionerPortInfo.getConnection(); + + PreparedStatement pstmt = connection + .prepareStatement(SQL_STATEMENT_GET_PROVIDERS_BY_PATIENT); + pstmt.setString(1, patientID); + + System.out.println(pstmt.toString()); + + ResultSet resultSet = pstmt.executeQuery(); + + while (resultSet.next()) { + + + String providerName, providerId; + + providerId = resultSet.getString("Provider_ID"); + providerName = resultSet.getString("Provider_Name"); + + String[] userName = providerName.split(" "); + + Practitioner practitioner = new Practitioner(); + + practitioner.addIdentifier(); + practitioner.getIdentifier().get(0).setSystem(new UriDt("urn:healthport:mrns")); + + practitioner.setId(providerId); + practitioner.getIdentifier().get(0).setValue(providerId); + + String fullName = null; + if (userName.length == 2){ + String family = userName[1].replaceAll(",", ""); + practitioner.getName().addFamily(family); + practitioner.getName().addGiven(userName[0]); + fullName = userName[0] + " "+ family; + } + else{ + String family = userName[2].replaceAll(",", ""); + practitioner.getName().addFamily(family); + practitioner.getName().addGiven(userName[0]+ " "+ userName[1]); + fullName = userName[0] + " "+userName[1]+ " "+ family; + } + + practitioner.getText().setStatus(NarrativeStatusEnum.GENERATED); + String textBody = "" + + "
Name"+ fullName + + "
"; + practitioner.getText().setDiv(textBody); + + retVal.add(practitioner); + } + connection.close(); + + } catch (Exception e){ + e.printStackTrace(); + } + return retVal; + } + + +} From 98d1f11916b97c1a507674de8ad95557ee737f42 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 29 Apr 2015 09:58:42 -0700 Subject: [PATCH 2/2] took out println from Practitioner --- .../i3l/HealthPort/PractitionerPortInfo.java | 20 +------------------ .../PractitionerResourceProvider.java | 2 -- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java b/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java index 9aaccc0..fe052df 100644 --- a/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java +++ b/src/edu/gatech/i3l/HealthPort/PractitionerPortInfo.java @@ -100,7 +100,6 @@ public List getResourceIdsByProviderName(String tableName, String SQL_STATEMENT = "SELECT Provider_ID FROM " + tableName + " WHERE name = '" + practitionerName + "'"; - System.out.println ("HealthPortInfo: getResourceIdsByProviders: "+tableName+" for Provider "+practitionerName); connection = getConnection(); try { statement = connection.createStatement(); @@ -119,7 +118,6 @@ public List getResourceIdsByProviderName(String tableName, } } - System.out.println ("HealthPortInfo: getResourceIdsByProviders: Done"); return retVal; } @@ -176,21 +174,6 @@ public void setRSInformation(ResultSet rs) throws SQLException { personId = rs.getString("Person_ID"); primaryClinicLocation = rs.getString("Primary_Clinic_Location"); -/* System.out.println("Provider_Org="+ rs.getString("Provider_Org")); - System.out.println("Provider_ID=" + rs.getString("Provider_ID")); - System.out.println("Provider_NPI=" + rs.getString("Provider_NPI")); - System.out.println("Facility_Name=" + rs.getString("Facility_Name")); - System.out.println("Specialty=" + rs.getString("Specialty")); - System.out.println("Name=" + rs.getString("Name")); - System.out.println("Class=" + rs.getString("Class")); - System.out.println("Location=" + rs.getString("Location")); - System.out.println("Sex=" + rs.getString("Sex")); - System.out.println("Supervision_Required=" + rs.getString("Supervision_Required")); - System.out.println("Person_ID="+ rs.getString("Person_ID")); - System.out.println("Primary_Clinic_Location=" + rs.getString("Primary_Clinic_Location")); - - -*/ } public void setInformation(String providerId) { @@ -236,8 +219,7 @@ public String getOrgID(String Tag) { if (resultSet.next()) { orgID = resultSet.getString("ID"); - // System.out.println("[HealthPortUserInfo]"+userId); - // System.out.println("[HealthPortUserInfo]"+name+":"+dataSource); + } diff --git a/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java b/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java index bb8122d..b86bb79 100644 --- a/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java +++ b/src/edu/gatech/i3l/HealthPort/providers/PractitionerResourceProvider.java @@ -267,8 +267,6 @@ private List getProviders(String memberId) { PreparedStatement pstmt = connection .prepareStatement(SQL_STATEMENT_GET_PROVIDERS_BY_PATIENT); pstmt.setString(1, patientID); - - System.out.println(pstmt.toString()); ResultSet resultSet = pstmt.executeQuery();