|
@ -19,6 +19,7 @@ import com.yihu.jw.patient.service.BasePatientMedicardCardService;
|
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import com.yihu.utils.security.MD5;
|
|
@ -439,7 +440,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findChild(String name,String residentialArea,String limit,JSONObject json){
|
|
|
String sql = "SELECT id,name,photo from base_patient WHERE archive_type = 2 and del = '1' ";
|
|
|
String sql = "SELECT id,name,photo,idcard,CAST(IFNULL(birthday,'') AS char ) birthday,residential_area residentialArea,sex from base_patient WHERE archive_type = 2 and del = '1' ";
|
|
|
if(!StringUtil.isBlank(name)){
|
|
|
sql+= " and name like '%"+name+"%' ";
|
|
|
}
|
|
@ -455,6 +456,10 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
Integer count = jdbcTemplate.queryForObject(sqlCount+filter,Integer.class);
|
|
|
map.put("online",json.containsKey(paientId));
|
|
|
map.put("doorCoach",count);
|
|
|
String idcardNo = map.get("idcard") + "";
|
|
|
Date birthday = DateUtil.strToDate(map.get("birthday").toString());
|
|
|
Integer age = IdCardUtil.getAgeByIdcardOrBirthday(idcardNo,birthday);
|
|
|
map.put("age",age);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@ -468,20 +473,27 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findOld(String name,String residentialArea,String limit,JSONObject json){
|
|
|
String sql = "SELECT id,name,photo from base_patient WHERE archive_type = 1 and del = '1' ";
|
|
|
String sql = "SELECT a.id,a.name,a.photo,a.idcard,CAST(IFNULL(a.birthday,'') AS char ) birthday,a.residential_area residentialArea,a.sex " +
|
|
|
", GROUP_CONCAT(DISTINCT d.category_code) deviceFlag from base_patient a " +
|
|
|
" LEFT JOIN wlyy_patient_device d on d.`user`=a.id WHERE a.archive_type = 1 and a.del = '1' ";
|
|
|
if(!StringUtil.isBlank(name)){
|
|
|
sql+= " and name like '%"+name+"%' ";
|
|
|
}
|
|
|
if(!StringUtil.isBlank(residentialArea)){
|
|
|
sql+= " and residential_area = '"+residentialArea+"' ";
|
|
|
}
|
|
|
sql+=limit;
|
|
|
sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex ";
|
|
|
sql += limit;
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
|
|
|
String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
|
|
|
String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
|
|
|
for (Map<String,Object> map:list){
|
|
|
String paientId = map.get("id").toString();
|
|
|
String idcardNo = map.get("idcard") + "";
|
|
|
Date birthday = DateUtil.strToDate(map.get("birthday").toString());
|
|
|
Integer age = IdCardUtil.getAgeByIdcardOrBirthday(idcardNo,birthday);
|
|
|
map.put("age",age);
|
|
|
String filter = " and patient = '"+paientId+"'";
|
|
|
Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
|
|
|
Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
|
|
@ -503,7 +515,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findHelper(String name,String limit,JSONObject json){
|
|
|
String sql = "SELECT id,name,photo from base_doctor WHERE doctor_level = 2 and del = '1' ";
|
|
|
String sql = "SELECT id,name,photo,sex from base_doctor WHERE doctor_level = 2 and del = '1' ";
|
|
|
if(!StringUtil.isBlank(name)){
|
|
|
sql+= " and name like '%"+name+"%' ";
|
|
|
}
|