Created
July 19, 2016 22:41
-
-
Save Zhang/15a540a3f559d6ab07dbadca51608151 to your computer and use it in GitHub Desktop.
payers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def patient_payers(type, id, range, filters) | |
ArrayList<Patient> patientList = patients(type, id, range, filters); | |
HashMap<Payer, Integer> dict = new HashMap<Payer, Integer>(); | |
for (Patient patient : patientList) { | |
ArrayList<Payers> payerList = patient.patientPayers(); | |
for (Payer payer : payerList) { | |
if (isInRange(payer, range)) { | |
if (dict.containsKey(payer)) { | |
dict.put(payer, ++dict.get(payer)); | |
} | |
else { | |
dict.put(payer, 1); | |
} | |
} | |
} | |
} | |
return dict; | |
end | |
def isInRange(patientPayer, range) | |
ArrayList<ActiveHistory> activeHistoryList = patientPayer.active_history; | |
Date admitDt = range[0]; | |
Date dischargeDt = range[1]; | |
boolean latestStatus = false; | |
for (ActiveHistory blob : activeHistoryList) { | |
if (blob.updated_at < admitDt) { | |
latestStatus = blob.value; | |
} | |
if (blob.updated_at > admitDt && blob.updated_at < dischargeDt) { | |
return true; | |
} | |
} | |
return latestStatus; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment