|
@ -781,11 +781,34 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
|
|
|
sql.append(" order by ord.create_time "+sort+" limit "+page*pageSize+","+pageSize);
|
|
|
|
|
|
List<EmergencyAssistanceDO> resultList = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(EmergencyAssistanceDO.class));
|
|
|
List<String> patientCodes = new ArrayList<>();
|
|
|
for (EmergencyAssistanceDO obj:resultList){
|
|
|
BasePatientDO patientDO = patientDao.findById(obj.getPatient());
|
|
|
obj.setPatientPhoto(patientDO.getPhoto());
|
|
|
obj.setPatientSex(patientDO.getSex());
|
|
|
obj.setPatientAge(IdCardUtil.getAgeForIdcard(patientDO.getIdcard()));
|
|
|
|
|
|
if(!patientCodes.contains(obj.getPatient())){
|
|
|
patientCodes.add(obj.getPatient());
|
|
|
}
|
|
|
}
|
|
|
String inSql = "";
|
|
|
for (String code : patientCodes) {
|
|
|
inSql += "'"+code+"',";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(inSql)){
|
|
|
inSql = inSql.substring(0,inSql.lastIndexOf(","));
|
|
|
//居民绑定的设备code
|
|
|
String deviceSql = "SELECT user,GROUP_CONCAT( DISTINCT category_code SEPARATOR ',' ) code " +
|
|
|
"from wlyy_patient_device where del = 0 and user in ("+inSql+") group by user";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(deviceSql);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
for (EmergencyAssistanceDO em : resultList) {
|
|
|
if(map.get("user").toString().equals(em.getPatient())){
|
|
|
em.setPatientDevices(map.get("code").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|