public Map<String, List<PatientInfo>> getPatients(String sendingApplication,String sendingFacility) {
// TODO Auto-generated method stub
Map<String, List<PatientInfo>> patientMap = null;
List<PatientInfo> patientList = null;
patientMap = new HashMap<String, List<PatientInfo>>();
patientList = new ArrayList<PatientInfo>();
try {
PatientInfoDAO patientInfoDAO = new PatientInfoDAOImpl();
ItemCollection<QueryOutcome> items = patientInfoDAO.getPatients(sendingApplication, sendingFacility);
for(Item item : items){
PatientInfo patient = new PatientInfo();
patient.setAdministrativeSex(item.getString(""));
patient.setFamilyName(item.getString("FAMILYNAME"));
patient.setGivenName(item.getString("GIVENNAME"));
patient.setAdmitDateOrTime(item.getString("GENDER"));
patient.setAssignedPatientLocationBuilding(item.getString("USERNAME"));
patient.setAssignedPatientLocationFloor(item.getString("PASSWORD"));
patient.setAssignedPatientLocationPersonLocationType(item.getString("USERROLE"));
patient.setAssignedPatientLocationRoom(item.getString("USERSTATUS"));
patient.setAsssignedPatientLocationBed(item.getString("EMAIL"));
patient.setAttendingDoctor(item.getString("EMROPERATOR"));
patient.setClientId(item.getString("clientId"));
patient.setDateOrTimeOfMessage(item.getString("dateOrTimeOfMessage"));
patient.setDischargeDateOrTime(item.getString("dischargeDateOrTime"));
patient.setDob(item.getString("dob"));
patient.setEventOccuredTime(item.getString("eventOccuredTime"));
patient.setImageUrl(item.getString("imageUrl"));
patient.setLastModifiedOn(item.getString("lastModifiedOn"));
patient.setMessageControlId(item.getString("messageControlId"));
patient.setNrPatientId(item.getString("nrPatientId"));
patient.setPatientId(item.getString("patientId"));
patient.setPatientStatus(item.getString("patientStatus"));
patient.setPriorPatientLocationBed(item.getString("priorPatientLocationBed"));
patient.setPriorPatientLocationBuilding(item.getString("priorPatientLocationBuilding"));
patient.setPriorPatientLocationFloor(item.getString("priorPatientLocationFloor"));
patient.setPriorPatientLocationPersonLocationType(item.getString("priorPatientLocationPersonLocationType"));
patient.setPriorPatientLocationPointOfCare(item.getString("priorPatientLocationPointOfCare"));
patient.setPriorPatientLocationRoom(item.getString("priorPatientLocationRoom"));
patient.setReceivingFacility(item.getString("receivingFacility"));
patient.setRecevingApplication(item.getString("recevingApplication"));
patient.setSendingApplicaation(item.getString("sendingApplicaation"));
patient.setSendingFacility(item.getString("sendingFacility"));
patientList.add(patient);
}
String date = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
patientMap.put("PATIENTLIST", patientList);
patientMap.put("LASTKEY", date);
return patientMap;
}catch(AmazonServiceException ase){
throw new RuntimeException("internalServerError");
}catch(AmazonClientException ase){
throw new RuntimeException("internalServerError");
}
}
In this scenario i couldn't add String of date into Map>?
You are trying to place a string where a map expects a List.
Instead of:
patientMap.put("PATIENTLIST", patientList);
patientMap.put("LASTKEY", date);
Place:
patientMap.put(date, patientList);
With a map where date string is key and list of patient is value you can quickly get a list of patients for a given date.
If you want to use a map to hold a date and list of objects in string form, then you would have to convert back those strings back to their original date or list of patient objects.
If this is really what you want I suggest you look into java object serialization and deserialization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With