Skip to content

Commit

Permalink
hack in some APIs for patient search based on station doing the search
Browse files Browse the repository at this point in the history
  • Loading branch information
slogan621 committed Apr 25, 2020
1 parent 2a7d32e commit 082e933
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions app/src/main/java/org/thousandsmiles/tscharts_lib/PatientREST.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,31 @@ public Object findPatientsByDOB(Date d) {
return m_lock;
}

public Object findPatientsByDOB(Date d, int station) {

VolleySingleton volley = VolleySingleton.getInstance();

volley.initQueueIf(getContext());

RequestQueue queue = volley.getQueue();

Calendar cal = Calendar.getInstance();
cal.setTime(d);
int month = cal.get(Calendar.MONTH) + 1;
int year = cal.get(Calendar.YEAR);
int day = cal.get(Calendar.DAY_OF_MONTH);

String url = String.format("%s://%s:%s/tscharts/v1/patient?dob=%s/%s/%s&station=%d", getProtocol(), getIP(), getPort(),
month, day, year, station);

AuthJSONArrayRequest request = new AuthJSONArrayRequest(url, null, new ArrayResponseListener(), new ErrorListener());
request.setRetryPolicy(new DefaultRetryPolicy(getTimeoutInMillis(), getRetries(), DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

queue.add(request);

return m_lock;
}

public Object findPatientsByName(String name) {

VolleySingleton volley = VolleySingleton.getInstance();
Expand All @@ -263,6 +288,24 @@ public Object findPatientsByName(String name) {
return m_lock;
}

public Object findPatientsByName(String name, int station) {

VolleySingleton volley = VolleySingleton.getInstance();

volley.initQueueIf(getContext());

RequestQueue queue = volley.getQueue();

String url = String.format("%s://%s:%s/tscharts/v1/patient?name=%s&station=%d", getProtocol(), getIP(), getPort(), name, station);

AuthJSONArrayRequest request = new AuthJSONArrayRequest(url, null, new ArrayResponseListener(), new ErrorListener());
request.setRetryPolicy(new DefaultRetryPolicy(getTimeoutInMillis(), getRetries(), DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

queue.add(request);

return m_lock;
}

public Object findPatientsByNameAndClinicId(String name, int clinicId) {

VolleySingleton volley = VolleySingleton.getInstance();
Expand All @@ -281,6 +324,24 @@ public Object findPatientsByNameAndClinicId(String name, int clinicId) {
return m_lock;
}

public Object findPatientsByNameAndClinicId(String name, int clinicId, int station) {

VolleySingleton volley = VolleySingleton.getInstance();

volley.initQueueIf(getContext());

RequestQueue queue = volley.getQueue();

String url = String.format("%s://%s:%s/tscharts/v1/patient?name=%s&clinic=%d&sttion=%d", getProtocol(), getIP(), getPort(), name,
clinicId, station);

AuthJSONArrayRequest request = new AuthJSONArrayRequest(url, null, new ArrayResponseListener(), new ErrorListener());
request.setRetryPolicy(new DefaultRetryPolicy(getTimeoutInMillis(), getRetries(), DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

queue.add(request);

return m_lock;
}

public Object updatePatient(PatientData pd) {

Expand Down

0 comments on commit 082e933

Please sign in to comment.